Chinaunix首页 | 论坛 | 博客
  • 博客访问: 262081
  • 博文数量: 82
  • 博客积分: 2502
  • 博客等级: 少校
  • 技术积分: 842
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-04 15:13
文章分类

全部博文(82)

文章存档

2011年(3)

2009年(25)

2008年(54)

我的朋友

分类: LINUX

2011-04-29 20:16:29

安装gentoo的时候,由于不懂fdisk的操作,导致了删掉了整个硬盘,作为教训,赶紧去补习了fdisk使用规则。
接下来就开始学习吧

fdisk -l 查看机器所有硬盘及其分区情况;

也可以用fdisk -l /dev/xxx单独查看某个硬盘的分区情况。

fdisk /dev/xxx 开始对某个设备的分区操作的会话。按m可以查看所有命令。

常用的有:

d delete a partition 注:这是删除一个分区的动作;

l list known partition types 注:l是列出分区类型,以供我们设置相应分区的类型;

m print this menu 注:m 是列出帮助信息;

n add a new partition 注:添加一个分区;

p print the partition table 注:p列出分区表;

q quit without saving changes 注:不保存退出;

t change a partition's system id 注:t 改变分区类型;

w write table to disk and exit 注:把分区表写入硬盘并退出;

以上就是fdisk的所带的一些参数,接下来看下具体怎么使用

通过fdisk的d指令删除分区的例子:

Command (m for help): p 注:列出分区情况;


Disk /dev/sda: 1035 MB, 1035730944 bytes

256 heads, 63 sectors/track, 125 cylinders

Units = cylinders of 16128 * 512 = 8257536 bytes

Device Boot Start End Blocks Id System

/dev/sda1 1 25 201568+ c W95 FAT32 (LBA)

/dev/sda2 26 125 806400 5 Extended

/dev/sda5 26 50 201568+ 83 Linux

/dev/sda6 51 76 200781 83 Linux


Command (m for help): d 注:执行删除分区指定;

Partition number (1-6): 6 注:我想删除 sda6 ,就在这里输入 6 ;

Command (m for help): p 注:再查看一下硬盘分区情况,看是否删除了?


Disk /dev/sda: 1035 MB, 1035730944 bytes

256 heads, 63 sectors/track, 125 cylinders

Units = cylinders of 16128 * 512 = 8257536 bytes

Device Boot Start End Blocks Id System

/dev/sda1 1 25 201568+ c W95 FAT32 (LBA)

/dev/sda2 26 125 806400 5 Extended

/dev/sda5 26 50 201568+ 83 Linux


警告:删除分区时要小心,请看好分区的序号,如果您删除了扩展分区,扩展分区之下的逻辑分区都会删除;所以操作时一定要小心;如果知道自己操作错了,请不要惊慌,用q不保存退出;切记切记!!!!在分区操作错了之时,千万不要输入w保存退出!!!

以上就是fdisk简单的学习,下一篇文章会介绍fdisk的如何为一个新的硬盘建立分区。http://blogold.chinaunix.net/u2/65552/showart_2535542.html
阅读(544) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~