0

I have a Virtual Machine that has 3 disks. The third one is 150Go size, I get this with sudo fdisk -l /dev/sdc:

/dev/sdc1            2048   314572799   157285376   83  Linux

However, df command returns only half of this disk:

/dev/sdc1       78609980 71274061   7335919  91% /mnt/data

How is that possible?

Update

sudo fdisk -l /dev/sdc

Disk /dev/sdc: 161.1 GB, 161061273600 bytes 3 têtes, 8 secteurs/piste, 
13107200 cylindres, total 314572800 secteurs Unités = secteurs de 1 * 512 = 
512 octets Taille de secteur (logique / physique) : 512 octets / 512 octets 
taille d'E/S (minimale / optimale) : 512 octets / 512 octets Identifiant de 
disque : 0x557ee3ef

Périphérique Amorce  Début        Fin      Blocs     Id  Système 
/dev/sdc1             2048   314572799   157285376   83  Linux

df -k /dev/sdc1 returns this:

Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sdc1       78609980 71279103   7330877  91% /mnt/data

df -h /dev/sdc1 gets this:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sdc1        75G   68G  7.0G  91% /mnt/data

POSIXLY_CORRECT=1 df /dev/sdc1 gets this:

Filesystem     512B-blocks      Used Available Use% Mounted on
/dev/sdc1        157219960 142558210  14661750  91% /mnt/data

Update 2

lsblk gets this:

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  1024M  0 rom
sda      8:0    0    12G  0 disk
├─sda1   8:1    0  11,5G  0 part /
├─sda2   8:2    0     1K  0 part
└─sda5   8:5    0   487M  0 part [SWAP]
sdb      8:16   0    30G  0 disk
└─sdb1   8:17   0    30G  0 part
sdc      8:32   0   150G  0 disk
└─sdc1   8:33   0   150G  0 part /mnt/data

Updtae 3

I got this running tune2fs -l:

Inode count:              104857600
Block count:              104857600
Reserved block count:     0
5
  • @KamilMaciorowski I don't really understand what you mean. Here is the content of /etc/fstab: /dev/sdc1 /mnt/data ext4 user,noatime 0 2
    – watou
    Commented Sep 11, 2018 at 9:54
  • @KamilMaciorowski I updated the question
    – watou
    Commented Sep 11, 2018 at 11:10
  • What is Block size in the output of tune2fs -l? Commented Sep 11, 2018 at 12:46
  • Block size: 1024
    – watou
    Commented Sep 11, 2018 at 13:35
  • 1
    According to this your filesystem as a whole takes exactly 100 GiB. It doesn't take the whole partition then. Why df reports so little total size, this I don't know (yet). Commented Sep 11, 2018 at 14:21

1 Answer 1

1

The partition is indeed about 150 GiB in size and it takes practically the whole device.

In fdisk the columns Start and End (Début and Fin in your case) are measured in sectors. A sector is 512 bytes in your case. The column Blocks however uses 1 KiB unit, quite confusing. If it said Sectors instead, the unit would be 512 B as well. I believe newer versions of fdisk use sectors. Compare this old question.


Note: I know from your comment the filesystem is ext4.


Maybe...

Maybe your filesystem is not as big as the partition. Somebody has created it smaller; or the partition used to be smaller and it got expanded without expanding the filesystem later.

A filesystem smaller than its partition is possible (yet rather uncommon). See man mkfs.ext4, fs-size parameter.

Now you have two options to reclaim the missing part of your disk space:

  • Investigate how big exactly the filesystem is; shrink the partition (not too much!); create additional partition(s) and filesystem(s).
  • Enlarge the filesystem with resize2fs. Make sure your Ubuntu can do this (12.04 is quite old, it's beyond my expertise to tell whether or not it's relevant).

The second option seems safer and less error-prone. I think resize2fs can detect the size of the partition and enlarge your filesystem to the maximum, so you don't have to calculate anything. Read the manual before you proceed.


Or maybe...

Or maybe the filesystem is as big as the partition but it reserves about 50% of its size for root. Use tune2fs -l to investigate. Compare Reserved block count to Block count. See this answer.

You can change the reserved percentage with tune2fs -m or tune2fs -r. See this answer.

1
  • I updated the question. Reserved block count = 0 !
    – watou
    Commented Sep 11, 2018 at 12:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .