格式化硬盘命令linux 格式化硬盘 linux( 三 )


e
Selected partition 4
First sector (309248-496127, default 309248): #enter,默认
Using default value 309248
Last sector, +sectors or +size{K,M,G} (309248-496127, default 496127): #enter,默认,使用剩余空间
Using default value 496127
Command (m for help): p
Disk /dev/sdb: 254 MB, 254017536 bytes
8 heads, 61 sectors/track, 1016 cylinders, total 496128 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1 2048 104447 51200 83 Linux
/dev/sdb2 104448 206847 51200 83 Linux
/dev/sdb3 206848 309247 51200 83 Linux
/dev/sdb4 309248 496127 93440 5 Extended
#接下来,我们在新建的扩展分区里再新建两个逻辑分区 , 因为已经有了三个主分区 , 这里不会再显示是建立逻辑分区还是主分区的提示!
Command (m for help): n
First sector (311296-496127, default 311296): #enter
Using default value 311296
Last sector, +sectors or +size{K,M,G} (311296-496127, default 496127): +50M
Command (m for help): n
First sector (415744-496127, default 415744): #enter
Using default value 415744
Last sector, +sectors or +size{K,M,G} (415744-496127, default 496127): #enter
Using default value 496127
Command (m for help): p
Disk /dev/sdb: 254 MB, 254017536 bytes
8 heads, 61 sectors/track, 1016 cylinders, total 496128 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1 2048 104447 51200 83 Linux
/dev/sdb2 104448 206847 51200 83 Linux
/dev/sdb3 206848 309247 51200 83 Linux
/dev/sdb4 309248 496127 93440 5 Extended
/dev/sdb5 311296 413695 51200 83 Linux
/dev/sdb6 415744 496127 40192 83 Linux
#上面的列表 , 就是我们今天分区的成果啦!接下来保存退出,重启计算机,就可以进行下一步的mkfs操作啦!如果忘记了相关的操作命令 , 记得按m!!!
Command (m for help): w #保存
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
另:在建好分区后,我们还可以更改相关分区的文件系统类型
#如,我们要把第二个主分区改成Linux下的交换分区 , 操作如下
Command (m for help): t #更改文件系统类型
Partition number (1-6): 2 #选择第二个分区
Hex code (type L to list codes): L #选择要更改的文件系统编码,可以按L来查看相关编码信息 。
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 40 Venix 80286 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
............
16 Hidden FAT16 64 Novell Netware af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 65 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 70 DiskSecure Mult b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 75 PC/IX bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 80 Old Minix be Solaris boot ff BBT
1e Hidden W95 FAT1
Hex code (type L to list codes): 82 #查找到linux swap的编码为82
Changed system type of partition 2 to 82 (Linux swap / Solaris)
Command (m for help): p
..............
Device Boot Start End Blocks Id System
/dev/sdb1 2048 104447 51200 83 Linux
/dev/sdb2 104448 206847 51200 82 Linux swap / Solaris
/dev/sdb3 206848 309247 51200 83 Linux
/dev/sdb4 309248 496127 93440 5 Extended

推荐阅读