磁盘分割
[
root@localhost /]# fdisk -l --列出系统所有的装置的partition都列出来
Disk /dev/sda: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 522 4088542+ 83 Linux
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 131 1052226 82 Linux swap / Solaris
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
---也可以指定设备,
[root@localhost /]#
fdisk -l /dev/sdc
Disk /dev/sdc: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 131 1052226 82 Linux swap / Solaris
[root@localhost /]# fdisk -l /dev/sda
Disk /dev/sda: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 522 4088542+ 83 Linux
---创建一个主分区,如果使用默认值,会在建立第一个分区时就将整个磁盘使用完。
[root@localhost /]# fdisk /dev/sdd
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391): =直接按enter键默认391
Using default value 391
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 391 3140676 83 Linux
Command (m for help): n
--继续添加
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
No free sectors available---
没有可用空间了!
--删除刚才建立的那个分区。
Command (m for help): d
Selected partition 1
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
--新建分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391): +50M
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 7 56196 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (8-391, default 8):
Using default value 8
Last cylinder or +size or +sizeM or +sizeK (8-391, default 391): +2^H
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 7 56196 83 Linux
/dev/sdd2 8 10 24097+ 83 Linux
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 7 56196 83 Linux
/dev/sdd2 8 10 24097+ 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (11-391, default 11):
Using default value 11
Last cylinder or +size or +sizeM or +sizeK (11-391, default 391):
Using default value 391
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 7 56196 83 Linux
/dev/sdd2 8 10 24097+ 83 Linux
/dev/sdd3 11 391 3060382+ 83 Linux
--删除第三个分区
Command (m for help): d
Partition number (1-4): 3
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 7 56196 83 Linux
/dev/sdd2 8 10 24097+ 83 Linux
--删除第二个分区
Command (m for help): d
Partition number (1-4): 2
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 删除一个分区
l list known partition types
m print this menu
n add a new partition
新增一个分区
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
不保存,离开
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
写入并保存
x extra functionality (experts only)
Command (m for help): d
Selected partition 1
--只有一个分区,系统帮我们选择
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): q
[root@localhost /]#
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22664653/viewspace-680496/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22664653/viewspace-680496/