1. VM虚拟机添加磁盘,识别磁盘将其添加到分区
注意:reboot之后系统才能识别新加硬盘。
2. fdisk命令:fdisk -l 查看系统的分区详细信息
[root@localhost ~]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 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: 0x000c2da4
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 976895 487424 83 Linux
/dev/sda2 976896 41943039 20483072 8e Linux LVM
Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 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
注意:上图中/dev/sda1 后面有个*,表示该磁盘用于引导系统进行启动。
blocks:表示块的信息,一个块里面有多个扇区。
Id:表示磁盘编号。
system:表示Linux系统分区的一个分区信息。
3. fdisk 对磁盘进行分区:
[root@localhost ~]# fdisk /dev/sdb
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 0xbf249344.
Command (m for help): m 输出帮助信息
Command action
a toggle a bootable flag 设置启动分区
b edit bsd disklabel 编辑分区标签
c toggle the dos compatibility flag
d delete a partition 删除一个分区
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types 列出分区类型
m print this menu 输出帮助信息
n add a new partition 建立一个新的分区
o create a new empty DOS par