Pages

How to resize Logical Volume and filesystem together?

To achieve this you can use the lvresize command with the -r option use -n option to avoid fsck on a mounted filesystem

-----------------------------------------------------------------
# lvresize -L+100m -r /dev/vg_test/testvol
  Rounding up size to full physical extent 128.00 MB
  fsck from util-linux-ng 2.16
  e2fsck 1.41.9 (22-Aug-2009)
  /dev/mapper/vg_test-testvol is mounted.

WARNING!!!  Running e2fsck on a mounted filesystem may cause
SEVERE filesystem damage.

Do you really want to continue (y/n)? yes

/dev/mapper/vg_test-testvol: recovering journal
/dev/mapper/vg_test-testvol: clean, 11/49152 files, 11862/196608 blocks
Extending logical volume testvol to 320.00 MB
Logical volume testvol successfully resized
resize2fs 1.41.9 (22-Aug-2009)
Filesystem at /dev/mapper/vg_test-testvol is mounted on /mnt; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/mapper/vg_test-testvol to 327680 (1k) blocks.
The filesystem on /dev/mapper/vg_test-testvol is now 327680 blocks long.
-----------------------------------------------------------------

To avoid fsck use the option -n 

-----------------------------------------------------------------
# lvresize -L+100m -r -n /dev/vg_testvg/testvol
  Rounding up size to full physical extent 128.00 MB
  Extending logical volume testvol to 448.00 MB
  Logical volume testvol successfully resized
resize2fs 1.41.9 (22-Aug-2009)
Filesystem at /dev/mapper/vg_testvg-testvol is mounted on /mnt; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 2
Performing an on-line resize of /dev/mapper/vg_testvg-testvol to 458752 (1k) blocks.
The filesystem on /dev/mapper/vg_testvg-testvol is now 458752 blocks long.

-----------------------------------------------------------------

No comments:

Post a Comment