一、环境:CentOS7虚拟机,挂载了一块2G硬盘
二、配置过程:
1、给硬盘分区:
创建三个分区,前两个512M,最后一个默认大小,1G多一些,最后一个默认指定大小,具体操作根据自己环境而定。把分区都改成Linux LVM格式就好了。
Command (m for help): p //查看分区表
Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 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: 0xbe89015f
Device Boot Start End Blocks Id System
Command (m for help): n //创建分区
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p //主分区
Partition number (1-4, default 1): 1
First sector (2048-4194303, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-4194303, default 4194303): +512M //指定大小
Partition 1 of type Linux and of size 512 MiB is set
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2): 2
First sector (1050624-4194303, default 1050624):
Using default value 1050624
Last sector, +sectors or +size{K,M,G} (1050624-4194303, default 4194303): +512M
Partition 2 of type Linux and of size 512 MiB is set
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (3,4, default 3):
First sector (2099200-4194303, default 2099200):
Using default value 2099200
Last sector, +sectors or +size{K,M,G} (2099200-4194303, default 4194303): //默认剩下全部大小
Using default value 4194303
Partition 3 of type Linux and of size 1023 MiB is set
Command (m for help): w //保存退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.