How to create a larger than 2TB partition in Linux

0
3730

Usually Linux administrators are used to create partition using fdisk which is probably the most used tool for disk partitioning. But now a days disk requirements are too high that sometimes need larger than 2 TB partition and unfortunately fdisk would not able to create partition larger than 2 TB.

 

to solve this, we can use parted command and below are the steps to create a 4 TB partition.

Find Out Current Disk Size

Type the following command:
# fdisk -l /dev/sdb
Sample outputs:

Disk /dev/sdb: 4398.0 GB, 4398046511104 bytes, 8589934592 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdb doesn't contain a valid partition table

now create 4TB partition size

To create a partition start GNU parted as follows:
# parted /dev/sdb
Output:

GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

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

(parted) mklabel gpt

Sample outputs:

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)

Next, set the default unit to TB, enter:

(parted) unit TB

To create a 3TB partition size, enter:

(parted) mkpart primary 0 0

OR

(parted) mkpart primary 0.0GB 4398.0GB

To print the current partitions, enter:

(parted) print

Sample outputs:

Model: ATA ST33000651AS (scsi)
Disk /dev/sdb: 4.00TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

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

Quit and save the changes, enter:

(parted) quit

Sample outputs:

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

Use the mkfs.ext3 or mkfs.ext4 command to format the file system, enter:
# mkfs.ext3 /dev/sdb1
OR
# mkfs.ext4 /dev/sdb1

Type the following commands to mount /dev/sdb1, enter:

# mkdir /data
# mount /dev/sdb1 /data

to add permanent mount point add below to fstab:

# vim /etc/fstab

add below line at the end of fstab file :
/dev/sdb1 /data ext4 defaults,noatime,dirsync 0 0

LEAVE A REPLY