bjrod20
Posts: 2
Joined: Sat Apr 18, 2015 4:33 am

2TB HD ext4 showing only 1.8TB available

Sat Apr 18, 2015 5:00 am

Hi. First post and a noob question - sorry if this is posted to the wrong section.

I'm trying to set up a RPi2 as a backup server. I had a 2TB HD formatted as Mac OS Extended (Journaled) that I reformatted in the Mac to MS DOS. I attached it to the RPi2, and using the instructions at http://blog.amitparekh.com/?p=31, I formatted the drive as ext4, however, the drive is now showing only a 1.8TB partition.

How do I make the partition use the whole 2TB?

If it helps, the following is shown in the various disk utilities:

Code: Select all

sudo blkid
/dev/sda1: LABEL="disk1" UUID="[edit]" TYPE="ext4"


sudo fdisk -l
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
81 heads, 63 sectors/track, 765633 cylinders, total 3907029168 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 identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048  3907029167  1953513560   83  Linux


sudo parted -l
Model: WDC WD20 EARX-00PASB0 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  2000GB  2000GB  primary  ext4


sudo sfdisk -l -uM
Disk /dev/sda: 243201 cylinders, 255 heads, 63 sectors/track
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start   End    MiB    #blocks   Id  System
/dev/sda1         1  1907729- 1907729- 1953513560   83  Linux
/dev/sda2         0      -      0          0    0  Empty
/dev/sda3         0      -      0          0    0  Empty
/dev/sda4         0      -      0          0    0  Empty


sudo cfdisk
Partition Table for /dev/sda

         ---Starting----      ----Ending-----    Start     Number of
 # Flags Head Sect  Cyl   ID  Head Sect  Cyl     Sector    Sectors
-- ----- ---- ---- ----- ---- ---- ---- ----- ----------- -----------
 1  0x00   32   33     0 0x83   62   63 765633        2048  3907027120
 2  0x00    0    0     0 0x00    0    0     0           0           0
 3  0x00    0    0     0 0x00    0    0     0           0           0
 4  0x00    0    0     0 0x00    0    0     0           0           0


lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0   1.8T  0 disk
└─sda1        8:1    0   1.8T  0 part /media/disk1


df -h
Filesystem                 Size  Used Avail Use% Mounted on
rootfs                     7.2G  496M  6.4G   8% /
/dev/root                  7.2G  496M  6.4G   8% /
devtmpfs                   484M     0  484M   0% /dev
tmpfs                       98M  228K   98M   1% /run
tmpfs                      5.0M     0  5.0M   0% /run/lock
tmpfs                      195M     0  195M   0% /run/shm
/dev/mmcblk0p1              48M   15M   34M  30% /boot
/dev/sda1                  1.8T  1.7T   99M 100% /media/disk1
tmpfs                      195M     0  195M   0% /tmp

User avatar
xoopha
Posts: 106
Joined: Mon Feb 09, 2015 9:52 pm

Re: 2TB HD ext4 showing only 1.8TB available

Sat Apr 18, 2015 1:59 pm

2 terabytes = 2000 gigabytes = 1.81 binary terabytes, which is what the computer reports.
Last edited by xoopha on Sat Apr 18, 2015 11:21 pm, edited 1 time in total.

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: 2TB HD ext4 showing only 1.8TB available

Sat Apr 18, 2015 3:19 pm

Look at the difference between KB and KiB, MB and MiB and TB & TiB.

One set of measures use multiples of base 2. 1Ki = 1024, 1Mi = 1024*1024, 1Ti = 1024*1024*1024
The other set of measures use multiples of base 10. 1K = 1000, 1M = 1000*1000, 1T = 1000*1000*1000

It's done to confuse, it's done so that the marketing dept. for the disk makers can sell a drive as 2TB when it only holds 1.8TiB.

It works much the same way that items get priced at £19.99 rather than £20 (or £19 19s 6d in old money before Feb 1971). The confusion plays against the punter who's buying the short measure for a penny lower price.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
mikronauts
Posts: 2783
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: 2TB HD ext4 showing only 1.8TB available

Sat Apr 18, 2015 10:26 pm

The posts are correct, disk capacity is reported in interesting ways. You may still be able to recover some reserved space.

Normally, mkfs reserves 5% of the drive for root, which makes sense when the drive is the root partition (so log files can still be written when a user fills the disk)

sudo tune2fs -m 0 /dev/sdaXXXXXX

recovers the reserved space.

For more on tune2fs see http://www.unixtutorial.org/commands/tune2fs/
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

bjrod20
Posts: 2
Joined: Sat Apr 18, 2015 4:33 am

Re: 2TB HD ext4 showing only 1.8TB available

Sun Apr 19, 2015 3:12 am

Many thanks for your responses. It seems obvious now in hindsight. From you pointing me in the right direction I've also learnt that if I'd used df --si or df -H it would have given me the figures in powers of 1000 not 1024.
mikronauts wrote:You may still be able to recover some reserved space.
sudo tune2fs -m 0 /dev/sdaXXXXXX
This is interesting to know. Thanks.

Return to “Beginners”