User Tools

Site Tools


lvm

LVM extend

Scan SCSI bus

echo "- - -" > /sys/class/scsi_host/host0/scan
echo 1 > /sys/block/sdX/device/rescan
partx -a
 fdisk -l
 echo "- - -" > /sys/class/scsi_host/host0/scan
 fdisk -l
 fdisk /dev/sde (New, Primary 1, 8e)
 pvcreate /dev/sde1
 vgdisplay
 vgextend VolGroup01 /dev/sde1
 vgdisplay 
 
 lvdisplay
 lvextend -l +100%FREE /dev/mapper/VolGroup01-data
 df -h
 lvdisplay 

screen

 resize2fs /dev/mapper/VolGroup01-data
 df -h

Shrink ext4

# Unmount the filesystem and check its' LV
umount /mnt/foo
e2fsck -f /dev/mapper/vg0-foo
 
# Shrink ext4 and then the LV to the desired size
resize2fs -p /dev/mapper/vg0-foo 40G
lvreduce -L 40G /dev/mapper/vg0-foo
 
# Before continuing, run e2fsck. If it bails because the partition
# is too small, don't panic! The LV can still be extended with
# lvextend until e2fsck succeeds, e.g.:
# lvextend -L +1G /dev/mapper/vg0-foo
e2fsck -f /dev/mapper/vg0-foo
 
# Resize the filesystem to match the LVs size, check and mount it
resize2fs -p /dev/mapper/vg0-foo
e2fsck -f /dev/mapper/vg0-foo
mount /mnt/foo
lvm.txt · Last modified: 2013/11/13 16:29 (external edit)