fdisk交互式划分磁盘分区示例

简介:

fdisk交互式划分磁盘分区示例


注:来自Linux系统管理_磁盘分区和格式化的扩展

Linux系统管理_磁盘分区和格式化:


规划磁盘分区:fdisk的常用选项


:查看帮助信息


:列表查看分区信息


:新建磁盘分区


:删除分区


:变更分区类型(在使用t的时候,如果不知道)


:保存分区设置并退出


:放弃分区设置并退出



示例:


[root@localhost ~]# fdisk -l        //查看当前分区


Disk /dev/sda: 64.4 GB, 64424509440 bytes

255 heads, 63 sectors/track, 7832 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes


  Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          25      200781   83  Linux

/dev/sda2              26        2575    20482875   83  Linux

/dev/sda3            2576        3850    10241437+  83  Linux

/dev/sda4            3851        7832    31985415    5  Extended

/dev/sda5            3851        4111     2096451   82  Linux swap / Solaris

/dev/sda6            4112        5085     7823623+  83  Linux



[root@localhost ~]# fdisk /dev/sda    //规划磁盘/dev/sda


The number of cylinders for this disk isset to 7832.

There is nothing wrong with that, but thisis larger than 1024,

and could in certain setups cause problemswith:

1) software that runs at boot time (e.g.,old versions of LILO)

2) booting and partitioning software fromother OSs

 (e.g., DOS FDISK, OS/2 FDISK)


Command (m for help): m        //查看帮助,可以看到,可以在此模式下执行的命令

Command action

 a   toggle a bootable flag

 b   edit bsd disklabel

 c   toggle the dos compatibilityflag

 d   delete a partition

 l   list known partition types

 m   print this menu

 n   add a new partition

 o   create a new empty DOSpartition table

 p   print the partition table

 q   quit without saving changes

 s   create a new empty Sundisklabel

 t   change a partition's system id

 u   change display/entry units

  v   verify the partition table

 w   write table to disk and exit

 x   extra functionality (expertsonly)


Command (m for help): p    //首先查看当前规划


Disk /dev/sda: 64.4 GB, 64424509440 bytes

255 heads, 63 sectors/track, 7832 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes


 Device Boot      Start         End      Blocks  Id  System

/dev/sda1  *           1          25      200781  83  Linux

/dev/sda2              26        2575   20482875   83  Linux

/dev/sda3            2576        3850   10241437+  83  Linux

/dev/sda4            3851        7832   31985415    5  Extended

/dev/sda5            3851        4111    2096451   82  Linux swap / Solaris

/dev/sda6            4112        5085    7823623+  83  Linux


Command (m for help): d        //删除一个分区

Partition number (1-6): 6        //删除第六快分区


Command (m for help): p        //查看当前磁盘分区,可以看到,刚才删除了/dev/sda6


Disk /dev/sda: 64.4 GB, 64424509440 bytes

255 heads, 63 sectors/track, 7832 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes


 Device Boot      Start         End      Blocks  Id  System

/dev/sda1  *           1          25      200781  83  Linux

/dev/sda2              26        2575   20482875   83  Linux

/dev/sda3            2576        3850   10241437+  83  Linux

/dev/sda4            3851        7832   31985415    5  Extended

/dev/sda5            3851        4111    2096451   82  Linux swap / Solaris


Command (m for help): n        //新划分一块分区

First cylinder (4112-7832, default 4112):    //起始不变

Using default value 4112

Last cylinder or +size or +sizeM or +sizeK(4112-7832, default 7832): +10G    //新加一块10G的分区


Command (m for help): p        //再次查看,可以看到,有新添加了一个逻辑分区


Disk /dev/sda: 64.4 GB, 64424509440 bytes

255 heads, 63 sectors/track, 7832 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes


 Device Boot      Start         End      Blocks  Id  System

/dev/sda1  *           1          25      200781  83  Linux

/dev/sda2              26        2575   20482875   83  Linux

/dev/sda3            2576        3850   10241437+  83  Linux

/dev/sda4            3851        7832   31985415    5  Extended

/dev/sda5            3851        4111    2096451   82  Linux swap / Solaris

/dev/sda6            4112        5328     9775521  83  Linux


Command (m for help): t    //改变一个分区的类型

Partition number (1-6): 6        //指定修改分区类型的分区为第六个分区,/dev/sda6

Hex code (type L to list codes): L    //可以输入L查看当前不同分区的编号


