使用SSH客户端登录Linux服务器。
(加上-T这个参数,就可以列出所有系统挂载的分区的文件类型信息)
[root@servername ~]# df -lh
文件系统 容量 已用 可用 已用%% 挂载点
教育评价
/dev/sda3 95G 4.0G 86G 5% /
tmpfs 3.9G 72K 3.9G 1% /dev/shm
/dev/sda1 388M 37M 331M 10% /boot
[root@servername ~]#
1.3. 查看磁盘情况(此步不建议省略)
下方红字为要创建分区的硬盘。
[root@servername ~]# fdisk -l
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
2013年春季流行女装Disk identifier: 0x000bf627
Device Boot Start End Blocks Id System
/dev/sda1 * 1 52 409600 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 52 574 4194304 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 574 13055 100252672 83 Linux
Disk /dev/sdb桑塔纳2000机油: 1073.7 GB, 1073741824000 bytes
日本合气道255 heads, 63 sectors/track, 130541 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
[root@servername ~]#
1.4. 创建分区
下方红字为要创建分区的硬盘注意跟上面查看到的要对应。
[root@servername ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x883e515a.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n 新增加一个分区
Command action
e extended
p primary partition (1-4)
p 分区类型我们选择为主分区
Partition number (1-4): 1 分区编号选1,如果被占依此类推
First cylinder (1-130541, default 1): 按回车 默认(起始扇区) Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-130541, default 130541): 按回车 默认(结束扇区)也可以使用长泾中学+100M即创建100M的分区 也可以使用(K,M,G)
Using default value 130541
Command (m for help): w 写分区表(可以输入t进行分区格式调整,见1.6调整分区格式)
The partition table has been altered!
Calling ioctl() to re-read partition table.
panelSyncing disks.
[root@servername ~]#
1.5. 重新查看磁盘情况(此步可省略)
下方红字为新创建的磁盘分区信息。
[root@servername ~]# fdisk -l
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000bf627
Device Boot Start End Blocks Id System
/dev/sda1 * 1 52 409600 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 52 574 4194304 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 574 13055 100252672 83 Linux
Disk /dev/sdb: 1073.7 GB, 1073741824000 bytes
255 heads, 63 sectors/track, 130541 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes