1、磁盘lvm管理,完成下面要求,并写出详细过程:
1) 创建一个至少有两个PV组成的大小为20G的名为testvg的VG;要求PE大小 为16MB, 而后在卷组中创建大小为5G的逻辑卷testlv;挂载至/users目录
我采取的是1个10G的分区和1个10G的硬盘组成20G
1.用lsblk查看目前硬盘的情况
[root@centos6 ~]#lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 48.8G 0 part /
├─sda3 8:3 0 29.3G 0 part /data
├─sda4 8:4 0 1K 0 part
└─sda5 8:5 0 2G 0 part [SWAP]
sdc 8:32 0 20G 0 disk
sdd 8:48 0 20G 0 disk
sde 8:64 0 10G 0 disk
sdb 8:16 0 20G 0 disk
sr0 11:0 1 3.7G 0 rom /media/CentOS_6.10_Final
2.sdc分出10G,system为Linux LVM
[root@centos6 ~]#fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x66e4184d.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): +10G
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x66e4184d
Device Boot Start End Blocks Id System
/dev/sdc1 1 1306 10490413+ 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@centos6 ~]#lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 48.8G 0 part /
├─sda3 8:3 0 29.3G 0 part /data
├─sda4 8:4 0 1K 0 part
└─sda5 8:5 0 2G 0 part [SWAP]
sdc 8:32 0 20G 0 disk
└─sdc1 8:33 0 10G 0 part
sdd 8:48 0 20G 0 disk
sde 8:64 0 10G 0 disk
sdb 8:16 0 20G 0 disk
sr0 11:0 1 3.7G 0 rom /media/CentOS_6.10_Final
3.将sdc1与sde创建成PV
[root@centos6 ~]#pvcreate /dev/sd{c1,e}
Physical volume "/dev/sdc1" successfully created
Physical volume "/dev/sde" successfully created
[root@centos6 ~]#pvs
PV VG Fmt Attr PSize PFree
/dev/sdc1 lvm2 ---- 10.00g 10.00g
/dev/sde lvm2 ---- 10.00g 10.00g
[root@centos6 ~]#pvdisplay
"/dev/sdc1" is a new physical volume of "10.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdc1
VG Name
PV Size 10.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID rkC2uz-MLNF-BAl3-LyGF-XfRe-kjCn-UHHofX
"/dev/sde" is a new physical volume of "10.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sde
VG Name
PV Size 10.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID LHTZjo-q2ux-xnlc-OCNz-LL32-GhXc-Ybqg3r
4.创建20G名为testvg的VG,PE大小为16MB
[root@centos6 ~]#vgcreate -s 16M testvg /dev/sd{c1,e}
Volume group "testvg" successfully created
[root@centos6 ~]#vgs
VG #PV #LV #SN Attr VSize VFree
testvg 2 0 0 wz--n- 19.98g 19.98g
[root@centos6 ~]#vgdisplay
--- Volume group ---
VG Name testvg
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 19.98 GiB
PE Size 16.00 MiB
Total PE 1279
Alloc PE / Size 0 / 0
Free PE / Size 1279 / 19.98 GiB
VG UUID 0Z7wBB-THgP-tI7J-BvLW-OR8O-fq