目的:将/u2和/u3分区删除后,合并为/u4分区。
1、先取消/u2和/u3分区的挂载
[root@fdisk ~]# umount /u2
[root@fdisk ~]# umount /u3
[root@fdisk ~]# df -h
文件系统 容量 已用 可用 已用%% 挂载点
/dev/sda5 22G 2.0G 19G 10% /
tmpfs 911M 0 911M 0% /dev/shm
/dev/sda1 194M 32M 153M 18% /boot
/dev/sda3 2.0G 35M 1.8G 2% /u1
2、进入fdisk /dev/sda磁盘删除分区格式
[root@fdisk ~]# fdisk /dev/sda
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): p
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 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: 0x0007403b
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 281 2048000 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 281 536 2048000 83 Linux
Partition 3 does not end on cylinder boundary.
/dev/sda4 536 3917 27155456 5 Extended
/dev/sda5 1046 3917 23056384 83 Linux
/dev/sda6 536 736 1610064+ 83 Linux
/dev/sda7 737 1045 2482011 83 Linux #这两个虽然取消挂载,但是分区要进一步删除。
Partition table entries are not in disk order
Command (m for help): d
Partition number (1-7): 7 #这个标号是要删除的磁盘编号
Command (m for help): p #建议删一次分区,用一次p选项,避免删错
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 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: 0x0007