LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 04-29-2022, 10:39 PM   #1
Johng
Member
 
Registered: Feb 2002
Location: NZ
Distribution: Kubuntu, Mint
Posts: 411

Rep: Reputation: 31
Partition full, but files make up only half partition size


I have a partition which gparted reports is 228GB with 1.5GB free

Using the Disk usage app in Linux Mint 20.3, the files total only 118.8GB, which I believe to be the true size.

Running e2fsck I get:
Code:
mint@mint:~$ sudo e2fsck -f /dev/sda2 
e2fsck 1.45.5 (07-Jan-2020)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda2: 631943/14942208 files (0.6% non-contiguous), 56405689/59767552 blocks
Where do I go from here?
 
Old 04-29-2022, 11:01 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,384

Rep: Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190
Start by showing relevant info. This will get us started.
Code:
df -hT
lsblk -f
Partitons ain't filesystems although they are inextricably inked.
 
1 members found this post helpful.
Old 04-29-2022, 11:30 PM   #3
Johng
Member
 
Registered: Feb 2002
Location: NZ
Distribution: Kubuntu, Mint
Posts: 411

Original Poster
Rep: Reputation: 31
Thank you syg00

Code:
chris@chris-H61M-USB3-B3:~$ df -hT
df: /run/user/1000/doc: Operation not permitted
Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs  1.9G     0  1.9G   0% /dev
tmpfs          tmpfs     385M  1.4M  384M   1% /run
/dev/sda2      ext4      224G  211G  2.1G 100% /
tmpfs          tmpfs     1.9G     0  1.9G   0% /dev/shm
tmpfs          tmpfs     5.0M  4.0K  5.0M   1% /run/lock
tmpfs          tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs          tmpfs     385M   16K  385M   1% /run/user/1000
/dev/sdf1      vfat      1.9G   24M  1.9G   2% /media/chris/ADATA-2GB
chris@chris-H61M-USB3-B3:~$
Code:
chris@chris-H61M-USB3-B3:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 232.9G  0 disk 
├─sda2   8:2    0   228G  0 part /
└─sda3   8:3    0   4.9G  0 part [SWAP]
sdf      8:80   1   1.9G  0 disk 
└─sdf1   8:81   1   1.9G  0 part /media/chris/ADATA-2GB
sr0     11:0    1  1024M  0 rom  
chris@chris-H61M-USB3-B3:~$
 
Old 04-30-2022, 01:17 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,253

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Code:
/dev/sda2      ext4      224G  211G  2.1G 100% /
It is full (obviously). That disk usage app might miss something, I don't really know, but df cannot lie.
You can use some tools to find out what is it, for example ncdu. But do it as root and without gui. Don't forget about hidden (dotted) files/dirs.
 
Old 04-30-2022, 01:53 AM   #5
Johng
Member
 
Registered: Feb 2002
Location: NZ
Distribution: Kubuntu, Mint
Posts: 411

Original Poster
Rep: Reputation: 31
It is full (obviously). ??

Running ncdu:

Quote:
Total disk usage: 100.5 GiB Apparent size: 100.3 GiB Items: 118993
 
Old 04-30-2022, 02:54 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,253

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
yes, ncdu missed again some files. Most probably those hidden files. But without details hard to say more.
 
Old 04-30-2022, 03:15 AM   #7
suramya
Member
 
Registered: Jan 2022
Location: Earth
Distribution: Debian
Posts: 249

Rep: Reputation: 103Reputation: 103
Or it could be that there is a large file that was created and deleted, but is still in use by some process. So while the file is marked as deleted it is still there on the filesystem using space till the process is terminated. I have seen this in the past and it was a pain to debug. One option is to reboot and see if the space is still being used.

Another thing to do is to perform a filesystem check on the partition. The simplest way to force fsck filesystem check on a root partition is to create an empty file called forcefsck in the partition's root directory and rebooting. It will force a check on the partition.
 
Old 04-30-2022, 03:34 AM   #8
Johng
Member
 
Registered: Feb 2002
Location: NZ
Distribution: Kubuntu, Mint
Posts: 411

Original Poster
Rep: Reputation: 31
Quote:
yes, ncdu missed again some files. Most probably those hidden files. But without details hard to say more.
This is the ncdu output:
Quote:

