4

I'm still new to the Linux world, My disk size is 493 G

And when I use the command du -hs * /opt/conda, The total size I use is less than 95g

enter image description here

But when I use the df -h command:

  • Disk Size is 493 G
  • Used 404 G
  • Available 89 G

enter image description here

  • So, (493 - 95) = 398 G available not just only 89 G

What can i do with that ?

I tried to use this command sudo apt-get autoremove to remove any unnecessary packages but it just free about 50 M only.

And when i try this sudo parted -l & lsblk -f This is the output:

enter image description here

The OS & release :

enter image description here

  • 1
    Did you use LVM? It does not automatically use full space, so user has options to either expand or add volumes. Post this: `sudo parted -l` & `lsblk -f` – oldfred Jan 02 '23 at 19:50
  • I've tried them, but I still don't understand what the solution is. – Kareem Shehata Jan 02 '23 at 21:02
  • 1
    It's Ubunto, Sir. – Kareem Shehata Jan 02 '23 at 21:57
  • I'd apply system upgrades asap; 20.04.3 shows you're well behind as an updated system switched to reporting itself as 20.04.4 early in 2022 (*in weeks before ISO release date shown* https://fridge.ubuntu.com/2022/02/25/ubuntu-20-04-4-lts-released/) and a fully upgraded system has reported itself as [20.04.5](https://fridge.ubuntu.com/2022/09/01/ubuntu-20-04-5-lts-released/) for awhile now too, so I hope you keep that box offline. – guiverc Jan 02 '23 at 22:15
  • 1
    I think i don't have the permission to update the system, plus what does that supposed to do with the disk space !! – Kareem Shehata Jan 02 '23 at 23:34
  • Do you have LVM? You scratched out name of volume? Post `sudo pvs` & `sudo vgs` & `sudo lvs` You may just need lvextend command. example:https://ubuntuforums.org/showthread.php?t=2482037&p=14124677#post14124677 – oldfred Jan 03 '23 at 03:50
  • why * and /opt/conda specifically? don't you want to see the whole hard drive? – user253751 Jan 03 '23 at 05:35
  • @user253751 The rest are very small files and I checked that. – Kareem Shehata Jan 03 '23 at 20:52
  • 1
    One cause of invisible disk space usage on Linux is if a program creates a log file, and writes a lot of log messages, and something else deletes the log file. The file isn't deleted until all programs close it, but now it doesn't have any name so you can't find it. In this case a reboot would free the space. and there's probably a tool somewhere to find these files. – user253751 Jan 03 '23 at 21:43
  • @user253751 I think this is one of the reasons because I deleted some environments with this "rm -r" command. Is this a wrong way to clear it ?? And unfortunately i don't have the permission to reboot the system. – Kareem Shehata Jan 04 '23 at 01:51
  • @oldfred I've really tried everything to install LVM with this command "apt install lvm2" but it always fails. – Kareem Shehata Jan 04 '23 at 01:54
  • You almost never use rm command, too easy to do a typo. If you have LVM, you should not need to reinstall it. But if you deleted something important, the only way to recover is to do a new install & restore from backup. Normal rule is if it takes more than an hour to fix, easier with Ubuntu to just reinstall & restore your backups. – oldfred Jan 04 '23 at 03:29
  • @oldfred "almost never use rm command" - wtf? then how do you delete things? – user253751 Jan 04 '23 at 17:54
  • I forgot you are a command line only user. New users or those with gui should not use rm. I have seen this recommendation: alias rm='mv --target-directory ~/.Trash' Not sure if ~ works correctly if in root. – oldfred Jan 04 '23 at 19:52

2 Answers2

2

You can use the Disk Usage Analyzer tool to find files and directories occupying majority of your space.

In case it is not installed, you can install it with the terminal command

sudo apt install baobab
Archisman Panigrahi
  • 25,210
  • 17
  • 90
  • 185
0

This command covers the most common tasks I use to create disk space:

sudo apt-get autoremove && sudo apt-get autoclean && sudo journalctl --rotate && sudo journalctl --vacuum-size=100M

This is because the local apt-get repo and the journal logs are a common source of unneeded large files, sometimes taking up many GB of space.

apt-get autoremove removes apt dependencies that are no longer dependencies, apt-get autoclean clears the local cache of package files that can no longer be downloaded, journalctl --rotate marks all journal logs as archived, and sudo journalctl --vacuum-size=100M limits the journal logs to 100MB total.

This may not entirely solve your disk space problem, but it's a good place to start.

A good next step is to install and use the nCurses Disk Usage tool to locate large files:

sudo apt-get install ncdu
sudo ncdu /
cowlinator
  • 101
  • 3
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 01 '23 at 09:49