0

I have a filesystem /opt2 with 3.8G available and I want to transfer 1GB to /var(both in the rootvg volume group), but when I resize the /opt2 to free the gigabyte I want to transfer it doesn't reflects on the volume group Free space

 VG     #PV #LV #SN Attr   VSize  VFree
  rootvg   2   7   0 wz--n- 64.49g    0 

first I umounted and then I resized it, but I don't know what am I doing wrong

  • How did you resize it? Could you please paste the commands you used? – derobert Jun 4 '17 at 3:39
0

I'm pretty sure there are only two possible reasons for this:

I'm guessing (since you haven't posted the commands you used) it's this first one: resize2fs (or similar for other filesystems) only resizes the filesystem, not the logical volume. You have to use lvreduce or lvresize for that.

It used to be that you had to carefully specify a size to resize2fs and the same (or greater) size to lvreduce/lvresize (and mistakes lead to data loss) but nowadays LVM takes care of that for you:

lvreduce -r -L -1G rootvg/«opt2»

That -r is critical, it instructs lvreduce to first resize the filesystem (which generally needs to be unmounted and should be backed up just in case). -L specifies the new size, and when given a leading - it specifies how much smaller. «opt2» is a placeholder for that LV's name. Please check your system's lvreduce man page to confirm your lvreduce indeed has that -r option.

The other possibility is that you're using a very large physical extent size. The default is 4MiB (except with the long obsolete lvm1 format), so unless you upped the default by nearly three orders of magnitude, it's not that. You can check by running vgs -o vg_name,vg_extent_size. Thankfully, you can change the size using vgchange -s. Decreasing it is easy; increasing it can be a pain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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