Score:1

Incorrect Disk Usage Reporting on Ubuntu 22.04 Server clean install

eu flag

In an ordinary scenario , full disks space means actually full disk space with a matter of hidden/small large files somewhere. just like this form states RecoverLostDiskSpace

I know my disk uses around 4GB out of sda (50GB formatted) and 12GB on sdb (100GB formatted) but i get No space left on device

Previously -

I have a GCP VM with 2 drives, 1 with 30GB boot + an additional 100GB mounted. main drive only has ubuntu 22.04 + mysql 8.0 installed. mysql disk is pointed to the mounted disk at /mnt/disk/mysql_data

when i df -Th it reports 100% (30GB availabile + 30GB used) used on /, when i use du and ncdu it reports that only 15GB (combined with mounted disk's data) has been used at / .

so i already found out that df can confuse the mounted drive as internal.

if so with that included i should have 50% free. i tried many solutions and ended up resizing my drive from GCP to 50GB by taking a snapshot of the 30GB disk and creating a new 50GB disk with the previous image.

Before resizing

/dev/root      ext4    29G   29G     0 100% /
/dev/sdb       xfs    100G   12G   88G  12% /mnt/disks/data_disk

After resizing

/dev/root      ext4    49G   3G     0 16.3% /
/dev/sdb       xfs    100G   12G   88G  12% /mnt/disks/data_disk

Now the reading is suddenlycorrect ?? so case closed.

Now 2 weeks later im facing the same issue with 100% usage. the data on the mounted disk is still 12GB. when i try to create a file i get No space left on device

i cannot find where the missing space went??

i tried

  • looking large files
  • cleaning small files
  • cleaning logs
  • cleaning backups
  • cleaning cache
  • suggested solution

here is my df -h out put

df -ih
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/root        6.2M  122K  6.1M    2% /
tmpfs            931K     1  931K    1% /dev/shm
tmpfs            800K   633  800K    1% /run
tmpfs            931K     4  931K    1% /run/lock
/dev/sda15          0     0     0     - /boot/efi
/dev/sdb          50M  8.8K   50M    1% /mnt/disks/data_disk
tmpfs            187K    20  187K    1% /run/user/0
Marco avatar
br flag
Looks like there is `lvm` in use. Maybe an lvm-snapshot, which confuses the `df` ?
janithcooray avatar
eu flag
thanks, i didn’t even know `lvm` was. ill have to do some more research
Score:0
eu flag

Funny thing, it seems to be a bug. /temp is read incorrectly. before my solution, here is the df -h out put

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        49G   49G   17M 100% /
tmpfs           3.7G     0  3.7G   0% /dev/shm
tmpfs           1.5G  692K  1.5G   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda15      105M  5.3M  100M   5% /boot/efi
/dev/sdb        100G   13G   88G  13% /mnt/disks/data_disk
tmpfs           745M     0  745M   0% /run/user/0

As you can see tmpfs uses less than 6GB, so i never borthered to clean it since its temp files which will get deleted automatically, plus cleaning 6GB didnt make sense that it would solve the reading error.

i just stopped mysql and ran the following,

sudo rm -r /tmp/*

now

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        49G  3.3G   46G   7% /
tmpfs           3.7G     0  3.7G   0% /dev/shm
tmpfs           1.5G  692K  1.5G   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda15      105M  5.3M  100M   5% /boot/efi
/dev/sdb        100G   13G   88G  13% /mnt/disks/data_disk
tmpfs           745M     0  745M   0% /run/user/0

this explains why the storage showed free after the disk upgrade, because the /tmp gets wiped on reboot.

i'm closing this as question since its resolved using the following methods under the conclusion that its a calculation bug.

the version is

Description:    Ubuntu 22.04.1 LTS
Release:    22.04
Codename:   jammy

Update

as @Macro mentioned, /tmp is a directory on the filesystem which is not necessarily the same as tmpfs, which is a filesystem. Previously i thought that /tmp is tempfs.

Marco avatar
br flag
`/tmp` is not the same as `tmpfs`. It can be that `/tmp` is `tmpfs`, but it seems not in your case. Seems in your case `/tmp` is part of `/dev/root` and some process is filling it. You need to find out which process and fix it. Otherwise you need to reboot in short sequence.
janithcooray avatar
eu flag
yes, i found that mysql is responsible for this. i have already adjusted and fixed it. thanks.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.