标签:inf check 检查 user partition 查看 alt change connect
fdisk /dev/vdb Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0x06d8c027. Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): Using default response p Partition number (1-4, default 1): First sector (2048-524287999, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-524287999, default 524287999): +140G Partition 1 of type Linux and of size 140 GiB is set Command (m for help): t Selected partition 1 Hex code (type L to list all codes): 8e Changed type of partition ‘Linux‘ to ‘Linux LVM‘ Command (m for help): p Disk /dev/vdb: 268.4 GB, 268435456000 bytes, 524288000 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: 0x06d8c027 Device Boot Start End Blocks Id System /dev/vdb1 2048 293603327 146800640 8e Linux LVM Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): Using default response p Partition number (2-4, default 2): First sector (293603328-524287999, default 293603328): Using default value 293603328 Last sector, +sectors or +size{K,M,G} (293603328-524287999, default 524287999): +100G Partition 2 of type Linux and of size 100 GiB is set Command (m for help): t Partition number (1,2, default 2): 8e Partition number (1,2, default 2): Hex code (type L to list all codes): 8e Changed type of partition ‘Linux‘ to ‘Linux LVM‘ Command (m for help): p Disk /dev/vdb: 268.4 GB, 268435456000 bytes, 524288000 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: 0x06d8c027 Device Boot Start End Blocks Id System /dev/vdb1 2048 293603327 146800640 8e Linux LVM /dev/vdb2 293603328 503318527 104857600 8e Linux LVM Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
yum install -y lvm2
[root@weifeng ~]# ls /dev/vdb1 /dev/vdb1 [root@weifeng ~]# partprobe [root@weifeng~]# ls /dev/vdb1 /dev/vdb1 [root@weifeng ~]# ls /dev/vdb2 /dev/vdb2
[root@weifeng ~]# pvcreate /dev/vdb1 Physical volume "/dev/vdb1" successfully created. [root@weifeng ~]# pvcreate /dev/vdb2 Physical volume "/dev/vdb2" successfully created.
[root@weifeng ~]# pvdisplay "/dev/vdb2" is a new physical volume of "100.00 GiB" --- NEW Physical volume --- PV Name /dev/vdb2 VG Name PV Size 100.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID R1t7xi-rdXN-YyFm-fe60-EEHl-5lzd-IEoscW "/dev/vdb1" is a new physical volume of "140.00 GiB" --- NEW Physical volume --- PV Name /dev/vdb1 VG Name PV Size 140.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID wXq8wP-ccgu-JvOz-yUk9-9SvR-XnuQ-k05zEN
[root@weifeng ~]# pvs PV VG Fmt Attr PSize PFree /dev/vdb1 lvm2 --- 140.00g 140.00g /dev/vdb2 lvm2 --- 100.00g 100.00g
[root@weifeng ~]# vgcreate vg1 /dev/vdb1 /dev/vdb2 Volume group "vg1" successfully created
查看卷组
[root@weifeng ~]# vgdisplay --- Volume group --- VG Name vg1 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 239.99 GiB PE Size 4.00 MiB Total PE 61438 Alloc PE / Size 0 / 0 Free PE / Size 61438 / 239.99 GiB VG UUID A4eITy-lscO-9pAv-hCqF-qA7v-LCTw-gdmkhU [root@weifeng ~]# vgs VG #PV #LV #SN Attr VSize VFree vg1 2 0 0 wz--n- 239.99g 239.99g
[root@weifeng ~]# lvcreate -L 140G -n lv1 vg1 Logical volume "lv1" created. [root@weifeng ~]# mkfs.xfs /dev/vg1/lv1 meta-data=/dev/vg1/lv1 isize=512 agcount=4, agsize=9175040 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=36700160, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=17920, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [root@weifeng ~]# mkdir /var/lib/docker [root@weifeng ~]# mount /dev/vg1/lv1 /var/lib/docker [root@weifeng ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 7.5G 0 7.5G 0% /dev tmpfs 7.6G 0 7.6G 0% /dev/shm tmpfs 7.6G 460K 7.6G 1% /run tmpfs 7.6G 0 7.6G 0% /sys/fs/cgroup /dev/vda1 59G 2.1G 55G 4% / tmpfs 1.6G 0 1.6G 0% /run/user/0 /dev/mapper/vg1-lv1 140G 33M 140G 1% /var/lib/docker [root@weifeng ~]# lvcreate -L 100G -n lv2 vg1 Volume group "vg1" has insufficient free space (25598 extents): 25600 required. [root@weifeng ~]# lvcreate -L 98G -n lv2 vg1 Logical volume "lv2" created. [root@weifeng ~]# mkfs.xfs /dev/vg1/lv2 meta-data=/dev/vg1/lv2 isize=512 agcount=4, agsize=6422528 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=25690112, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=12544, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [root@weifeng ~]# mkdir /workspace [root@weifeng ~]# mount /dev/vg1/lv2 /workspace [root@weifeng ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 7.5G 0 7.5G 0% /dev tmpfs 7.6G 0 7.6G 0% /dev/shm tmpfs 7.6G 464K 7.6G 1% /run tmpfs 7.6G 0 7.6G 0% /sys/fs/cgroup /dev/vda1 59G 2.1G 55G 4% / tmpfs 1.6G 0 1.6G 0% /run/user/0 /dev/mapper/vg1-lv1 140G 33M 140G 1% /var/lib/docker /dev/mapper/vg1-lv2 98G 33M 98G 1% /workspace
修改fstab文件
[root@weifeng ~]# cat /etc/fstab /dev/mapper/vg1-lv1 /var/lib/docker xfs defaults 0 0 /dev/mapper/vg1-lv2 /workspace xfs defaults 0 0
标签:inf check 检查 user partition 查看 alt change connect
原文地址:https://www.cnblogs.com/weifeng1463/p/12189430.html