Removing a physical partition from LVM

Rate this item
(0 votes)

The system monitor in Ubuntu 9.10 showed that there was a problem with one disk

(/Dev/sdb), which had been added to LVM.

I had to remove this disk from LVM as follows, all operations are dangerous and are executed as root.

1. First determine how much LVM should be reduced by

2. Then convert the EXT3 file system to EXT2, and reduce

3. Remove the physical volume and extract it from VG

4. Extend LVM and EXT2 to the maximum

5. Restore EXT3

Make sure to observe the sequence of operations flow.


PV VG Fmt Attr PSize PFree

/dev/sda5 mediavg lvm2 a- 6,24G 0

/dev/sda6 mediavg lvm2 a- 48,30G 0

/dev/sdb2 linux lvm2 a- 32,49G 5,86G

/dev/sdb5 media lvm2 a- 200,20G 0

/dev/sdc1 media lvm2 a- 596,17G 0

We can see that the LVM on media must be reduced by more than 200Gb, otherwise /dev/sdb5 can not be removed


VG #PV #LV #SN Attr VSize VFree

linux 1 2 0 wz--n- 32,49G 5,86G

media 2 1 0 wz--n- 796,36G 0

mediavg 2 1 0 wz--n- 54,54G 0


LV VG Attr LSize Origin Snap% Move Log Copy%

ubuntu linux -wi-a- 6,63G

var linux -wi-ao 20,00G

media4 media -wi-a- 796,36G

home mediavg -wi-ao 54,54G

The first thing to do is to convert EXT3 to EXT2, otherwise resize2fs will not be able to reduce it properly - we remove the transaction log

   tune2fs -O ^has_journal /dev/media/media4
   fsck -n  /dev/media/media4

We reduce EXT2; this operation is time-consuming, requires the file system to be unmounted and there must enough free space

   resize2fs /dev/media/media4 590G

If you can not unmount, it is possible to find a utility that uses this partition like this

   lsof -n|grep media

Having reduced EXT2, you need to perform a long check using

   e2fsck -f /dev/media/media4

Then we reduce LVM

   lvreduce -L-205G  /dev/media/media4

We have to respond with Y to the warning


LV VG Attr LSize Origin Snap% Move Log Copy%

ubuntu linux -wi-a- 6,63G

var linux -wi-ao 20,00G

media4 media -wi-a- 591,36G

home mediavg -wi-ao 54,54G


VG #PV #LV #SN Attr VSize VFree

linux 1 2 0 wz--n- 32,49G 5,86G

media 2 1 0 wz--n- 796,36G 205,00G

mediavg 2 1 0 wz--n- 54,54G 0

We remove it from VG

   vgreduce media /dev/sdb5

and, if necessary, remove the physical partition

   pvmove /dev/sdb5

If EXT2 does not fit into a single PV, these commands will not work and you will have to reduce the EXT2 once again

Now there only remains to extend LVM and convert EXT2 to EXT3

   lvextend -l +100%FREE  /dev/media/media4
   resize2fs /dev/media/media4
   tune2fs -j /dev/media/media4

Last modified on Monday, 18 May 2015 19:28
Data Recovery Expert

Viktor S., Ph.D. (Electrical/Computer Engineering), was hired by DataRecoup, the international data recovery corporation, in 2012. Promoted to Engineering Senior Manager in 2010 and then to his current position, as C.I.O. of DataRecoup, in 2014. Responsible for the management of critical, high-priority RAID data recovery cases and the application of his expert, comprehensive knowledge in database data retrieval. He is also responsible for planning and implementing SEO/SEM and other internet-based marketing strategies. Currently, Viktor S., Ph.D., is focusing on the further development and expansion of DataRecoup’s major internet marketing campaign for their already successful proprietary software application “Data Recovery for Windows” (an application which he developed).


  • Comment Link Amelia Friday, 29 September 2017 00:00 posted by Amelia

    I truly love your site.. Very nice colors & theme. Did you create this web site yourself?

    Please reply back as I'm attempting to create my very own website and would like to learn where you
    got this from or exactly what the theme is called.
    Thank you!

  • Comment Link Maple Thursday, 28 September 2017 17:02 posted by Maple

    This excellent website truly has all the info I wanted
    concerning this subject and didn't know who to ask.

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.