# Ubuntu, formatting a 3TB drive

December 28, 2014 · Josh Strange · Tags: 3TB, archive, command, drive, ext4, formatting, hard, line, linux, ubuntu

Source: https://joshstrange.com/2014/12/28/ubuntu-formatting-a-3tb-drive/




There was a blog post that I have used multiple times to format a drive at or over 3TB in size. Unfortunately the original blog post recently went offline and I had to use the wayback machine to get it’s contents. The original URL of the post is: [here](http://amaras-tech.co.uk/article/158/Ubuntu,_formatting_a_3TB_drive) and a link to the wayback machine archive of it is: [here](https://web.archive.org/web/20130723053426/http://amaras-tech.co.uk/article/158/Ubuntu,_formatting_a_3TB_drive). If the original author puts the article back online I would be more than happy to link to it and remove the archived version I have posted below. I hope this helps other people as well but I am posting it here mainly as a guide for myself.

TL;DR:

1. `lsblk` to find the drive name (will be something like `/dev/sdX` where X is a letter)
2. `sudo parted /dev/sdX`
3. In the parted interactive console type:
   1. `(parted) mklabel gpt`
   2. `(parted) unit TB`
   3. `(parted) mkpart primary 0.00TB 3.00TB` (Changing `3.00TB` to the size of your drive)
   4. `(parted) quit`
4. `sudo mkfs.ext4 /dev/sdX1` (Where X is the same as above and note the “1” now)
5. `sudo tune2fs -m 1 /dev/sdX1`
6. `mkdir /Your/Mount/Point/Here`
7. `sudo blkid` (Copy the UUID of your drive)
8. `sudo nano /etc/fstab`
9. Add the line `UUID=YOUR-UUID-HERE-XXXX /Your/Mount/Point/Here ext4 defaults 1 2` then save and exit
10. `sudo mount -a`

Your drive will be partitioned, formatted as ext4, and mounted.

Below is the original article:

I started off following [the ubuntu guide for installing a new drive](https://web.archive.org/web/20130723053426/https://help.ubuntu.com/community/InstallingANewHardDrive), which uses fdsik to create the partitions how ever after formatting and mounting I ran `df -h:`

```
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       2.0T   28G  1.9T   2% /mnt/kryten/disk5
```

## Which is not 3TB

I then found [this article](https://web.archive.org/web/20130723053426/http://www.cyberciti.biz/tips/fdisk-unable-to-create-partition-greater-2tb.html) which worked in the long run not sure if I typo’d a command but similar to [this other user](https://web.archive.org/web/20130723053426/http://archlinuxarm.org/forum/viewtopic.php?t=1935&p=10490) I had to run through the commands a second time for them to work.

To start with use `parted` instead of fdisk, this allows the gpt partition table that fdisk does not.

```
(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) unit TB 
(parted) mkpart primary 0.00TB 3.00TB                                     
Warning: You requested a partition from 0.00TB to 3.00TB.                 
The closest location we can manage is 0.00TB to 0.00TB.
Is this still acceptable to you?
Yes/No? yes
```

basically after this point it showed up as a few KB after formatting, tried it again and it seemed to work much better.

```
(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) unit TB                                                          
(parted) mkpart primary 0.00TB 3.00TB                                     
(parted) print                                                            
odel: Unknown (unknown)
Disk /dev/sdb1: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop

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

(parted) quit                                                             
Information: You may need to update /etc/fstab.
```

## Format

```sh
$ sudo mkfs.ext4 /dev/sdb1
$sudo parted /dev/sdb1
(parted) print
Model: Unknown (unknown)
Disk /dev/sdb1: 3001GB 
Sector size (logical/physical): 512B/4096B
Partition Table: loop

Number  Start  End     Size    File system  Flags
1      0.00B  3001GB  3001GB  ext4
```

## Reduce Reserved Space

By default 5% is reserved for the root to stop the driving becoming unusable when full, for data and not the main OS drive this does not matter too much, and 5% was decided when drives where much small. 5% of 3TB is 150 GB, way too much. Turn this down to 1% with:

```sh
sudo tune2fs -m 1 /dev/sdb1
```

## Mount

```sh
sudo mkdir /mnt/kryten/disk5 
sudo mount /dev/sdb1 /mnt/kryten/disk5
```

## Find UUID

```sh
$ sudo blkid
/dev/sda1: UUID="c41cba49-bd3a-41d7-961c-b4ad45d48ed1" TYPE="ext4" 
/dev/sdb1: UUID="d822c6af-9802-4d00-8de8-61f1653a854a" TYPE="ext4" 
/dev/sdc1: UUID="59a61ceb-fee3-460a-97c5-e9f115776daf" TYPE="ext4" 
/dev/sdc5: UUID="80f9c384-9a5a-4563-921a-5c25628e1b2e" TYPE="swap"
```

## Update /etc/fstab

```
$sudo vim /etc/fstab

#/dev/sdb1 3TB drive replacing 1.5TB old UUID Below
UUID=d822c6af-9802-4d00-8de8-61f1653a854a     /mnt/kryten/disk4 ext4 rw,auto,user,exec,async,errors=remount-ro 0 1
#UUID=c41cba49-bd3a-41d7-961c-b4ad45d48ed1    /mnt/kryten/disk4 ext4 rw,auto,user,exec,async,errors=remount-ro 0 1
```


---

**Authorship** · I write all content on this blog myself. I may use LLMs for review and feedback, but never to author the content.

