Score:1

Ubuntu hard disk space

cr flag

I have a ~1 TB hard disk that I have partitioned for dual booting Ubuntu and Windows, where Ubuntu is the primary OS being used. Recently, I have been running into disk space issues in Ubuntu, and have approximately 200GB that is unaccounted for.

Below you can see the outputs of:

# sudo fdisk -l
/dev/nvme0***          *****     *****    *****   260M EFI System
/dev/nvme0***          *****     *****    *****    16M Microsoft reserved
/dev/nvme0<microsoft>  *****     *****    ***** 464.2G Microsoft basic data
/dev/nvme0***          *****     *****    *****   500M Windows recovery environment
/dev/nvme0<linux>      *****     *****    ***** 466.5G Linux filesystem

# sudo df -h
Filesystem       Size  Used Avail Use% Mounted on
tmpfs            3.2G  2.4M  3.2G   1% /run
/dev/nvme0<linux>459G  314G  122G  73% /
tmpfs            16G  214M   16G   2% /dev/shm
tmpfs            5.0M  4.0K  5.0M   1% /run/lock
/dev/nvme0****   256M   33M  224M  13% /boot/efi
tmpfs            3.2G  124K  3.2G   1% /run/user/1000

# sudo du ./ -h --threshold 500M | sort -h
./ 108 GB

When running sudo du, I can see that all 300 GB is occupied, but it is not located in the home directory. How do I locate and delete these 200 GB?

edit:

Output of disk analyzer (baobab)

enter image description here enter image description here

Bodo avatar
pt flag
You seem to have one filesystem only, so `/home` is part of the root file system `/`. What was the current directory when you ran the `du` command? If you ran it in your home directory, run it in the root directory `sudo du / ...` You could also use the graphical disk usage analyzer `baobab`.
S.MC. avatar
cr flag
This helped!!! `sudo du / -h --threshold 500M | sort -h` gave me 220G /var/lib/docker/overlay2 221G /var/lib/docker 224G /var/lib So it is easy to see that docker is what is taking up all the space...
S.MC. avatar
cr flag
Ran the following command afterward: `docker system prune -a -f` to remove all docker related info. Note this will delete all your docker images etc. so be careful.
Bodo avatar
pt flag
Your comments look like an answer. You can answer your own question.
S.MC. avatar
cr flag
I know, just wanted you to get the credit for it
terdon avatar
cn flag
By the way, please don't hide essential information from the output. The name of your disk isn't sensitive information, there's no point in `nvme0*** ` and actually the real values can be informative since they let us know whether two `dev/nme0**` devices are the same or not. The same goes for the start and end positions of your partitions, the is no risk in sharing that and it might be useful.
Bodo avatar
pt flag
I didn't write an answer because your question is not clear enough. You did not provide all information I requested in my first comment. I don't know if the `./` in your `du` command was intentional or a typo or a misunderstanding. `du ./` is the same as `du .` or `du` without a directory argument.
Score:0
cr flag

From the comments by @bodo i figured out that the issue was that the 200gbs were taken up in a folder in / (files generated by docker). By running

sudo du / -h --threshold 500M | sort -h

/var/lib/docker/overlay2 221G 
/var/lib/docker 224G

I could identify what was taking up the space and then i ran

docker system prune -a -f

to remove all docker related info. Note this will delete all your docker images etc. so be careful.

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.