热门关键字:  ubuntu  分区  Fedora  linux系统进程  函数

分区指南 实例解说fdisk工具的使用

来源: 作者: 时间:2007-04-17 Tag: 点击:

四、fdisk 对硬盘及分区的操作,进入fdisk 对硬盘操作阶段;

我们可以对硬盘进行分区操作,前提是您把fdisk -l 弄明白了;通过fdisk -l ,我们能找出机器中所有硬盘个数及设备名称;比如上面的例子,我们会看到两个设备一个是/dev/hda ,另一个是/dev/sda ;

fdisk 操作硬盘的命令格式如下:

[root@localhost beinan]# fdisk 设备

比如我们通过 fdisk -l 得知 /dev/hda 或者 /dev/sda设备;我们如果想再添加或者删除一些分区,可以用。

[root@localhost beinan]# fdisk /dev/hda

[root@localhost beinan]# fdisk /dev/sda

注 在以后的例子中,我们要以 /dev/sda设备为例,来讲解如何用fdisk 来操作添加、删除分区等动作;

1、fdisk 的说明;

当我们通过 fdisk 设备,进入相应设备的操作时,会发现有如下的提示;以 fdisk /dev/sda 设备为例,以下同;

[root@localhost beinan]# fdisk /dev/sda

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 注:l是列出分区类型,以供我们设置相应分区的类型;

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

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

o create a new empty DOS partition table

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

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

s create a new empty Sun disklabel

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

u change display/entry units

v verify the partition table

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

x extra functionality (experts only) 注:扩展应用,专家功能;

其实我们常用的只有注有中文的,其它的功能我们不常用(呵,主要是我不会用,否则早会卖弄一下了);x扩展功能,也不是常用的;一般的情况下只要懂得 d l m p q t w 就行了;

下面以实例操作来详述,没有例子没有办法就,新手也看不懂;

2、列出当前操作硬盘的分区情况,用p;

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

3、通过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

Command (m for help):

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



相关文章:
Linux - 增加 Swap 方法
UFS - Unix File System
Linux下如何备份分区表
Ext2文件系统转换为Ext3的方法
Linux Filesystems
proc文件系统
linux 文件系统
/boot不要单独分区!
解析linux根文件系统的挂载过程
理解和认识udev
proc文件系统探索 之 以数字命令的目录[三]
如何自动装配文件系统autofs
linux文件系统基础知识
Linux下增加swap space
autofs服务动态自动挂载各种文件系统
挂载LVM分区
/dev/null 找不到设备的问题
Linux 文件系统(filesystem)资源索引
zfs snapshot
ext2, ext3, xfs, reiserfs 文件系统性能测试
给mss增加ext3空间
Linux为什么最多能分4个四个主分区的解释
制作jffs2 根文件系统
Linux文件系统 一分钱一分货
linux加密分区的创建和使用
onlineJFS无法使用问题(HP_UX)
Linux磁盘存储区管理原理与技巧
udev学习
以NAS价位获取FC文件系统性能
Linux下以模块方式安装卸载文件系统