1.首先查看硬盘情况,发现一块新的硬盘/dev/xvdb
[root@local103-23 ~]# fdisk -l
Disk /dev/xvda: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvda1 * 1 25 200781 83 Linux
/dev/xvda2 26 547 4192965 82 Linux swap / Solaris
/dev/xvda3 548 1958 11333857+ 83 Linux
Disk /dev/xvdb: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
2.创建分区(以下红色为输入的命令)
[root@local103-23 ~]# fdisk /dev/xvdb1
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 5220.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n #创建新分区
Command action
e extended
p primary partition (1-4)
p #创建主分区
Partition number (1-4): 1 #新建的主分区序号
First cylinder (1-5220, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-5220, default 5220): #创建主分区大小,因为我们这里只分一个分区,所以直接回车
Using default value 5220
Command (m for help): w #保存创建的主分区
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
3.查看新的分区情况
[root@local103-23 ~]# fdisk -l
Disk /dev/xvda: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvda1 * 1 25 200781 83 Linux
/dev/xvda2 26 547 4192965 82 Linux swap / Solaris
/dev/xvda3 548 1958 11333857+ 83 Linux
Disk /dev/xvdb: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvdb1 1 5221 41937651 83 Linux
4.式化新创建的分区