Welcome 微信登录

首页 / 操作系统 / Linux / Linux下fdisk命令操作磁盘详解--添加、删除、转换分区等

linux下fdisk命令操作磁盘详解--添加、删除、转换分区等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/sdaCommand (m for help): 在这里按 m ,就会输出帮助;Command actiona toggle a bootable flagb edit bsd disklabelc toggle the dos compatibility flagd 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 tablep print the partition table 注:p 列出分区表;q quit without saving changes 注:不保存退出;s create a new empty Sun disklabelt change a partition"s system id 注:t 改变分区类型;u change display/entry unitsv verify the partition tablew 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): pDisk /dev/sda: 1035 MB, 1035730944 bytes256 heads, 63 sectors/track, 125 cylindersUnits = cylinders of 16128 * 512 = 8257536 bytesDevice 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 Linux3、通过 fdisk 的 d 指令来删除一个分区;Command (m for help): p 注:列出分区情况;Disk /dev/sda: 1035 MB, 1035730944 bytes256 heads, 63 sectors/track, 125 cylindersUnits = cylinders of 16128 * 512 = 8257536 bytesDevice 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 LinuxCommand (m for help): d 注:执行删除分区指定;Partition number (1-6): 6 注:我想删除 sda6 ,就在这里输入 6 ;Command (m for help): p 注:再查看一下硬盘分区情况,看是否删除了?Disk /dev/sda: 1035 MB, 1035730944 bytes256 heads, 63 sectors/track, 125 cylindersUnits = cylinders of 16128 * 512 = 8257536 bytesDevice 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 LinuxCommand (m for help):警告:删除分区时要小心,请看好分区的序号,如果您删除了扩展分区,扩展分区之下的逻辑分区都会删除;所以操作时一定要小心;如果知道自己操作错了,请不要惊慌,用 q 不保存退出;切记切记!!!!在分区操作错了之时,千万不要输入 w 保存退出!!!4、通过 fdisk 的 n 指令增加一个分区;Command (m for help): pDisk /dev/sda: 1035 MB, 1035730944 bytes256 heads, 63 sectors/track, 125 cylindersUnits = cylinders of 16128 * 512 = 8257536 bytesDevice 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 LinuxCommand (m for help): n 注:增加一个分区;
  • 1
  • 2
  • 3
  • 下一页
Linux fdisk命令参数及用法详解---Linux磁盘分区管理命令fdiskLinux col命令参数及用法详解---Linux过滤控制字符相关资讯      Linux命令集 
  • Linux里必须掌握的命令  (06/11/2012 09:25:29)
  • Linux 算术运算 bc expr dc  (06/07/2012 11:24:16)
  • Linux scp 命令使用详解  (06/04/2012 19:57:05)
  • Linux 文件和目录查询及修改  (06/08/2012 14:00:24)
  • Linux命令行下常用svn命令  (06/07/2012 09:31:04)
  • Linux下ps命令用法  (06/04/2012 19:56:08)
本文评论 查看全部评论 (1)
表情: 姓名: 字数


评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款