Archive for the tag 'Resizing'

SBDavid

Resizing & Removing Physical Volumes

Resizing & Removing Physical Volumes

If you need to change the size of an underlying block device for any reason, use the pvresizecommand to update LVM with the new size. You can execute this command while LVM is using the physical volume.

If a device is no longer required for use by LVM, you can remove the LVM label with the pvremovecommand. Executing the pvremove command zeroes the LVM metadata on an empty physical volume. If the physical volume you want to remove is currently part of a volume group, you must remove it from the volume group with the vgreduce command.

# pvremove /dev/sdd5
SBDavid

Resizing Ext3

Resizing Ext3

An ext3 filesystem can supposedly be expanded with resize2fs while mounted, but standalone would be safer.

A few ways you can do it:

resize2fs
parted
Partition Magic 7.x

In all cases, first convert ext3 –> ext2: [Note: resize2fs works with ext3.]

tune2fs -O ^has_journal /dev/hdax
e2fsck -v -f /dev/hdax

Resize the partitions with tool of choice.

Convert back to ext3

tune2fs -j /dev/hdax
e2fsck -v -f /dev/hdax

-j Add an ext3 journal to the filesystem.

SBDavid

Resizing a Physical Volume

Resizing a Physical Volume

If you need to change the size of an underlying block device for any reason, use the pvresize command to update LVM with the new size. You can execute this command while LVM is using the physical volume.


EXAMPLES

Expand the PV on /dev/sda1 after enlarging the partition with fdisk:

pvresize /dev/sda1

Shrink the PV on /dev/sda1 prior to shrinking the partition with fdisk (ensure that the PV size is appropriate for your intended new partition size):

pvresize –setphysicalvolumesize 40G /dev/sda1

RESTRICTIONS

pvresize will refuse to shrink PhysicalVolume if it has allocated extents after where its new end would be. In the future, it should relocate these elsewhere in the volume group if there is sufficient free space, like pvmove does.

pvresize won’t currently work correctly on LVM1 volumes or PVs with extra metadata areas