fdisk 和 parted 命令的確切輸出會(huì)根據(jù)系統(tǒng)的配備和配置將會(huì)有所不同。
清單 1 提供了代碼響應(yīng):
[tbost@linux ~]$ sudo fdisk /dev/sdb1Command (m for help): mCommand 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 m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel 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 (experts only)Command (m for help): l...82 Linux swap / Solaris83 Linux ... |
練習(xí) 1 中步驟的順序如下:
fdisk /dev/sdb1
命令在交互模式下輸入 fdisk
。 您的硬盤掛載點(diǎn)可能不同。
m
來獲得可用命令的清單。練習(xí) 2. 使用 fdisk 創(chuàng)建分區(qū)的解答
清單 2 顯示了如何處理并列出典型的輸出:
Command (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4, default 1):First sector (2048-7831543, default 2048): Using default value 2048Last sector, sectors or size{K,M,G} (2048-7831543, default 7831543): 100MCommand (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4, default 2): Using default value 2First sector (206848-7831543, default 206848): Using default value 206848Last sector, sectors or size{K,M,G}(206848-7831543, default 7831543): 2GCommand (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4, default 3): Using default value 3First sector (4401152-7831543, default 4401152): Using default value 4401152Last sector, sectors or size{K,M,G} (4401152-7831543, default 7831543): 1GCommand (m for help): nCommand action e extended p primary partition (1-4)pSelected partition 4First sector (6498304-7831543, default 6498304): Using default value 6498304Last sector, sectors or size{K,M,G} (6498304-7831543, default 7831543): 500MCommand (m for help): pDisk /dev/sdb1: 4009 MB, 4009750528 bytes124 heads, 62 sectors/track, 1018 cylinders, total 7831544 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x6f20736b Device Boot Start End Blocks Id System/dev/sdb1p1 2048 206847 102400 83 Linux/dev/sdb1p2 206848 4401151 2097152 83 Linux/dev/sdb1p3 4401152 6498303 1048576 83 Linux/dev/sdb1p4 6498304 7522303 512000 83 LinuxCommand (m for help): tPartition number (1-4): 4Hex code (type L to list codes): 82Changed system type of partition 4 to 82 (Linux swap / Solaris)Command (m for help): nDisk /dev/sdb1: 4009 MB, 4009750528 bytes124 heads, 62 sectors/track, 1018 cylinders, total 7831544 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x6f20736b Device Boot Start End Blocks Id System/dev/sdb1p1 2048 206847 102400 83 Linux/dev/sdb1p2 206848 4401151 2097152 83 Linux/dev/sdb1p3 4401152 6498303 1048576 83 Linux/dev/sdb1p4 6498304 7522303 512000 82 Linux swap / SolarisCommand (m for help): w |
練習(xí) 2 中步驟的順序如下:
n
可創(chuàng)建一個(gè)新分區(qū)。 p
。 如果您想要?jiǎng)?chuàng)建多于 4 個(gè)的分區(qū),請?jiān)跀?shù)字 4 的分區(qū)輸入 e
進(jìn)行擴(kuò)展。其他分區(qū)為 logical 分區(qū)。
)。 例如,在分區(qū) 1 上,輸入 100M
。
t
更改分區(qū)文件系統(tǒng)類型。4
,然后輸入 82
更改為 Linux Swap
。w
寫入分區(qū)表并退出。練習(xí) 3. 使用 fdisk 隱藏或顯示啟動(dòng)標(biāo)志的解答
清單 3 顯示如何進(jìn)行練習(xí) 3:
Command (m for help): aPartition number (1-4): 1Command (m for help): pDisk /dev/sdb1: 4009 MB, 4009750528 bytes124 heads, 62 sectors/track, 1018 cylinders, total 7831544 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x6f20736b Device Boot Start End Blocks Id System/dev/sdb1p1 * 2048 206847 102400 83 Linux/dev/sdb1p2 206848 4401151 2097152 83 Linux/dev/sdb1p3 4401152 6498303 1048576 83 Linux/dev/sdb1p4 6498304 7522303 512000 82 Linux swap / SolarisCommand (m for help): |
練習(xí) 3 中步驟的順序如下:
a
表示您想要設(shè)置啟動(dòng)標(biāo)志分區(qū)。1
。p
驗(yàn)證更改。清單 4 提供了代碼響應(yīng):
[tbost@linux ~]$ sudo parted /dev/sdb1 GNU Parted 2.3Using /dev/sdb1Welcome to GNU Parted! Type 'help' to view a list of commands.(parted)help align-check TYPE N check partition N for TYPE(min|opt) alignment check NUMBER do a simple check on the file system cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition help [COMMAND] print general help, or help on COMMAND mklabel,mktable LABEL-TYPE create a new disklabel (partition table) mkfs NUMBER FS-TYPE make a FS-TYPE file system on partition NUMBER mkpart PART-TYPE [FS-TYPE] START END make a partition.........(parted) pModel: Unknown (unknown)Disk /dev/sdb1: 4010MBSector size (logical/physical): 512B/512BPartition Table: msdosNumber Start End Size Type File system Flags 1 1049kB 106MB 105MB primary boot 2 106MB 2253MB 2147MB primary 3 2253MB 3327MB 1074MB primary 4 3327MB 3851MB 524MB primary |
練習(xí) 4 中步驟的順序如下:
parted/dev/sdb1
命令在交互模式下輸入 parted
。 您的硬盤掛載點(diǎn)可能不同。
help
顯示可用命令。 清單 4 顯示可用命令的部分列表。
p
將分區(qū)表打印到屏幕上。練習(xí) 5. 使用 parted 更改顯示單位的模式的解答
清單 5 顯示預(yù)期的輸入和典型的輸出:
(parted) help u unit UNIT set the default unit to UNITUNIT is one of: s, B, kB, MB, GB, TB, compact, cyl, chs, %, kiB, MiB, GiB, TiB(parted) u TB (parted)p Model: Unknown (unknown)Disk /dev/sdb1: 0.00TBSector size (logical/physical): 512B/512BPartition Table: msdosNumber Start End Size Type File system Flags 1 0.00TB 0.00TB 0.00TB primary boot 2 0.00TB 0.00TB 0.00TB primary 3 0.00TB 0.00TB 0.00TB primary 4 0.00TB 0.00TB 0.00TB primary |
練習(xí) 5 中步驟的順序如下:
help u
顯示可用的顯示單位類型。u TB
將顯示單位更改為兆兆字節(jié)。p
將分區(qū)表打印到屏幕上。 清單 5 TB
時(shí)顯示全零,因?yàn)橛脖P大小只有 4 GB。您的系統(tǒng)的顯示結(jié)果可能會(huì)不同。
聯(lián)系客服