磁盘分区的删除

使用fdisk  设备名  进入fdisk 界面。
[root@zeng ~]# fdisk /dev/sdb
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/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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: 0xd7ea6b16
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1044     8385898+   5  Extended
/dev/sdb5               1        1044     8385867   83  Linux
//有两个分区,一个扩展分区/dev/sdb1,还有一个逻辑分区/dev/sda5。
使用d 来删除分区.
Command (m for help): d 
Partition number (1-5): 5  //输入要删除的分区好5即代表/dev/sdb5.
Command (m for help): p
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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: 0xd7ea6b16
   Device Boot      Start         End      Blocks   Id  System
// /dev/sdb1               1        1044     8385898+   5  Extended
逻辑分区/dev/sdb5 已经被删除了,现在我们再来把扩展分区也给删除掉.
Command (m for help): d
Selected partition 1
因为只剩下最后一个分区,所以fdisk 自动的选中该分区.
Command (m for help): p
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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: 0xd7ea6b16
   Device Boot      Start         End      Blocks   Id  System
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 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks
在执行分区删除的时候出现了一个错误,说的是系统无法加载信息的分区表,因为设备在忙。因为
我粗心大意在删除分区前,没有把该分区卸载掉。下面来补做这个工作。
[root@zeng ~]# umount /dev/sdb5
查看下设备的分区表,ok 没问题.
[root@zeng ~]# fdisk  /dev/sdb
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/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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: 0xd7ea6b16
   Device Boot      Start         End      Blocks   Id  System
Command (m for help): q
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值