November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Creating a partition size larger than 2TB on Linux

I had to mount and use a 3TB SATA HD on Linux, and as I thought, I wasn’t going to be able to format and create a new partition using fdisk command.

fdisk tool won’t create partitions larger than 2 TB. This is fine for desktop users, but on a production server you may need a large partition.

The way to solve this issue was to use GNU parted command with GPT (partition table). This is the full how to in case you need it:

Create 3TB partition size on Linux

Run gparted as follows, replace sdb with your real disk name:

parted /dev/sdb
Output:

GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted)
Now type “mklabel gpt“, as you see below:

(parted) mklabel gpt
Output should be something like this:

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)
Now, let’s set default size unit to TB, type “unit TB” and press enter:

(parted) unit TB
Type: mkpart primary 0.00TB 3.00TB to create a 3TB partition:

(parted) mkpart primary 0.00TB 3.00TB
To print the current partitions, type p :

(parted) p
Sample outputs:

Disk /dev/sdb: 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
Now type quit to exit the gparted console.

(parted) quit
Now format the new patition:

mkfs.ext4 /dev/sdb1
Mount the new drive:

mkdir /mnt/appdisk
mount /dev/sdb1 /mnt/appdisk
Now add that mount point to /etc/fstab, example:

/dev/sdb1 /mnt/appdisk ext4 defaults 0 1
Now type df -ah to see if the drive is mounted properly, you should see something like this:

/dev/sdb1 3.0T 321M 2.9T 1% /mnt/appdisk

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>