centos7.5 創建邏輯卷

查看分區信息:

[root@master ~]# fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 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 label type: dos
Disk identifier: 0x00003b2a

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 63342591 31465472 8e Linux LVM

創建分區/dev/sda2/ 並將分區類型設置爲 8e Linux LVM
[root@master ~]# fdisk /dev/sda
Command (m for help): t
Partition number (1-3, default 3): 3
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): p

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 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 label type: dos
Disk identifier: 0x00003b2a

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 63342591 31465472 8e Linux LVM
/dev/sda3 63342592 168200191 52428800 8e Linux LVM

讓內核重啓讀取分區信息

[root@master ~]# partprobe /dev/sda

查看物理卷
[root@master ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- 30.00g 4.00m
創建物理卷
[root@master ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created.
檢查結果
[root@master ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- 30.00g 4.00m
/dev/sda3 lvm2 --- 50.00g 50.00g

創建卷組
[root@master ~]# vgcreate test /dev/sda3
Volume group "test" successfully created
[root@master ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- 30.00g 4.00m
/dev/sda3 test lvm2 a-- <50.00g <50.00g

創建邏輯卷
[root@master ~]# lvcreate -L 10G -n u01 test
Logical volume "u01" created.

查看結果
[root@master ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- 20.00g
swap centos -wi-ao---- 10.00g
u01 test -wi-a----- 10.00g

格式化 /dev/test/u01
root@master ~]# mkfs.ext4 /dev/test/u01
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621440 blocks
131072 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2151677952
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

創建文件/u01
[root@master ~]# mkfs /u01

掛載分區
[root@master ~]# mount /dev/test/u01 /u01
[root@master ~]# ls /u01
lost+found

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章