Create Linux partition larger than 2 TB.

You cannot create a Linux partition larger than 2 TB using f disk command. It will not allow you to create a partition that is greater than 2 TB. You can create it using parted utility. Please follow the below steps.

STEP 1:- Find out the current disk size.
[root@localhost ~]# fdisk -l /dev/sdb
Disk /dev/sdb: 4000.0 GB, 3999956729856 bytes
255 heads, 63 sectors/track, 486300 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
Disk /dev/sdb doesn't contain a valid partition table

STEP 2:- Create 4 TB partition.
[root@localhost ~]# parted /dev/sdb
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

STEP 3:- Create a new GPT partition table.
(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)

STEP 4:- Set the default unit to TB.
(parted) unit TB

STEP 5:- Create a 4 TB partition.
(parted) mkpart primary 0 0

STEP 6:- Print the current partitions.
(parted) print
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

STEP 7:- Save changes and exit.
(parted) quit
Information: You may need to update /etc/fstab.

STEP 8:- Format the file system
[root@localhost ~]# mkfs.ext4 /dev/sdb1

STEP 9:- Mount the /dev/sdb1
[root@localhost ~]# mkdir /data
[root@localhost ~]# mount /dev/sdb1 /data
[root@localhost ~]# df -H
Filesystem             Size   Used  Avail Use% Mounted on
/dev/sda1              391G   8.5G   363G   3% /
tmpfs                   51G      0    51G   0% /dev/shm
/dev/sdb1
                       4.0T    211M   3.9T   1% /data

That’s it...

No comments:

Post a Comment