40G的数据盘分出来了两个盘

磁盘分区

[root@ecs-e4c9 ~]# parted /dev/vdb
GNU Parted 3.1
Using /dev/vdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
Warning: The existing disk label on /dev/vdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) mkpart primary 1 50%
(parted) align-check optimal 1
1 aligned
(parted)

(parted) print
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 21.5GB 21.5GB primary

(parted)
(parted) quit
Information: You may need to update /etc/fstab.

[root@ecs-e4c9 ~]#
[root@ecs-e4c9 ~]# fdisk -l
Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x000af5dd

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 83886079 41942016 83 Linux
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/vdb: 42.9 GB, 42949672960 bytes, 83886080 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: gpt
Disk identifier: C4CB2067-9CB4-401F-8B8F-AC4AFF2C8092

#Start End Size Type Name
1 2048 41943039 20G Microsoft basic primary
[root@ecs-e4c9 ~]#
[root@ecs-e4c9 ~]# parted /dev/vdb
GNU Parted 3.1
Using /dev/vdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mkpart primary 50% 100%
(parted) align-check optimal 1
1 aligned
(parted)

(parted) print
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 21.5GB 21.5GB primary
2 21.5GB 42.9GB 21.5GB primary
(parted)

(parted) quit
Information: You may need to update /etc/fstab.

格式化磁盘


[root@ecs-e4c9 ~]#
[root@ecs-e4c9 ~]# mkfs -t xfs /dev/vdb1
meta-data=/dev/vdb1 isize=512 agcount=4, agsize=1310656 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=5242624, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@ecs-e4c9 ~]#
[root@ecs-e4c9 ~]# mkfs -t xfs /dev/vdb2
meta-data=/dev/vdb2 isize=512 agcount=4, agsize=1310656 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=5242624, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0

挂载磁盘


[root@ecs-e4c9 ~]# mkdir /www1
[root@ecs-e4c9 ~]# mkdir /www2
[root@ecs-e4c9 ~]# mount /dev/vdb1 /www1
[root@ecs-e4c9 ~]# mount /dev/vdb2 /www2
[root@ecs-e4c9 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 486M 0 486M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 6.8M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/vda1 40G 2.4G 35G 7% /
tmpfs 100M 0 100M 0% /run/user/0
/dev/vdb1 20G 33M 20G 1% /www1
/dev/vdb2 20G 33M 20G 1% /www2
[root@ecs-e4c9 ~]#
[root@ecs-e4c9 ~]#
[root@ecs-e4c9 ~]# echo "/dev/vdb1 /www1 xfs defaults 0 0" >> /etc/fstab
[root@ecs-e4c9 ~]#
[root@ecs-e4c9 ~]# echo "/dev/vdb2 /www2 xfs defaults 0 0" >> /etc/fstab