创建卷组、卷
root@ubuntu:~# pvcreate /dev/vdb Physical volume "/dev/vdb" successfully created root@ubuntu:~# vgcreate u01 /dev/vdb Volume group "u01" successfully created root@ubuntu:~# lvcreate -l 100%VG -n lv1 u01 Logical volume "lv1" created.
格式化分区
root@ubuntu:~# mkfs.xfs /dev/mapper/u01-lv1 meta-data=/dev/mapper/u01-lv1 isize=512 agcount=4, agsize=32767744 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=0 data = bsize=4096 blocks=131070976, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=63999, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0
挂载分区
root@ubuntu:~# mkdir /u01 root@ubuntu:~# vi /etc/fstab ... /dev/mapper/u01-lv1 /u01 xfs defaults 0 0 root@ubuntu:~# mount -a
也可以使用UUID挂载
root@ubuntu:~# lsblk -f NAME FSTYPE LABEL UUID MOUNTPOINT fd0 sr0 vda ├─vda1 ext2 3a84e925-0dc3-4aea-befa-4b5e8f93676d /boot ├─vda2 └─vda5 LVM2_member 3OdKAM-Ay3e-2j0J-7Hdw-dLuO-i675-0vuSUr ├─ubuntu--vg-root ext4 64b061d2-9a50-4634-95b5-b65ae9468b73 / └─ubuntu--vg-swap_1 swap b8e459d8-a10c-4902-9bf4-6142ce1e52de [SWAP] vdb LVM2_member m6TSCF-5GjB-1C99-7Re2-QCI4-pWVy-OmHUtm └─u01-lv1 xfs f5f302f7-3bc1-484a-9acf-54bee20abbb8 root@ubuntu:~# vi /etc/fstab ... UUID=f5f302f7-3bc1-484a-9acf-54bee20abbb8 /u01 xfs defaults 0 0