How to manage multiple disks based on LVM in Linux Mint
Overview
mint@mint:~$ sudo fdisk -l
Disk /dev/loop0: 1.8 GiB, 1925435392 bytes, 3760616 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: ECF2CEB1-35F2-4807-A715-2881F9AC8A5B
Device Start End Sectors Size Type
/dev/sda1 2048 1953525134 1953523087 931.5G Linux LVM
Disk /dev/sdb: 111.8 GiB, 120040980480 bytes, 234455040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 04DB6203-05B4-419D-B369-FDC9DBA2FCD5
Device Start End Sectors Size Type
/dev/sdb1 2048 1050623 1048576 512M EFI System
/dev/sdb2 1050624 234455006 233404383 111.3G Linux LVM
Disk /dev/sdc: 14.4 GiB, 15472047104 bytes, 30218842 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x65dbb3bc
Device Boot Start End Sectors Size Id Type
/dev/sdc1 * 0 3924479 3924480 1.9G 0 Empty
/dev/sdc2 652 5323 4672 2.3M ef EFI (FAT-12/16/32)
mint@mint:~$ sudo vgcreate mint-vg /dev/sdb2 /dev/sda1
Physical volume "/dev/sdb2" successfully created.
Physical volume "/dev/sda1" successfully created.
Volume group "mint-vg" successfully created
mint@mint:~$ sudo vgdisplay
--- Volume group ---
VG Name mint-vg
System ID
Format lvm2
Metadata Areas 2
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 2
Act PV 2
VG Size <1.02 TiB
PE Size 4.00 MiB
Total PE 266957
Alloc PE / Size 0 / 0
Free PE / Size 266957 / <1.02 TiB
VG UUID 358qmj-87nt-UC7i-238s-eIDk-Blio-GE17qq
mint@mint:~$
mint@mint:~$ sudo pvdisplay
--- Physical volume ---
PV Name /dev/sdb2
VG Name mint-vg
PV Size <111.30 GiB / not usable 2.98 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 28491
Free PE 28491
Allocated PE 0
PV UUID l0j3wH-PFFo-N4F6-3gP3-wi11-nWyy-ejxQta
--- Physical volume ---
PV Name /dev/sda1
VG Name mint-vg
PV Size 931.51 GiB / not usable 4.69 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 238466
Free PE 238466
Allocated PE 0
PV UUID Goasyz-V4dF-enoY-QemI-yi8O-FR7Y-FL718j
mint@mint:~$
mint@mint:~$ sudo lvcreate -L 8G -n mint-vg-swap mint-vg
Logical volume "mint-vg-swap" created.
mint@mint:~$ sudo lvcreate -L 1034G -n mint-vg-root mint-vg
Logical volume "mint-vg-root" created.
mint@mint:~$ sudo lvdisplay
--- Logical volume ---
LV Path /dev/mint-vg/mint-vg-swap
LV Name mint-vg-swap
VG Name mint-vg
LV UUID RDvRp7-K8ZT-5C33-rHTG-i7ce-rlLc-PSczw2
LV Write Access read/write
LV Creation host, time mint, 2019-11-07 20:46:51 +0800
LV Status available
LV Size 8.00 GiB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/mint-vg/mint-vg-root
LV Name mint-vg-root
VG Name mint-vg
LV UUID QzI3Vt-IA4c-PZgM-oGgk-GDTN-Fcp8-43Tbi7
LV Write Access read/write
LV Creation host, time mint, 2019-11-07 20:47:47 +0800
LV Status available
LV Size <1.01 TiB
Current LE 264704
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
mint@mint:~$ sudo mkfs.ext4 /dev/mint-vg/mint-vg-root
mke2fs 1.44.1 (24-Mar-2018)
Creating filesystem with 271056896 4k blocks and 67764224 inodes
Filesystem UUID: 6c306aab-3d71-4f9b-81e5-4b4738d1f69e
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
mint@mint:~$ sudo fdisk -l
Disk /dev/loop0: 1.8 GiB, 1925435392 bytes, 3760616 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: ECF2CEB1-35F2-4807-A715-2881F9AC8A5B
Device Start End Sectors Size Type
/dev/sda1 2048 1953525134 1953523087 931.5G Linux LVM
Disk /dev/sdb: 111.8 GiB, 120040980480 bytes, 234455040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 04DB6203-05B4-419D-B369-FDC9DBA2FCD5
Device Start End Sectors Size Type
/dev/sdb1 2048 1050623 1048576 512M EFI System
/dev/sdb2 1050624 234455006 233404383 111.3G Linux LVM
Disk /dev/sdc: 14.4 GiB, 15472047104 bytes, 30218842 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x65dbb3bc
Device Boot Start End Sectors Size Id Type
/dev/sdc1 * 0 3924479 3924480 1.9G 0 Empty
/dev/sdc2 652 5323 4672 2.3M ef EFI (FAT-12/16/32)
Disk /dev/mapper/mint--vg-mint--vg--swap: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/mint--vg-mint--vg--root: 1 TiB, 1110249046016 bytes, 2168455168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
mint@mint:~$
GUI
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/847dcf0a6d679405db53c0ee5301a493.png)
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/b63f970b088e87f7dfcd2db1c73e6c82.png)
lwk@qwfys:~$ sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
└─sda1 8:1 0 931.5G 0 part
└─mint--vg-mint--vg--root 253:0 0 1T 0 lvm /
sdb 8:16 0 111.8G 0 disk
├─sdb1 8:17 0 512M 0 part /boot/efi
└─sdb2 8:18 0 111.3G 0 part
├─mint--vg-mint--vg--root 253:0 0 1T 0 lvm /
└─mint--vg-mint--vg--swap 253:1 0 8G 0 lvm [SWAP]
lwk@qwfys:~$
lwk@qwfys:~$ sudo lsblk -l
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
sda1 8:1 0 931.5G 0 part
sdb 8:16 0 111.8G 0 disk
sdb1 8:17 0 512M 0 part /boot/efi
sdb2 8:18 0 111.3G 0 part
mint--vg-mint--vg--root 253:0 0 1T 0 lvm /
mint--vg-mint--vg--root 253:0 0 1T 0 lvm /
mint--vg-mint--vg--swap 253:1 0 8G 0 lvm [SWAP]
lwk@qwfys:~$ sudo lvdisplay
--- Logical volume ---
LV Path /dev/mint-vg/mint-vg-swap
LV Name mint-vg-swap
VG Name mint-vg
LV UUID RDvRp7-K8ZT-5C33-rHTG-i7ce-rlLc-PSczw2
LV Write Access read/write
LV Creation host, time mint, 2019-11-07 20:46:51 +0800
LV Status available
# open 2
LV Size 8.00 GiB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/mint-vg/mint-vg-root
LV Name mint-vg-root
VG Name mint-vg
LV UUID QzI3Vt-IA4c-PZgM-oGgk-GDTN-Fcp8-43Tbi7
LV Write Access read/write
LV Creation host, time mint, 2019-11-07 20:47:47 +0800
LV Status available
# open 1
LV Size <1.01 TiB
Current LE 264704
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
lwk@qwfys:~$ sudo pvdisplay
--- Physical volume ---
PV Name /dev/sdb2
VG Name mint-vg
PV Size <111.30 GiB / not usable 2.98 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 28491
Free PE 205
Allocated PE 28286
PV UUID l0j3wH-PFFo-N4F6-3gP3-wi11-nWyy-ejxQta
--- Physical volume ---
PV Name /dev/sda1
VG Name mint-vg
PV Size 931.51 GiB / not usable 4.69 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 238466
Free PE 0
Allocated PE 238466
PV UUID Goasyz-V4dF-enoY-QemI-yi8O-FR7Y-FL718j
lwk@qwfys:~$ sudo vgdisplay
--- Volume group ---
VG Name mint-vg
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 11
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size <1.02 TiB
PE Size 4.00 MiB
Total PE 266957
Alloc PE / Size 266752 / <1.02 TiB
Free PE / Size 205 / 820.00 MiB
VG UUID 358qmj-87nt-UC7i-238s-eIDk-Blio-GE17qq
lwk@qwfys:~$