Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I accidentally extended the volume to utilized 100% free disk space on LVM group volume. I need it to utilized only /dev/sdb disk but it took free space from both disk, since they were on the same group. Is there a way to reverse this.

[root@server]# pvscan
  PV /dev/sda3   VG myvg   lvm2 [13.84 GB / 13.84 GB free]
  PV /dev/sdb3   VG myvg   lvm2 [22.06 GB / 8.22 GB free]
  Total: 2 [35.91 GB] / in use: 2 [35.91 GB] / in no VG: 0 [0   ]

[root@server]# lvextend -l +100%FREE /dev/myvg/rootvol
  Extending logical volume rootvol to 35.91 GB
  Logical volume rootvol successfully resized

[root@server]# pvscan
  PV /dev/sda3   VG myvg   lvm2 [13.84 GB / 0    free]
  PV /dev/sdb3   VG myvg   lvm2 [22.06 GB / 0    free]
  Total: 2 [35.91 GB] / in use: 2 [35.91 GB] / in no VG: 0 [0   ]

I actually need to remove /dev/sda3.

This is on RHEL 5.9 system.

Please note that I do not want to loss the data


If I use temporary disk then I will need about the same size of the disk, if I pvmove only one volume then how can I make sure there there is nothing in other disk and the data will not get corrupted.


I added a new larger disk and pvmove /dev/sda3 and /dev/sdb3 to /dev/sdc3 (new disk). I am not sure why df still showing newly added free space on root volume.

 [root@server]# pvscan
   PV /dev/sdc3   VG myvg            lvm2 [47.06 GB / 11.16 GB free]
   PV /dev/sda3                      lvm2 [13.85 GB]
   PV /dev/sdb3                      lvm2 [22.07 GB]
   Total: 3 [82.98 GB] / in use: 1 [47.06 GB] / in no VG: 2 [35.92 GB]

 [root@server]# lvscan
   ACTIVE            '/dev/myvg/rootvol' [35.91 GB] inherit

 [root@server]# df -kh .
 Filesystem            Size  Used Avail Use% Mounted on
                        14G   12G  1.3G  91% /
share|improve this question
You can shrink the volume with lvreduce, then use pvmove to move all extents associated with that volume off or towards any physical volume you specify. Also, be aware that you'll have unmount the logical volume before you do the reduce. BTRFS can handle online shrinking but not ext3/ext4. – Bratchley Jul 15 '13 at 21:10
OK, I'm seeing now where you did this to the root volume. There are two ways to approach this: If you absolutely need the space on this HDD back and can't do downtime, you might add some temporary space to the VG and do the online pvmove off that drive. The other option is to boot into rescue mode without searching for or mounting RHEL installations, and shrink the root LV from there. – Bratchley Jul 15 '13 at 22:01
Also, what do you mean by "I do need to secure the data"? – Bratchley Jul 15 '13 at 22:02
up vote 1 down vote accepted

First, make backups and test that they work. While this shouldn't erase any data, you could lose everything to a typo.

Since you've only extended the logical volume and not the filesystem, all you need to do is shrink the logical volume. You still need to deactivate it for that. This means you need to reboot into a rescue system. SystemRescueCD is good for this kind of stuff.

Find out the size of the filesystem on /dev/myvg/rootvol. If it's an ext4 filesystem, tune2fs -l /dev/myvg/rootvol will tell you. Note that it's critical to get it right: if you shrink the logical volume below the size of the filesystem, you'll lose your data.

lvchange -an /dev/myvg/rootvol
lvreduce -L NNNNNNNk /dev/myvg/rootvol

(where NNNNNNN is the size of the filesystem in kB)

Now run pvmove to free up the data on /dev/sda3. After this you can remove the physical volume.

pvmove /dev/sda3
vgreduce myvg /dev/sda3
pvremove /dev/sda3
share|improve this answer
thanks for your response. I added a new larger disk and run pvmove new disk but it is not reflecting changes on df. Do I need to run resize2fs /dev/myvg/rootvol. Is it safe to run? I have updated the question as well. – Raza Jul 16 '13 at 15:05
@Salton Did you resize the filesystem or not after enlarging the volume? If you did, you need to shrink the filesystem before shrinking the LV. The filesystem is 14GB, so it looks like it has the old size, not the new size. What surprises you in the output of df? – Gilles Jul 16 '13 at 15:45
my bad.. please ignore my previous comment – Raza Jul 16 '13 at 17:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.