How to create Partition larger than 2TB on RHEL6


Because you cannot create partition larger than 2TB with fdisk utility, you need to use GNU parted with GPT (http://en.wikipedia.org/wiki/File:GUID_Partition_Table_Scheme.svg).

Suppose you have a logical volume  /dev/sdb which size is 7TB. Here is the procedure on how to create a partition of 7B under Linux

1) logon as root on your system

2) launch parted utility from command line

# parted /dev/sdb
GNU Parted 2.1
Using /dev/sdb
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted)

3) Label the disk with gpt flag

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

4) Specify the unit

(parted) unit TB

5) Create the partition

(parted) mkpart primary 0.00TB 7.20TB

or

(parted) mkpart primary 0 7

6) verify the partition was created successfully

(parted) p
Model: LSI RAID 5/6 SAS 6G (scsi)
Disk /dev/sdb: 7.20TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 0.00TB 7.20TB 7.20TB primary

7) exit from parted utility. When you exit from parted, it will automatically save the configuration and label the disk automatically

(parted) quit
Information: You may need to update /etc/fstab.

8) Re-read the partition table

# partprobe /dev/sdb

9) Print the partition table again

# parted /dev/sdb print
Model: LSI RAID 5/6 SAS 6G (scsi)
Disk /dev/sdb: 7196GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 1049kB 7196GB 7196GB primary

10) format the partition in ext4

# mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
439230464 inodes, 1756909568 blocks
87845478 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
53617 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

11) verify the blockID

# blkid
/dev/sda1: UUID=”a1766d87-966f-4dab-ac66-c0849fed93dd” TYPE=”ext4″
/dev/sda2: UUID=”9e45fb76-52d0-4354-8dee-a48ac96a87ef” TYPE=”swap”
/dev/sda3: UUID=”dd865595-70de-493f-80f7-3acfe502f584″ TYPE=”ext4″
/dev/sda5: UUID=”3d83eb71-4cd5-409b-8a7c-52f2cbb80bb7″ TYPE=”ext4″
/dev/sdb1: UUID=”d55ca767-3199-4c17-983c-c6598e3e7a4b” TYPE=”ext4″

12) Label the disk (you can name as you want, i have labelled it ‘SPData’

[root@linwbp32 ~]# e2label /dev/sdb1 SPData

13) verify it has been labelled correctly with blkid and findfs command
# blkid
/dev/sda1: UUID=”a1766d87-966f-4dab-ac66-c0849fed93dd” TYPE=”ext4″
/dev/sda2: UUID=”9e45fb76-52d0-4354-8dee-a48ac96a87ef” TYPE=”swap”
/dev/sda3: UUID=”dd865595-70de-493f-80f7-3acfe502f584″ TYPE=”ext4″
/dev/sda5: UUID=”3d83eb71-4cd5-409b-8a7c-52f2cbb80bb7″ TYPE=”ext4″
/dev/sdb1: UUID=”d55ca767-3199-4c17-983c-c6598e3e7a4b” TYPE=”ext4″ LABEL=”SPData”
# findfs LABEL=SPData
/dev/sdb1

14) create a mount point call ‘Data’

# mkdir /Data

15) mount the partition on /Data and verify the diskspace

# mount LABEL=SPData /data
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 25G 1.3G 22G 6% /
tmpfs 71G 0 71G 0% /dev/shm
/dev/sda1 194M 31M 154M 17% /boot
/dev/sda5 28G 297M 26G 2% /var
/dev/sdb1 6.5T 181M 6.2T 1% /data

16) Add the following lines in /etc/fstab

LABEL=SPData /data                    ext4    defaults,nodev       1 2

17) reboot your system and make sure SPData is mounted on /Data properly

#init 6

Your’re done!

Comments are closed.