Using GNU parted to create a GPT for a device > 2TB
Howto create a partitioned device on a CentOS v5 VM for a XFS filesystem greater than 2TB in size
Using a MBR (master boot record) style partition table it is not possible to have a partition larger than 2TB. Use a GPT (Guid Partition table) to overcome this limitation.
# parted /dev/xvdc (parted) mklabel gpt (parted) mkpart primary xfs 0 -0 (parted) quit
And create the XFS filesystem with a label of '/files'.
# mkfs.xfs -L /files /dev/xvdc1
Links
- parted manual
- mklabel command
- mkpart command
- GPT (wikipedia)
- Waikato LUG
Appendices
GPT label, parted output (no filesystem)
Once the filesystem was created, the 'File system' column shows XFS.
(parted) print Model: Xen Virtual Block Device (xvd) Disk /dev/xvdc: 3588GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 17.4kB 3588GB 3588GB primary
MBR partition table fdisk output
Note: The first partition is 2TB in size.
# fdisk /dev/xvdc Command (m for help): p Disk /dev/xvdc: 3588.4 GB, 3588491313152 bytes 255 heads, 63 sectors/track, 436275 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/xvdc1 1 267349 2147480811 83 Linux
# parted /dev/xvdc GNU Parted 1.8.1 Using /dev/xvdc Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print Model: Xen Virtual Block Device (xvd) Disk /dev/xvdc: 3588GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 32.3kB 2199GB 2199GB primary xfs