Linux – LVM: resize2fs not resizing

linuxlvmredhatstorage

I'm having a weird issue with resize2fs. I've performed all the commands and they all have been successful, however, my filesystem is the same size as it was before:

[oracle@server~]$ df -h /backup
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg2-lv_backup
                      985G  973G  2.4G 100% /backup

[root@server~]# pvcreate /dev/cciss/c0d4p1 
  Physical volume "/dev/cciss/c0d4p1" successfully created

[root@server~]# lvdisplay /dev/mapper/vg2-lv_backup | awk '/VG Name/{print $3}'
vg2

[root@server~]# vgextend vg2 /dev/cciss/c0d4p1 
  Volume group "vg2" successfully extended

[root@server~]# vgdisplay vg2 | awk '/Free *PE /{print $5}'
200

[root@server~]# lvextend -l +200 /dev/vg2/lv_backup 
  Extending logical volume lv_backup to 1000.78 GB
  Logical volume lv_backup successfully resized

[root@server~]# e2fsck -Cfp /dev/vg2/lv_backup 
e2fsck 1.39 (29-May-2006)
backups: clean, 1488/131072000 files, 258919596/262144000 blocks

[root@server~]# e2fsck -f /dev/mapper/vg2-lv_backup
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
backups: 1488/131072000 files (20.1% non-contiguous), 258919596/262144000 blocks

[root@server~]# resize2fs /dev/mapper/vg2-lv_backup
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/mapper/vg2-lv_backup to 262348800 (4k) blocks.
The filesystem on /dev/mapper/vg2-lv_backup is now 262348800 blocks long.

The problem is that the initial filesystem was 1TB (almost) and the new one is 800GB, so the new logical volume should now be around 1.8TB. From here, you can see that both the drives are part of the same volume groups:

[root@server~]# pvs -v | grep vg2
    Scanning for physical volume names
  /dev/cciss/c0d0p1 vg2  lvm2 a-   1000.00G     0  1000.00G 4cjtXN-uQ60-5ZvU-dih7-m0Lw-5IQy-RYxmOb
  /dev/cciss/c0d4p1 vg2  lvm2 a-    800.00M     0   800.84M X2f4CR-QI7M-XO5g-TQVh-e3sa-ebu8-MxaqXY

However, it is not reflected:

[root@server~]# lvs -v | grep vg2
    Finding all logical volumes
  lv_backup             vg2     2 -wi-a- 1000.78G  -1  -1 253  73                                         IDEeg7-USRJ-OZLd-fC5t-kCxi-leHq-zfwoNF

Any suggestions?

Best Answer

The lvextend command you executed would only extend the filesystem by 800MB (assuming default extent size), a rounding error when you're looking at TB filesystems. The -l flag means "extents" which, by default, are 4MB in size. If you wish to grow the filesystem by, say, 200GB, the command would be: lvextend -L +200G vg2/lv_backup. (Note the difference between -l and -L.)

The problem is that the initial filesystem was 1TB (almost) and the new one is 800GB, so the new logical volume should now be around 1.8TB. From here, you can see that both the drives are part of the same volume groups:

The initial filesystem was 1TB. The new disk is 800GB. You added that disk to the VG, then used 800MB of that disk to extend the LV, then grow the filesystem on the LV, leaving you with 1.0008TB in the LV. Then you grew the filesystem to fill the LV.

If you want to end up with a 1.8TB filesystem, do this:

lvextend -L +800G vg2/lv_backup

or:

lvextend -l 100%FREE vg2/lv_backup

Followed by the resize2fs command.