lvm
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| lvm [2012/01/31 15:46] – [Increasing Size] k2patel | lvm [2020/08/10 02:35] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| But it is important you do it in proper steps. | But it is important you do it in proper steps. | ||
| + | ==== Steps to create LVM from drive ==== | ||
| + | <code bash> | ||
| + | pvcreate /dev/xvdf1 | ||
| + | pvdisplay /dev/xvdf1 | ||
| + | vgcreate -s 16M vg0 /dev/xvdf1 | ||
| + | vgdisplay /dev/xvdf | ||
| + | vgdisplay vg0 | ||
| + | lvcreate -n lv-vol001 vg0 | ||
| + | lvcreate --help | ||
| + | lvcreate -A n -L 24.5G -n lv-vol001 vg0 | ||
| + | mkfs.ext3 / | ||
| + | </ | ||
| + | ==== Add drive to LVM ==== | ||
| + | <code bash> | ||
| + | # Rescan the machine if not found. | ||
| + | echo "- - -" > / | ||
| + | # Cont. | ||
| + | fdisk /dev/xvdk ## Comment " | ||
| + | mkfs.ext3 / | ||
| + | pvcreate / | ||
| + | vgextend vg0 /dev/xvdk1 | ||
| + | lvextend -L 300G / | ||
| + | OR | ||
| + | lvextend -L+99.91G / | ||
| + | OR | ||
| + | lvextend -l +100%FREE / | ||
| + | resize2fs / | ||
| + | </ | ||
| ==== Reducing Size ==== | ==== Reducing Size ==== | ||
| Line 21: | Line 49: | ||
| e2fsck -y / | e2fsck -y / | ||
| lvextend -L+512M / | lvextend -L+512M / | ||
| + | OR | ||
| + | lvextend -l +100%FREE / | ||
| resize2fs / | resize2fs / | ||
| mount /opt | mount /opt | ||
| Line 28: | Line 58: | ||
| <code bash | history> | <code bash | history> | ||
| + | #rescan the device | ||
| + | echo "- - -" > / | ||
| + | #list devices and confirm you are going to update which drive. | ||
| + | fdisk -l | ||
| + | ### Delete and recreate the partition 'make sure start block is the same' | ||
| + | fdisk /dev/sda ## Comment " | ||
| + | ### Reprobe partition table. | ||
| + | partprobe -s | ||
| + | mkfs.ext3 /dev/sda1 | ||
| + | vgextend VolGroup00 /dev/sda1 | ||
| lvdisplay | lvdisplay | ||
| vgdisplay | vgdisplay | ||
lvm.1328024779.txt.gz · Last modified: 2020/08/10 02:30 (external edit)