Ubuntu 16.04 parted 对 GPT 格式硬盘 (12 TB) 分区
Ubuntu 16.04 parted 對 GPT 格式硬盤 (12 TB) 分區
1. sudo fdisk -l
strong@foreverstrong:~$ fdisk -l fdisk: cannot open /dev/loop1: Permission denied fdisk: cannot open /dev/loop2: Permission denied fdisk: cannot open /dev/loop3: Permission denied fdisk: cannot open /dev/loop4: Permission denied fdisk: cannot open /dev/loop5: Permission denied fdisk: cannot open /dev/loop6: Permission denied fdisk: cannot open /dev/loop7: Permission denied fdisk: cannot open /dev/sda: Permission denied fdisk: cannot open /dev/sdb: Permission denied fdisk: cannot open /dev/loop8: Permission denied fdisk: cannot open /dev/loop9: Permission denied fdisk: cannot open /dev/loop10: Permission denied fdisk: cannot open /dev/loop11: Permission denied fdisk: cannot open /dev/loop12: Permission denied fdisk: cannot open /dev/sdc: Permission denied strong@foreverstrong:~$ strong@foreverstrong:~$ sudo fdisk -l [sudo] password for strong: Disk /dev/loop1: 4.2 MiB, 4403200 bytes, 8600 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop2: 160.2 MiB, 167931904 bytes, 327992 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop3: 4.2 MiB, 4403200 bytes, 8600 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop4: 54.7 MiB, 57294848 bytes, 111904 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop5: 54.7 MiB, 57294848 bytes, 111904 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop6: 44.2 MiB, 46325760 bytes, 90480 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop7: 140.7 MiB, 147501056 bytes, 288088 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: gpt Disk identifier: 02D8963C-32B7-44B4-AD89-432B577BA326Device Start End Sectors Size Type /dev/sda1 2048 2000895 1998848 976M Linux filesystem /dev/sda2 2000896 66000895 64000000 30.5G Linux swap /dev/sda3 66000896 1953523711 1887522816 900G Linux filesystemDisk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: gpt Disk identifier: ABA07FFE-B957-4A2C-B228-22D2C7DEB439Device Start End Sectors Size Type /dev/sdb1 2048 206847 204800 100M EFI System /dev/sdb2 206848 468991 262144 128M Microsoft reserved /dev/sdb3 468992 536872959 536403968 255.8G Microsoft basic data /dev/sdb4 536872960 1342179327 805306368 384G Microsoft basic data /dev/sdb5 1342179328 1953523711 611344384 291.5G Microsoft basic dataDisk /dev/loop8: 156.7 MiB, 164290560 bytes, 320880 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop9: 44.9 MiB, 47063040 bytes, 91920 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop10: 91.3 MiB, 95748096 bytes, 187008 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop11: 140.7 MiB, 147501056 bytes, 288088 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop12: 91.4 MiB, 95805440 bytes, 187120 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/sdc: 10.9 TiB, 12000138625024 bytes, 23437770752 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0x2052474d strong@foreverstrong:~$2. Disks -> 12 TB Hard Disk - /dev/sdc
3. + -> Create Partition
2.0 TB
3.0 TB
Error creating partition
4. Error: partition length of 5859373056 sectors exceeds the msdos-partition-table-imposed maximum of 4294967295
全局唯一標識分區表 (GUID Partition Table,GPT) 是一個實體硬盤分區表的結構布局標準。
GPT 是可擴展固件接口 (Extensible Firmware Interface,EFI) 標準的一部分,被用于替代 BIOS 系統中的一 32bits 來存儲邏輯塊地址和大小信息的主引導記錄 (Master Boot Record,MBR) 分區表。對于扇區為 512 字節的磁盤,MBR 分區表不支持容量大于 2.2 TB 的分區。GPT 分配 64bits 給邏輯塊地址,對于每個扇區大小為 512 字節的磁盤,可以有 9.4 ZB 或 8 ZiB 個 512 字節。
在 MBR 硬盤中,分區信息直接存儲于主引導記錄 (Master Boot Record,MBR) 中 (主引導記錄中還存儲著系統的引導程序)。但在 GPT 硬盤中,分區表的位置信息儲存在 GPT 頭中。出于兼容性考慮,硬盤的第一個扇區仍然用作 MBR,之后才是 GPT 頭。
- 如果需要分區大于 2.2 TB,則需要使用磁盤的全局唯一標識分區表 (GUID Partition Table,GPT) 格式重新建立 GPT 分區表 (parted) mklabel gpt。
- fdisk 分區最大能到 2.2 TB。fdisk 命令針對 MBR 分區進行操作,MBR 分區因為自身設計原因,不能處理大于 2.2 TB 的硬盤。
- 如果需要分區大于 2.2 TB,則需要使用 parted 來分區。
- GPT 磁盤沒有四個主分區的限制。
- Partition Table: msdos 必須修改為 (parted) mklabel gpt。
sudo parted /dev/sdc - 使用 parted 為 /dev/sdc 分區
(parted) print - 查看硬盤詳情,打印當前分區
(parted) mklabel gpt - 建立 gpt 分區表,將分區設置成 gpt 格式
(parted) mkpart primary 0TB 3TB - 建立主分區,從 0TB 到 3TB
5. (parted) rm 4
(parted) print free - 檢查硬盤空閑空間
(parted) print free Model: ATA ST12000NM0008-2H (scsi) Disk /dev/sdc: 12.0TB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags17.4kB 1049kB 1031kB Free Space1 1049kB 3000GB 3000GB primary2 3000GB 6000GB 3000GB extended3 6000GB 9000GB 3000GB extended4 9000GB 12.0TB 3000GB extended12.0TB 12.0TB 1032kB Free Space(parted) (parted) rm 4 (parted) (parted) print Model: ATA ST12000NM0008-2H (scsi) Disk /dev/sdc: 12.0TB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags1 1049kB 3000GB 3000GB primary2 3000GB 6000GB 3000GB extended3 6000GB 9000GB 3000GB extended(parted) (parted) print free Model: ATA ST12000NM0008-2H (scsi) Disk /dev/sdc: 12.0TB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags17.4kB 1049kB 1031kB Free Space1 1049kB 3000GB 3000GB primary2 3000GB 6000GB 3000GB extended3 6000GB 9000GB 3000GB extended9000GB 12.0TB 3000GB Free Space(parted) (parted) rm 3 (parted) rm 2 (parted) rm 1 (parted) (parted) print Model: ATA ST12000NM0008-2H (scsi) Disk /dev/sdc: 12.0TB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags(parted)6. (parted) mkpart extended 9TB 100%
(parted) mkpart extended 9TB 100% - 將 9TB 后的剩余空間全部創建成一個擴展分區
(parted) quit - 退出
7. 格式化分區
mkfs.ntfs 使用 0 填充了所有存儲單元。
strong@foreverstrong:~$ sudo parted /dev/sdc print [sudo] password for strong: Model: ATA ST12000NM0008-2H (scsi) Disk /dev/sdc: 12.0TB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags1 1049kB 3000GB 3000GB ntfs primary2 3000GB 6000GB 3000GB extended3 6000GB 9000GB 3000GB extended4 9000GB 12.0TB 3000GB extendedstrong@foreverstrong:~$ strong@foreverstrong:~$ sudo mkfs.ntfs /dev/sdc1 Cluster size has been automatically set to 4096 bytes. Initializing device with zeroes: 100% - Done. Creating NTFS volume structures. mkntfs completed successfully. Have a nice day. strong@foreverstrong:~$ strong@foreverstrong:~$ sudo mkntfs -f /dev/sdc2 [sudo] password for strong: The partition start sector was not specified for /dev/sdc2 and the automatically determined value is too large (5859375104). It has been set to 0. Cluster size has been automatically set to 4096 bytes. To boot from a device, Windows needs the 'partition start sector', the 'sectors per track' and the 'number of heads' to be set. Windows will not be able to boot from this device. Creating NTFS volume structures. mkntfs completed successfully. Have a nice day. strong@foreverstrong:~$ strong@foreverstrong:~$ sudo mkntfs -f /dev/sdc3 The partition start sector was not specified for /dev/sdc3 and the automatically determined value is too large (11718750208). It has been set to 0. Cluster size has been automatically set to 4096 bytes. To boot from a device, Windows needs the 'partition start sector', the 'sectors per track' and the 'number of heads' to be set. Windows will not be able to boot from this device. Creating NTFS volume structures. mkntfs completed successfully. Have a nice day. strong@foreverstrong:~$ strong@foreverstrong:~$ sudo mkntfs -f /dev/sdc4 The partition start sector was not specified for /dev/sdc4 and the automatically determined value is too large (17578125312). It has been set to 0. Cluster size has been automatically set to 4096 bytes. To boot from a device, Windows needs the 'partition start sector', the 'sectors per track' and the 'number of heads' to be set. Windows will not be able to boot from this device. Creating NTFS volume structures. mkntfs completed successfully. Have a nice day. strong@foreverstrong:~$ sudo mkfs.ext4 /dev/sdb1 sudo mkfs.ext4 /dev/sdb2 sudo mkfs.ext4 /dev/sdb3 sudo mkfs.ext4 /dev/sdb4快速格式化 - -f 參數
sudo mkntfs -f /dev/sdc1 sudo mkntfs -f /dev/sdc2 sudo mkntfs -f /dev/sdc3 sudo mkntfs -f /dev/sdc48. parted 命令
啟動 parted,選擇 /dev/sdc
strong@foreverstrong:~$ sudo parted [sudo] password for strong: GNU Parted 3.2 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) select /dev/sdc Using /dev/sdc (parted) (parted) quit strong@foreverstrong:~$ strong@foreverstrong:~$ sudo parted /dev/sdc GNU Parted 3.2 Using /dev/sdc Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) helpalign-check TYPE N check partition N for TYPE(min|opt)alignmenthelp [COMMAND] print general help, or help onCOMMANDmklabel,mktable LABEL-TYPE create a new disklabel (partitiontable)mkpart PART-TYPE [FS-TYPE] START END make a partitionname NUMBER NAME name partition NUMBER as NAMEprint [devices|free|list,all|NUMBER] display the partition table,available devices, free space, all found partitions, or a particularpartitionquit exit programrescue START END rescue a lost partition near STARTand ENDresizepart NUMBER END resize partition NUMBERrm NUMBER delete partition NUMBERselect DEVICE choose the device to editdisk_set FLAG STATE change the FLAG on selected devicedisk_toggle [FLAG] toggle the state of FLAG on selecteddeviceset NUMBER FLAG STATE change the FLAG on partition NUMBERtoggle [NUMBER [FLAG]] toggle the state of FLAG on partitionNUMBERunit UNIT set the default unit to UNITversion display the version number andcopyright information of GNU Parted (parted) quit strong@foreverstrong:~$parted 允許用戶創建主分區或拓展分區。創建這兩種類型的分區的步驟一樣,primary (主分區) 或 extended (擴展分區)。
strong@foreverstrong:~$ sudo parted -l [sudo] password for strong: Model: ATA ST1000DM010-2EP1 (scsi) Disk /dev/sda: 1000GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags1 1049kB 1024MB 1023MB ext42 1024MB 33.8GB 32.8GB linux-swap(v1)3 33.8GB 1000GB 966GB ext4Model: ATA ST1000DM010-2EP1 (scsi) Disk /dev/sdb: 1000GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags1 1049kB 106MB 105MB fat32 EFI system partition boot, esp2 106MB 240MB 134MB Microsoft reserved partition msftres3 240MB 275GB 275GB ntfs Basic data partition msftdata4 275GB 687GB 412GB ntfs Basic data partition msftdata5 687GB 1000GB 313GB ntfs Basic data partition msftdataModel: ATA ST12000NM0008-2H (scsi) Disk /dev/sdc: 12.0TB Sector size (logical/physical): 512B/4096B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flagsstrong@foreverstrong:~$總結
以上是生活随笔為你收集整理的Ubuntu 16.04 parted 对 GPT 格式硬盘 (12 TB) 分区的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【中医】札记
- 下一篇: Java-满天繁星案例(2)