LVM ext2/ext3

LVM ext2/ext3

PV erstellen
pvcreate -v /dev/sda


VG erstellen
vgcreate -v vg_data /dev/sda
LV erstellen
lvcreate -v  -L 465G  -n lv_data  vg_data
mkfs.ext3 /dev/vg_data/lv_data


LV vergrößern
The resize2fs program will resize ext2 or ext3 file systems. It can be used to enlarge or shrink an unmounted file system located on device. If the filesystem is mounted, it can be used to expand the size of the mounted filesystem, assuming the kernel supports on-line resizing. (As of this writing, the Linux 2.6 kernel supports on-line resize for filesystems mounted using ext3 only.).

#optionaler Schritt (ab Kernel 2.6 auch online-Vergrößerung möglich)
#umount [mountpoint]
lvresize -v -L +10G /dev/mapper/vgroot-lvhome
#e2fsck -f /dev/mapper/vgroot-lvhome
resize2fs /dev/mapper/vgroot-lvhome

LV verkleinern
ACHTUNG:lvresize allows you to resize a logical volume. Be careful when reducing a logical volume's size, because data in the reduced part is lost!!! You should therefore ensure that any filesystem on the volume is shrunk first so that the extents that are to be removed are not in use.
lvreduce allows you to reduce the size of a logical volume. Be careful when reducing a logical volume's size, because data in the reduced part is lost!!! You should therefore ensure that any filesystem on the volume is resized before running lvreduce so that the extents that are to be removed are not in use.

umount [mountpoint]
e2fsck -f /dev/mapper/vgroot-lvhome
#neueGröße, am besten etwas kleiner
resize2fs /dev/mapper/vgroot-lvhome 990M
lvchange -an /dev/mapper/vgroot-lvhome
lvresize -v -L1G /dev/mapper/vgroot-lvhome
lvchange -ay /dev/mapper/vgroot-lvhome
e2fsck -f /dev/mapper/vgroot-lvhome
resize2fs /dev/mapper/vgroot-lvhome