LVM Stuff
Create LVM
pvcreate /dev/vdb1
vgcreate ftp /dev/vdb1
root@testjasper5:~# vgdisplay
--- Volume group ---
VG Name ftp
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 996.00 MiB
PE Size 4.00 MiB
Total PE 249
Alloc PE / Size 0 / 0
Free PE / Size 249 / 996.00 MiB
VG UUID rI8qb9-gsM2-7Zeu-hcXt-Emv4-MSDm-0XRwTE
root@testjasper5:~# lvcreate -n ftplv -l 249 ftp
Logical volume "ftplv" created
root@testjasper5:~# lvdisplay
--- Logical volume ---
LV Name /dev/ftp/ftplv
VG Name ftp
LV UUID DiZKFB-lCYU-uEVm-znTj-Fz8C-yY8T-agVgkY
LV Write Access read/write
LV Status available
# open 0
LV Size 996.00 MiB
Current LE 249
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
root@testjasper5:~# pvdisplay
--- Physical volume ---
PV Name /dev/vdb1
VG Name ftp
PV Size 999.00 MiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 249
Free PE 0
Allocated PE 249
PV UUID MF2duj-Br2t-yX3n-RszE-2LlR-0tKD-J10ynJ
root@testjasper5:~# vgdisplay
--- Volume group ---
VG Name ftp
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 996.00 MiB
PE Size 4.00 MiB
Total PE 249
Alloc PE / Size 249 / 996.00 MiB
Free PE / Size 0 / 0
VG UUID rI8qb9-gsM2-7Zeu-hcXt-Emv4-MSDm-0XRwTE
root@testjasper5:~# mkfs -t ext4 /dev/mapper/ftp-ftplv
mke2fs 1.42 (29-Nov-2011)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
63744 inodes, 254976 blocks
12748 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=264241152
8 block groups
32768 blocks per group, 32768 fragments per group
7968 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
root@testjasper5:~# blkid
/dev/vda1: UUID="5de1a13f-dd6c-46fc-9755-2fbaf04c3705" TYPE="ext4"
/dev/vda5: UUID="65e7f8b7-e20c-4311-b2e3-2d55d79aaca7" TYPE="swap"
/dev/vdb1: UUID="MF2duj-Br2t-yX3n-RszE-2LlR-0tKD-J10ynJ" TYPE="LVM2_member"
/dev/mapper/ftp-ftplv: UUID="c4669795-b4fb-4cec-873d-ed9e587c6bd2" TYPE="ext4"
vi /etc/fstab (Append)
#SFTP home - LVM /dev/mapper/ftp-ftplv
UUID=c4669795-b4fb-4cec-873d-ed9e587c6bd2 /sftphome ext4 defaults 1 2
mount -a
root@testjasper5:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 9.6G 2.4G 6.8G 26% /
udev 494M 12K 494M 1% /dev
tmpfs 200M 244K 199M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 498M 0 498M 0% /run/shm
/dev/mapper/ftp-ftplv 993M 30M 914M 4% /sftphome
Extend LVM
To add additional partition
root@testjasper5:/sftphome# vgextend ftp /dev/vdc1
No physical volume label read from /dev/vdc1
Physical volume "/dev/vdc1" successfully created
Volume group "ftp" successfully extended
root@testjasper5:/sftphome# vgdisplay
--- Volume group ---
VG Name ftp
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 1.95 GiB
PE Size 4.00 MiB
Total PE 498
Alloc PE / Size 249 / 996.00 MiB
Free PE / Size 249 / 996.00 MiB
VG UUID rI8qb9-gsM2-7Zeu-hcXt-Emv4-MSDm-0XRwTE
root@testjasper5:/sftphome# lvextend -L+990M /dev/mapper/ftp-ftplv
Rounding up size to full physical extent 992.00 MiB
Extending logical volume ftplv to 1.94 GiB
Logical volume ftplv successfully resized
root@testjasper5:/sftphome# vgdisplay
--- Volume group ---
VG Name ftp
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 1.95 GiB
PE Size 4.00 MiB
Total PE 498
Alloc PE / Size 497 / 1.94 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID rI8qb9-gsM2-7Zeu-hcXt-Emv4-MSDm-0XRwTE
root@testjasper5:/sftphome# vgdisplay
--- Volume group ---
VG Name ftp
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 1.95 GiB
PE Size 4.00 MiB
Total PE 498
Alloc PE / Size 497 / 1.94 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID rI8qb9-gsM2-7Zeu-hcXt-Emv4-MSDm-0XRwTE
root@testjasper5:/sftphome# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 9.6G 2.4G 6.8G 26% /
udev 494M 12K 494M 1% /dev
tmpfs 200M 244K 199M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 498M 0 498M 0% /run/shm
/dev/mapper/ftp-ftplv 993M 30M 914M 4% /sftphome
Resize partition
root@testjasper5:/sftphome# resize2fs /dev/mapper/ftp-ftplv
resize2fs 1.42 (29-Nov-2011)
Filesystem at /dev/mapper/ftp-ftplv is mounted on /sftphome; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/mapper/ftp-ftplv to 508928 (4k) blocks.
The filesystem on /dev/mapper/ftp-ftplv is now 508928 blocks long.
root@testjasper5:/sftphome# resize2fs /dev/mapper/ftp-ftplv
resize2fs 1.42 (29-Nov-2011)
Filesystem at /dev/mapper/ftp-ftplv is mounted on /sftphome; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/mapper/ftp-ftplv to 508928 (4k) blocks.
The filesystem on /dev/mapper/ftp-ftplv is now 508928 blocks long.