1. 程式人生 > >格式化2T以上大硬碟

格式化2T以上大硬碟

https://access.redhat.com/solutions/4281

How can I create a disk partition on a disk that is greater than 2TB in size on Red Hat Enterprise Linux?

Issue     I'm trying to create a partition on my 5.4TB disk with fdisk and the partitions are not the correct size.

Environment     Red Hat Enterprise Linux

including          Red Hat Enterprise Linux 3          Red Hat Enterprise Linux 4          Red Hat Enterprise Linux 5          Red Hat Enterprise Linux 6    

Disk or LUN exceeding 2TB in size

Resolution

 The parted tool supports GPT disk labels which can be used on disks larger than 2TB.   

 The example below demonstrates how to create a 5.4TB partition:

1. Use the parted tool to access the partition table of the device:# parted /dev/sdjUsing /dev/sdjWelcome to GNU Parted! Type 'help' to view a list of commands.(parted)

2. Once at the parted prompt, create a GPT label on the disk (Note: This will remove any existingpartition table and partitions on the device):(parted)

mklabelWarning: The existing disk label on /dev/sdj will be destroyed and all data on thisdisk will be lost. Do you want to continue?Yes/No? YesNew disk label type? [gpt]? gpt(parted)

3. Use the print command to show the size of the disk as reported by parted. We need this later:(parted)

printModel: Linux device-mapper (dm)Disk /dev/sdj: 5662310.4MBSector size (logical/physical): 512B/512BPartition Table: gptNumber Start End Size File system Name Flags

4. Create a primary partition on the device. In this example, the partition will encompass the entiredisk (using size from the step above):(parted)

mkpart primary 0 5662310.4MB

5. Unlike fdisk, you do not have to write out the partition table changes with parted.

Display yournew partition and quit.(parted)

printModel: Linux device-mapper (dm)Disk /dev/mapper/VolGroup00-gpttest: 5662310.4MBSector size (logical/physical): 512B/512B

Partition Table: gptNumber      Start      End           Size           File system Name Flags

1           17.4kB     5662310.4MB   5662310.4MB          

primary(parted) quitInformation: Don't forget to update /etc/fstab, if necessary.

6. You can now create a filesystem on the device /dev/sdj1

Root Cause

The fdisk command only supports the legacy MBR partition table format (also known as msdos

partition table)        

MBR partition table do not support disks greater than 2.1TB, and therefore fdisk is also unable tocreate partition tables on these devices.         

Note that some older versions of fdisk may permit a larger size to be created but the resultingpartition table will be invalid.

     The parted command can create disk labels using MBR (msdos), GUID Partition Table (GPT), SUNdisk labels and many more types.        

The GPT disk label overcomes many of the limitations of the DOS MBR including restrictions onthe size of the disk, the size of any one partition and the overall number of partitions.         

Note that booting from a GPT labelled volume requires firmware support and this is notcommonly available on non-EFI platforms (including x86 and x86_64 architectures).