100.5 GiB [##########] /home
7.7 GiB [ ] /usr
. 918.7 MiB [ ] /var
722.9 MiB [ ] /opt
310.7 MiB [ ] /boot
. 23.8 MiB [ ] /media
. 13.2 MiB [ ] /etc
. 1.4 MiB [ ] /run
. 64.0 KiB [ ] /tmp
! 16.0 KiB [ ] /lost+found
e 4.0 KiB [ ] /srv
! 4.0 KiB [ ] /root
e 4.0 KiB [ ] /mnt
e 4.0 KiB [ ] /cdrom
. 0.0 B [ ] /proc
. 0.0 B [ ] /sys
0.0 B [ ] /dev
@ 0.0 B [ ] libx32
@ 0.0 B [ ] lib64
@ 0.0 B [ ] lib32
@ 0.0 B [ ] sbin
@ 0.0 B [ ] lib
@ 0.0 B [ ] bin

Total disk usage: 110.2 GiB Apparent size: 109.8 GiB Items: 717576
It is hard to imagine there could be 100GB hidden files. It's an ext4 file system. How do we find them?
 
Old 04-30-2022, 03:42 AM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,253

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by Johng View Post
This is the ncdu output:

It is hard to imagine there could be 100GB hidden files. It's an ext4 file system. How do we find them?
based on post #7 (if you have a file [or more] which is already deleted but still kept by a process) you only need to reboot.

Code:
ncdu -x /
should display everything on your root partition, which is not [yet] deleted.
 
Old 04-30-2022, 05:01 AM   #10
Johng
Member
 
Registered: Feb 2002
Location: NZ
Distribution: Kubuntu, Mint
Posts: 411

Original Poster
Rep: Reputation: 31
Code:
ncdu -x /
 100.9 GiB [##########] /media                                                 
  100.5 GiB [######### ] /home
    7.7 GiB [          ] /usr
  927.6 MiB [          ] /var
  722.9 MiB [          ] /opt
  310.7 MiB [          ] /boot
   20.8 MiB [          ] /root
   13.3 MiB [          ] /etc
   88.0 KiB [          ] /tmp
e  16.0 KiB [          ] /lost+found
e   4.0 KiB [          ] /srv
e   4.0 KiB [          ] /mnt
e   4.0 KiB [          ] /cdrom
@   0.0   B [          ]  libx32
@   0.0   B [          ]  lib64
@   0.0   B [          ]  lib32
@   0.0   B [          ]  sbin
@   0.0   B [          ]  lib
@   0.0   B [          ]  bin
>   0.0   B [          ] /sys
>   0.0   B [          ] /run
>   0.0   B [          ] /proc
>   0.0   B [          ] /dev

 Total disk usage: 211.0 GiB  Apparent size: 210.6 GiB  Items: 635346
As shown above, the file in /media was the problem.

The computer is not mine. I now suspect the owner plugged in an external USB drive, and did not un-mount it!

Thank you for your help.

On an aside (breaking the rules) when an external drive is mounted at /media, does rsync treat the mount as a symlink?
 
Old 04-30-2022, 05:08 AM   #11
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,253

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by Johng View Post
Code:
ncdu -x /
 100.9 GiB [##########] /media                                                 
  100.5 GiB [######### ] /home

 Total disk usage: 211.0 GiB  Apparent size: 210.6 GiB  Items: 635346
As shown above, the file in /media was the problem.
it looks like.
Quote:
Originally Posted by Johng View Post
The computer is not mine. I now suspect the owner plugged in an external USB drive, and did not un-mount it!
No, it looks like the owner copied files into /media on the local disk instead of mounting USB and copying files onto that usb stick.

Quote:
Originally Posted by Johng View Post

On an aside (breaking the rules) when an external drive is mounted at /media, does rsync treat the mount as a symlink?
rsync or any other tool has no any idea what is really located at /media (If it was a local dir, a mount point or whatever), it will just use that.
 
Old 04-30-2022, 03:04 PM   #12
uteck
Senior Member
 
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: KDE Neon
Posts: 1,271

Rep: Reputation: 525Reputation: 525Reputation: 525Reputation: 525Reputation: 525Reputation: 525
If I remember correctly, when a USB drive is automounted it creates a new directory in /media with the users name, and then makes another in that with the device name.
So it does seem that files were copied into /media and took up space on the drive.
 
Old 04-30-2022, 06:54 PM   #13
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
Remember one thing about directories that are used as mount points. If files are in that directory then something is mounted on that directory / mount point, the content is hidden and inaccessible even though it takes up space on the file system.

Except in rare cases and done deliberately a user should not put content into a directory used as a mount point. Especially a user should avoid /mnt, /media and /run/media since those are often used mount points.
 
Old 05-01-2022, 02:09 AM   #14
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,253

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by computersavvy View Post
Remember one thing about directories that are used as mount points. If files are in that directory then something is mounted on that directory / mount point, the content is hidden and inaccessible even though it takes up space on the file system.

Except in rare cases and done deliberately a user should not put content into a directory used as a mount point. Especially a user should avoid /mnt, /media and /run/media since those are often used mount points.
That is the typical case, when you have no idea if /media is mounted or not. So you will copy a lot of files onto it and surprisingly they cannot be found on the usb.
But next time you mount it successfully you will not find it in /media too (because as you wrote the local content is hidden).
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Smartphones that you can add a full-size display to - and a full-size keyboard and mouse too Ulysses_ Linux - Hardware 8 11-07-2020 09:16 AM
Xorg displays in only left half of monitor but fbdev is at full width nandy Linux - Newbie 7 08-28-2017 08:58 AM
LXer: KNDISwrapper is half-done, but far from half-baked LXer Syndicated Linux News 0 12-04-2008 01:41 AM
how do I install half windows98 half linux? xandar Linux - General 3 09-07-2005 03:23 AM
Total partition size - User partition size is not equals to Free partition size navaneethanj Linux - General 5 06-14-2004 12:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 08:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration