新聞中心

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

        學習 Linux,101: 建設分區(qū)和文件系統(tǒng)

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

        清單 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ū)表

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

        清單 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 標志。如今,我們的硬盤尚有 Windows Master Boot Record (MBR),因而將啟動標志為 bootable 的第一個主分區(qū)(我們的示例中為 NTFS 分區(qū))。

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

        假設須要,您還能夠運用 fdisk 來修正分區(qū)表中的分區(qū)順序。這通常將會修改分區(qū)編號,因而您能夠須要完成其他任務才干將您的系統(tǒng)恢復為任務系統(tǒng)。要舉行這個修改,運用 f 子命令切換到專家方式,然后運用 r 子命令修正分區(qū)順序,如清單 10 所示。假設您只是想看看新的分區(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



        關鍵詞:

        評論


        相關推薦

        技術專區(qū)

        關閉
        主站蜘蛛池模板: 阳东县| 石渠县| 资源县| 濮阳县| 襄樊市| 江孜县| 寿宁县| 淮滨县| 凤冈县| 洛扎县| 阿坝| 平乡县| 偏关县| 广宗县| 平湖市| 左云县| 河曲县| 塔城市| 马边| 乡城县| 崇明县| 山阴县| 泸水县| 临高县| 闽侯县| 吉木萨尔县| 农安县| 长宁县| 莱西市| 望谟县| 辽阳市| 同心县| 光泽县| 团风县| 石泉县| 临泽县| 五家渠市| 湖州市| 界首市| 南城县| 厦门市|