龙空技术网

fdisk无法创建超过2T的分区

有灵魂的程序猿 197

前言:

此刻大家对“磁盘大于2t分区”大概比较注意,你们都需要知道一些“磁盘大于2t分区”的相关资讯。那么小编在网上网罗了一些有关“磁盘大于2t分区””的相关内容,希望小伙伴们能喜欢,朋友们一起来学习一下吧!

解决方法:使用parted工具

fdisk创建超过2T分区报错

Last sector, +sectors or +size{K,M,G,T,P} (2048-4294967294, default 4294967294): +3T Value out of range.Last sector, +sectors or +size{K,M,G,T,P} (2048-4294967294, default 4294967294): +2TValue out of range.Last sector, +sectors or +size{K,M,G,T,P} (2048-4294967294, default 4294967294): ^CCommand (m for help): nPartition type   p   primary (0 primary, 0 extended, 4 free)   e   extended (container for logical partitions)Select (default p): ^Z[1]+  Stopped                 sudo fdisk /dev/sda

MBR分区支持最大容量

MBR分区方案为逻辑扇区数的位数设置了32位的限制,因此最大只能表示2^32个扇区,即4,294,967,296个扇区。

每个扇区大小为512字节,所以能够寻址的总大小为4,294,967,296 * 512 = 2,199,023,255,552字节。将其转换为其他单位,即2,147,483,648千字节(KB),2,097,152兆字节(MB),2,048千兆字节(GB),即2TB。

fdisk工具使用说明

查看分区:fdisk -l

root@bsp-PowerEdge-R6525:~# fdisk -lDisk /dev/loop0: 4 KiB, 4096 bytes, 8 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop1: 2.4 MiB, 2555904 bytes, 4992 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop2: 276 KiB, 282624 bytes, 552 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes

指定设备:sudo fdisk /dev/sda

arron@bsp-PowerEdge-R6525:~$ sudo fdisk /dev/sdaWelcome to fdisk (util-linux 2.31.1).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.The size of this disk is 10.9 TiB (12000138625024 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).Command (m for help): mHelp:DOS (MBR)a toggle a bootable flagb edit nested BSD disklabelc toggle the dos compatibility flagGenericd delete a partitionF list free unpartitioned spacel list known partition typesn add a new partitionp print the partition tablet change a partition typev verify the partition tablei print information about a partitionMiscm print this menuu change display/entry unitsx extra functionality (experts only)ScriptI load disk layout from sfdisk script fileO dump disk layout to sfdisk script fileSave & Exitw write table to disk and exitq quit without saving changesCreate a new labelg create a new empty GPT partition tableG create a new empty SGI (IRIX) partition tableo create a new empty DOS partition tables create a new empty Sun partition table

打印分区

Command (m for help): pDisk /dev/sda: 10.9 TiB, 12000138625024 bytes, 23437770752 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisklabel type: dosDisk identifier: 0x9183ef4cDevice Boot Start End Sectors Size Id Type/dev/sda1 2048 4294967295 4294965248 2T 83 Linux

删除分区:Command (m for help): d

Command (m for help): dSelected partition 1Partition 1 has been deleted.

创建分区:Command (m for help): n

Command (m for help): nPartition type   p   primary (0 primary, 0 extended, 4 free)   e   extended (container for logical partitions)Select (default p): pPartition number (1-4, default 1): First sector (2048-4294967295, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-4294967294, default 4294967294): Created a new partition 1 of type 'Linux' and of size 2 TiB.Command (m for help): wThe partition table has been altered.Calling ioctl() to re-read partition table.Syncing disks.

格式化分区

arron@bsp-PowerEdge-R6525:~$ sudo mkfs.ext4 /dev/sda1mke2fs 1.44.1 (24-Mar-2018)Creating filesystem with 2621440 4k blocks and 655360 inodesFilesystem UUID: 15cb0878-9612-4e7c-8ec0-c04438316443Superblock backups stored on blocks:32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632Allocating group tables: doneWriting inode tables: doneCreating journal (16384 blocks): doneWriting superblocks and filesystem accounting information: donearron@bsp-PowerEdge-R6525:~$arron@bsp-PowerEdge-R6525:~$arron@bsp-PowerEdge-R6525:~$arron@bsp-PowerEdge-R6525:~$ lsblk -o NAME,UUIDNAME UUIDsda└─sda1 15cb0878-9612-4e7c-8ec0-c04438316443sdb├─sdb1 C4C0-68BF└─sdb2 c5719637-568b-4394-b0f6-aa0f5db379de

parted工具使用说明

列出分区:parted -l

root@bsp-PowerEdge-R6525:~# parted -lModel: ATA ST12000NM001G-2M (scsi)Disk /dev/sda: 12.0TBSector size (logical/physical): 512B/4096BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags1 17.4kB 10.0TB 10000GB ext4 /dev/sda1Model: ATA TOSHIBA MG04ACA2 (scsi)Disk /dev/sdb: 2000GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags1 1049kB 538MB 537MB fat32 EFI System Partition boot, esp2 538MB 2000GB 2000GB ext4root@bsp-PowerEdge-R6525:~#

打开设备:sudo parted /dev/sda

arron@bsp-PowerEdge-R6525:~$ sudo parted /dev/sdaGNU Parted 3.2Using /dev/sdaWelcome to GNU Parted! Type 'help' to view a list of commands.

help打印:(parted) m

(parted) malign-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 onpartition NUMBERunit UNIT set the default unit to UNITversion display the version number andcopyright information of GNU Parted

打印分区:(parted) p

(parted) pModel: ATA ST12000NM001G-2M (scsi)Disk /dev/sda: 12.0TBSector size (logical/physical): 512B/4096BPartition Table: msdosDisk Flags:Number Start End Size Type File system Flags1 1049kB 10.7GB 10.7GB primary ext4

创建gpt:(parted) mklabel gpt

(parted) mklabel gptWarning: The existing disk label on /dev/sda will be destroyed and all data onthis disk will be lost. Do you want to continue?Yes/No? yes

创建分区:(parted) mkpart /dev/sda1

(parted) mkpart /dev/sda1File system type?  [ext2]? ext4                                           Start? 0                                                                  End? 10T                                                                  Warning: The resulting partition is not properly aligned for best performance.Ignore/Cancel? Ignore                                                     (parted) print                                                            Model: ATA ST12000NM001G-2M (scsi)Disk /dev/sda: 12.0TBSector size (logical/physical): 512B/4096BPartition Table: gptDisk Flags: Number  Start   End     Size     File system  Name       Flags 1      17.4kB  10.0TB  10000GB  ext4         /dev/sda1

标签: #磁盘大于2t分区 #分区最大2tb