UnixServerAdmin

Server Administration & Management

How to create a Partition Size Larger Than 2TB

We can’t create a Linux partition larger than 2 TB using the fdisk command. The fdisk won’t create partitions larger than 2 TB. This is fine for desktop and laptop users, but on server you need a large partition. For example, you can’t create 3TB or 4TB partition size (RAID based) using the fdisk command. It will not allow you to create a partition that is greater than 2TB.

To solve this problem use GNU parted command with GPT. It supports Intel EFI/GPT partition tables. Partition Table (GPT) is a standard for the layout of the partition table on a physical hard disk. It is a part of the Extensible Firmware Interface (EFI) standard proposed by Intel as a replacement for the outdated PC BIOS, one of the few remaining relics of the original IBM PC. EFI uses GPT where BIOS uses a Master Boot Record (MBR).

Linux GPT Kernel Support :- EFI GUID Partition support works on both 32bit and 64bit platforms. You must include GPT support in kernel in order to use GPT. If you don’t include GPT support in Linux kernel, after rebooting the server, the file system will no longer be mountable or the GPT table will get corrupted. By default RHEL/ CentOS comes with GPT kernel support. However, if you are using Debian or Ubuntu Linux, you need to recompile the kernel. Set CONFIG_EFI_PARTITION to y to compile this feature.

1. Find Out Current Disk Size, using the following command :-

# fdisk -l /dev/mapper/mpathbp

Sample outputs:
Disk /dev/mapper/mpathp: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

2. Linux Create 3TB partition size, To create a partition start GNU parted as follows :-

# parted /dev/mapper/mpathbp

Output:
GNU Parted 2.3
Using /dev/mapper/mpathbp
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted)

3. Creates a new GPT disklabel i.e. partition table :-

(parted) mklabel gpt

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

4. Next, set the default unit to TB, enter:

(parted) unit TB

5. To create a 3TB partition size, enter:

(parted) mkpart primary 0 0

OR

(parted) mkpart primary 0.00TB 3.00TB

6. To print the current partitions, enter:

(parted) print

Sample outputs:
Model: ATA ST33000651AS (scsi)
Disk /dev/mapper/mpathbp: 3.00TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start   End     Size    File system  Name     Flags
 1      0.00TB  3.00TB  3.00TB  ext4         primary

Quit and save the changes, enter:

(parted) quit

Sample outputs:
Information: You may need to update /etc/fstab.

7. Use the mkfs.ext3 or mkfs.ext4 command to format the file system, enter :-

# mkfs.ext4 /dev/mapper/mpathbp1

8. Type the following commands to mount /dev/mapper/mpathbp1, enter :-

# mkdir /datasrv
# mount   /dev/mpathbp1   /datasrv
# df -hT

9. Edit in /etc/fstab file during Booting Process for Mounting.

# vim /etc/fstab

/dev/mapper/mpathbp1    /backup        ext4    defaults    1    0

Note :- Make sure you replace /dev/mapper/mpathbp1 with actual RAID or Disk name or Block Ethernet device such as /dev/etherd/e0.0. Do not forget to update /etc/fstab, if necessary. Also note that booting from a GPT volume requires support in your BIOS / firmware. This is not supported on non-EFI platforms. We suggest you, boot server from another disk such as IDE / SATA / SSD disk and store data on /datasrv.

Advertisements

July 6, 2013 - Posted by | SAN, Tips & Tricks, Unix/Linux | , , ,

1 Comment »

  1. Its always advantageous to learn guidelines like you talk about for blog posting. As I just began posting comments for blog and facing problem associated with lots of denials. I think your own suggestion would be helpful for us. I will tell you if its work with me as well.

    Comment by ewan | August 4, 2013 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: