Most long-time Linux users know the fdisk
command. It has been the de-facto standard for partitioning drives for years and years. However with the advent of large capacity drives being more widely available, the need to create partitions larger than 2TB has become a necessity. Here's the easiest way I found to accomplish this.
fdisk
or parted
to modify disk or partition layouts will remove any data that is stored on them. Be sure to backup anything important before beginning any changes.Use fdisk
to get actual disk size:
It's a good idea to know the size of the drive you are working with before you start modifying things.
sda
with the ID of the drive you wish to modifyType the following:
❯ sudo fdisk -l /dev/sda
To get this information:
Disk /dev/sda: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: WDC WD40EFRX-68N
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 7A3FF4C0-4C30-4EB3-B7D9-0A1DBD5D70AC
Device Start End Sectors Size Type
/dev/sda1 2048 7814035455 7814033408 3.6T Linux filesystem
Using parted
to get past the 2TB limit:
Start parted
by typing the following:
❯ parted /dev/sda
Output:
GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
- Create the partition table/label:
(parted) mklabel gpt
Output:
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted)
- Set the units the application uses to TB's:
(parted) unit TB
- Create the 4TB partition:
(parted) mkpart primary 0.00TB 4.00TB
Print to confirm the configuration:
(parted) print
Output:
Model: ATA WDC WD40EFRX-68N (scsi)
Disk /dev/sda: 4.00TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 0.00TB 4.00TB 4.00TB ext4 primary
4: Quit and save the changes:
(parted) quit
Format the partition:
At this point, it's pretty safe to assume that you should use EXT4
as the Linux format, however you can swap over to EXT3
if necessary here.
❯ mkfs.ext4 /dev/sda1
Output:
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
183148544 inodes, 732566272 blocks
36628313 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
22357 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 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Mount the drive to a folder:
I generally mount all of my drives to the /media/XXX
folder structure, but you can use whatever you like. Suggestions are /mnt
, /disks
, /data
etc.
sudo
to mount drives for full system availability.Start off by creating the folder in question:
❯ mkdir /media/disk1
Now mount that folder to the physical drive in question:
❯ mount /dev/sda1 /media/disk1
Verify that the drive mounted properly using the df command:
❯ df -H
Output:
Filesystem Size Used Avail Use% Mounted on
...
/dev/sda1 4.0T 0G 4.0T 0% /media/disk1
Final Cleanup:
At this stage, everything should be working as planned. In order to get this drive to auto-mount to that mount point on boot, you will need to update your /etc/fstab
file and reboot. If you are looking to boot from this drive, you need to make sure that your motherboard supports booting from non-EFI devices.