0 Empty           1e  Hidden W95 FAT1 80  Old Minix       bf Solaris      

1 FAT12           24  NEC DOS         81 Minix / old Lin c1  DRDOS/sec(FAT-

2  XENIXroot      39  Plan 9          82 Linux swap / So c4  DRDOS/sec(FAT-

3  XENIXusr       3c  PartitionMagic  83 Linux           c6  DRDOS/sec (FAT-

4  FAT16<32M      40  Venix 80286     84 OS/2 hidden C:  c7  Syrinx      

5 Extended        41  PPC PReP Boot   85 Linux extended  da  Non-FS data

6 FAT16           42  SFS             86 NTFS volume set db  CP/M / CTOS /.

7 HPFS/NTFS       4d QNX4.x          87  NTFS volume set de  Dell Utility

8 AIX             4e  QNX4.x 2nd part 88  Linux plaintext df  BootIt      

9  AIXbootable    4f  QNX4.x 3rd part 8e  Linux LVM       e1 DOS access  

a  OS/2Boot Manag 50  OnTrack DM      93 Amoeba          e3  DOS R/O    

b  W95FAT32       51  OnTrack DM6 Aux 94  Amoeba BBT      e4 SpeedStor    

c  W95FAT32 (LBA) 52  CP/M            9f BSD/OS          eb  BeOS fs    

e  W95FAT16 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi ee  EFI GPT    

f  W95Ext'd (LBA) 54  OnTrackDM6      a5 FreeBSD         ef  EFI (FAT-12/16/

10 OPUS            55  EZ-Drive        a6 OpenBSD         f0  Linux/PA-RISC b

11 Hidden FAT12    56  Golden Bow      a7 NeXTSTEP        f1  SpeedStor  

12 Compaq diagnost 5c  PriamEdisk     a8  Darwin UFS      f4 SpeedStor    

14 Hidden FAT16 <3 61 SpeedStor       a9  NetBSD          f2 DOS secondary

16 Hidden FAT16    63  GNU HURD or Sys ab  Darwin boot     fb VMware VMFS  

17 Hidden HPFS/NTF 64  NovellNetware  b7  BSDI fs         fc VMware VMKCORE

18 AST SmartSleep  65  Novell Netware  b8 BSDI swap       fd  Linux raid auto

1b Hidden W95 FAT3 70  DiskSecureMult bb  Boot Wizard hid fe  LANstep    

1c  Hidden W95 FAT3 75  PC/IX           be Solaris boot    ff  BBT        

Hex code (type L to list codes): 7        //指定当前分区的类型为7,即NTFS分区

Changed system type of partition 6 to 7(HPFS/NTFS)


Command (m for help): q    //若要保存则输如w保存退出



[root@localhost ~]#


本文转自 murongqingqqq  51CTO博客,原文链接:http://blog.51cto.com/murongqingqqq/1361896



相关文章
|
10月前
|
存储 Linux
Linux存储管理磁盘分区逻辑分区
上一篇文章留了一点尾巴,如上篇文章介绍,MBR只能分四个主分区,如果需要更多的分区,需要放弃其中一个主分区,将其划分为扩展分区,再将扩展分区划分为逻辑分区来使用。
130 0
|
8月前
|
Linux
7.3 【Linux】磁盘的分区、格式化、检验与挂载
7.3 【Linux】磁盘的分区、格式化、检验与挂载
127 0
|
10月前
|
Linux
【磁盘管理】fdisk命令 – 管理磁盘分区
fdisk命令来自于英文词组“Partition table manipulator for Linux”的缩写,其功能是用于管理磁盘的分区信息。如果一套几百平米的房子内部没有墙壁,虽然看起来会很敞亮,但是各种声音、气味、物品会随意充斥在整个房子内,让人极不舒适,因此需要用墙壁按照功能进行划分,例如卧室、厕所、厨房、阳台等等。
171 0
Linux 用fdisk进行磁盘分区(图文过程)
Linux 用fdisk进行磁盘分区(图文过程)
Linux 用fdisk进行磁盘分区(图文过程)
|
5G Linux
10.15 Linux fdisk创建分区(主分区、扩展分区和逻辑分区)过程详解
本节我们实际建立一个主分区,看看过程是什么样子的。命令如下:
1072 0
10.15 Linux fdisk创建分区(主分区、扩展分区和逻辑分区)过程详解

热门文章

最新文章