新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 學(xué)習(xí) Linux,101: 建設(shè)分區(qū)和文件系統(tǒng)

學(xué)習(xí) Linux,101: 建設(shè)分區(qū)和文件系統(tǒng)

作者: 時間:2016-09-12 來源:網(wǎng)絡(luò) 收藏

清單 8. 修改分區(qū)類型

Command (m for help): t

Partition number (1-9): 4

Hex code (type L to list codes): 82

Changed system type of partition 4 to 82 (Linux swap / Solaris)

Command (m for help): t

Partition number (1-9): 9

Hex code (type L to list codes): b

Changed system type of partition 9 to b (W95 FAT32)

Command (m for help):

保管分區(qū)表

到當(dāng)前為止,我們只是對分區(qū)表舉行了內(nèi)存中編輯。我們能夠用 q 命令退出,不保管修改。假設(shè)某些分區(qū)不能滿足您的要求,您能夠運用 d 命令來刪除一個或多個分區(qū),以便重新定義它們。假設(shè)您對配置滿意,則能夠運用 v 命令來驗證您的配置,然后運用 w 命令來寫入新的分區(qū)表并退出。參見清單 9。假設(shè)您再次運轉(zhuǎn) fdisk -l 命令,您將看到,Linux 如今已能夠識別新分區(qū)。與其他操作系統(tǒng)不一樣的是,Linux 并不總是須要重新啟動才干看到修改。舉例來說,假設(shè) /dev/hda3 變成 /dev/hda2,則須要重新啟動,由于原來的 /dev/hda2 已被刪除。假設(shè)須要重新啟動,fdisk 應(yīng)該會通知您。

清單 9. 保管分區(qū)表

Command (m for help): v

999521580 unallocated 512-byte sectors

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x

partitions, please see the fdisk manual page for additional

information.

Syncing disks.

root@Microknoppix:~# fdisk -l /dev/sda

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes

255 heads, 63 sectors/track, 121601 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x000de20f

Device Boot   Start     End   Blocks  Id System

/dev/sda1  *      1    9111  73184076  7 HPFS/NTFS

/dev/sda2      9634    9730   779152+ 83 Linux

/dev/sda3      9731   116679  859067842+  5 Extended

/dev/sda4      9112    9633   4192965  82 Linux swap / Solaris

/dev/sda5      9731    20917  89859546  83 Linux

/dev/sda6      20918    39644  150424596  83 Linux

/dev/sda7      39645    53905  114551451  83 Linux

/dev/sda8      53906    59128  41953716  83 Linux

/dev/sda9      59129    59384   2056288+  b W95 FAT32

Partition table entries are not in disk order

高級 fdisk

您能夠已留意到,我們沒有修改恣意分區(qū)上的 bootable 標(biāo)志。如今,我們的硬盤尚有 Windows Master Boot Record (MBR),因而將啟動標(biāo)志為 bootable 的第一個主分區(qū)(我們的示例中為 NTFS 分區(qū))。

LILO 和 GRUB 都不運用 bootable 標(biāo)志。假設(shè)其中一個裝置在 MBR 中,那么它就能夠引導(dǎo) Windows/xp 分區(qū)。您也可以夠?qū)? LILO 或 GRUB 裝置到您的 /boot 分區(qū)(/dev/hda2)中,將該分區(qū)標(biāo)志為 bootable 并移除 /dev/hda1 的 bootable 標(biāo)志。假設(shè)機器今后將恢復(fù)為 Windows 自用機器,那么保管原始 MBR 能夠會有用。

假設(shè)須要,您還能夠運用 fdisk 來修正分區(qū)表中的分區(qū)順序。這通常將會修改分區(qū)編號,因而您能夠須要完成其他任務(wù)才干將您的系統(tǒng)恢復(fù)為任務(wù)系統(tǒng)。要舉行這個修改,運用 f 子命令切換到專家方式,然后運用 r 子命令修正分區(qū)順序,如清單 10 所示。假設(shè)您只是想看看新的分區(qū)順序而不實踐修改,能夠運用 q 子命令退出(本例的做法),而不是將更新后的分區(qū)表寫到硬盤中。

清單 10. 修正分區(qū)表順序

Command (m for help): p

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes

255 heads, 63 sectors/track, 121601 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x000de20f

Device Boot   Start     End   Blocks  Id System

/dev/sda1  *      1    9111  73184076  7 HPFS/NTFS

/dev/sda2      9634    9730   779152+ 83 Linux

/dev/sda3      9731   116679  859067842+  5 Extended

/dev/sda4      9112    9633   4192965  82 Linux swap / Solaris

/dev/sda5      9731    20917  89859546  83 Linux

/dev/sda6      20918    39644  150424596  83 Linux

/dev/sda7      39645    53905  114551451  83 Linux

/dev/sda8      53906    59128  41953716  83 Linux

/dev/sda9      59129    59384   2056288+  b W95 FAT32

Partition table entries are not in disk order

Command (m for help): x

Expert command (m for help): f

Done.

Expert command (m for help): r

Command (m for help): p

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes

255 heads, 63 sectors/track, 121601 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x000de20f

Device Boot   Start     End   Blocks  Id System

/dev/sda1  *      1    9111  73184076  7 HPFS/NTFS



關(guān)鍵詞:

評論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