[root@yjs ~]# fdisk -l Disk /dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 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 1305 10377990 8e Linux LVM Disk /dev/sdb: 1073 MB, 1073741824 bytes 255 heads, 63 sectors/track, 130 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 13 104391 83 Linux Disk /dev/sdc: 1073 MB, 1073741824 bytes 255 heads, 63 sectors/track, 130 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdc doesn't contain a valid partition table Disk /dev/sdd: 1073 MB, 1073741824 bytes 255 heads, 63 sectors/track, 130 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdd doesn't contain a valid partition table
[root@jzy ~]# fdisk /dev/sda [root@jzy ~]# fdisk /dev/sdb
命令 | 功能 |
m | 列出命令菜单 |
p | 打印分区表 |
n | 建立新分区 |
d | 删除分区 |
l | 改变分区类型 |
q | 不保存退出 |
w | 保存后退出 |
新加一个分区:
[root@yjs ~]# fdisk /dev/sda The number of cylinders for this disk is set to 1305. 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) Command (m for help):
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-130, default 1): 1 Last cylinder or +size or +sizeM or +sizeK (1-130, default 130): 50 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
[partprobe]
删除一个分区:
[root@yjs ~]# fdisk /dev/sdc Command (m for help): d Selected partition 1 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
fdisk 替代命令:
[root@yjs ~]# cat /proc/partitions major minor #blocks name 8 0 10485760 sda 8 1 104391 sda1 8 2 10377990 sda2 8 16 1048576 sdb 8 17 104391 sdb1 8 32 1048576 sdc 8 48 1048576 sdd 253 0 9306112 dm-0 253 1 1048576 dm-1 253 2 1044480 dm-2 253 3 2088960 dm-3