Ubuntu - Hard disk fills up for no reason

arnoldpass305

New Member
Joined
Dec 18, 2022
Messages
4
Reaction score
0
Credits
38
I have a problem with Ubuntu and I noticed that my hard disk indicates that it is almost completely full, but when I check the files, I should have plenty of storage space left over.


I ran the command df -h and this is the result of one of the partitions.
Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p5 110G 104G 363M 100% /


But when I enter Disk Usage Analyzer, it tells me that I am only using 34.4 GB.


Note: This came up after I ran the sudo rm -r command to delete a folder. I have already checked the Trash and it is empty.
 


G'day @arnoldpass305 and welcome to linux.org :)

Can you
  1. show us the command you used to delete what folder? Up arrow used in Terminal should reveal.
  2. run the command
    Code:
    du -ah
    which will spool off a lot of output, when it completes gives us the figure from the bottom left side?
  3. give us a visual (screenshot) of /dev/nvme0n1p5 from GParted? If Gparted is not there
    Code:
    sudo apt -y install gparted
Thanks

Chris Turner
wizardfromoz
 
G'day arnoldpass, Welcome to Linux.org

(https://easylinuxtipsproject.blogspot.com/p/clean-mint.html#ID10)

Set a reasonable maximum log size for systemd​

10. The logs of systemd can sometimes grow too big. This is how to restrict their size to a sensible minimum:

a. Launch a terminal window.
(You can launch a terminal window like this: *Click*)

b. First you're going to reduce their current size well below 100 MB, which should be more than enough in almost all circumstances. For that one-time action, copy/paste the following command line into the terminal, in order to avoid typing errors:

sudo journalctl --vacuum-size=40M

Press Enter. Type your password when prompted. In Ubuntu this remains entirely invisible, not even dots will show when you type it, that's normal. In Mint this has changed: you'll see asterisks when you type. Press Enter again.

c. When that one-time job is done, you're going to put a permanent size cap of 100 MB on the logs. For setting that size cap, copy/paste the following command line into the terminal, in order to avoid typing errors. It's one big line:

sudo sed -i 's/#SystemMaxUse=/SystemMaxUse=100M/' /etc/systemd/journald.conf

Press Enter.

d. Now you're going to put a permanent number cap of seven log files on the logs. Which equals seven boot procedures.

For setting that number cap, copy/paste the following command line into the terminal, in order to avoid typing errors. It's one big line:

sudo sed -i 's/#SystemMaxFiles=100/SystemMaxFiles=7/g' /etc/systemd/journald.conf

Press Enter.

e. Then apply the new settings, with this terminal command (use copy/paste to transfer it into the terminal):

sudo journalctl --rotate

Press Enter.

You're done!
 
G'day @arnoldpass305 and welcome to linux.org :)

Can you
  1. show us the command you used to delete what folder? Up arrow used in Terminal should reveal.
  2. run the command
    Code:
    du -ah
    which will spool off a lot of output, when it completes gives us the figure from the bottom left side?
  3. give us a visual (screenshot) of /dev/nvme0n1p5 from GParted? If Gparted is not there
    Code:
    sudo apt -y install gparted
Thanks

Chris Turner
wizardfromoz
1. To delete the folder use: sudo rm -r folder_name.
2. This is the image:
1671330255180.png

1671330287561.png

3. This is the image:
1671330346073.png
 
G'day arnoldpass, Welcome to Linux.org

(https://easylinuxtipsproject.blogspot.com/p/clean-mint.html#ID10)

Set a reasonable maximum log size for systemd​

10. The logs of systemd can sometimes grow too big. This is how to restrict their size to a sensible minimum:

a. Launch a terminal window.
(You can launch a terminal window like this: *Click*)

b. First you're going to reduce their current size well below 100 MB, which should be more than enough in almost all circumstances. For that one-time action, copy/paste the following command line into the terminal, in order to avoid typing errors:

sudo journalctl --vacuum-size=40M

Press Enter. Type your password when prompted. In Ubuntu this remains entirely invisible, not even dots will show when you type it, that's normal. In Mint this has changed: you'll see asterisks when you type. Press Enter again.

c. When that one-time job is done, you're going to put a permanent size cap of 100 MB on the logs. For setting that size cap, copy/paste the following command line into the terminal, in order to avoid typing errors. It's one big line:

sudo sed -i 's/#SystemMaxUse=/SystemMaxUse=100M/' /etc/systemd/journald.conf

Press Enter.

d. Now you're going to put a permanent number cap of seven log files on the logs. Which equals seven boot procedures.

For setting that number cap, copy/paste the following command line into the terminal, in order to avoid typing errors. It's one big line:

sudo sed -i 's/#SystemMaxFiles=100/SystemMaxFiles=7/g' /etc/systemd/journald.conf

Press Enter.

e. Then apply the new settings, with this terminal command (use copy/paste to transfer it into the terminal):

sudo journalctl --rotate

Press Enter.

You're done!
I followed your steps and it freed up about 2 GB of space, but there is still quite a bit of space that should be recovered.
Now that I remember, a few months ago something similar happened to me. When I booted my operating system it would not allow me to log in because there was no space in the operating system. And I had to log in from a USB, enter the explorer and look for a file that was too heavy, deleted it and the space came back. But now I can't find that heavy file.
 
Just a heads up, that was

Code:
du -ah

I asked for, not df -ah

Wiz
 
Just a heads up, that was

Code:
du -ah

I asked for, not df -ah

Wiz
Sorry, it was my mistake. I ran the command you indicate and saved the result in a .txt file. Then I put it in an Excel sheet and found some folders that weighed a few GB, but not so many as to justify that I ran out of space.

I saw fit to send a screenshot of what happens when I enter the disk and go to Properties.
As you can see, it indicates that I have a total of 118 GB, in the Contents field I have 35.5 GB but in total used it appears 109.8 GB, therefore I have 2.2 GB left. This all sounds crazy to me because I don't have enough files to take up 109.8 GB.

1671336592474.png
 
Last edited:
Thanks for that, I understand.

Are you running Timeshift, and if so, what are its settings?

If not, then I can suggest a workaround that will at least allow you to boot with ease, if you are prepared to put the effort in.

Let's revisit that screenshot from GParted, which I reproduce in part here.

E8HlzJt.png


If you are prepared to shrink Windows a little and give your Ubuntu another, say, 20 GB, you could use GParted to do so, but because you cannot manipulate your Linux root (/) partition from within an active session (safety feature) you would have to do it externally. If you follow this course be sure you have a Recovery plan for Windows, for Justin (Just In Case)

You can either use the medium you used to install with in November, if you still have it - the Live install gas GParted on it, or else set up a GParted USB stick or CD/DVD (it's only a few hundred megabytes) from GParted Live.

Once you have decided on that and have it ready, follow the following steps. Note that the key icon to the left means the device or partition is mounted, and you have to right click and unmount it first. I'll abbreviate the NVMe entries to px where x is a number.

1. Click on p3 (Windows) then right-click and choose move/resize reduce it by 20 GiB (maybe 204800) leaving the 20 GB at the end field, this will result in it having 104.42 GiB, still plenty for updates &c

2. Clicking on p4 move it up to close the space, leaving 20 GiB at the end. Windows is now sorted.

3. Clikcing on p5 (unlocked/unmounted ie no key icon) you want a 0 (zero) in the top of the 3 fields and a 0 in the bottom of the three (you can use the tab key) so that instead of 112.23 GiB it will be 132.23 GiB

Once that is done and you are satisfied, you can then go towareds the top menu and where the green checkbox with a white check is (smart tip shows as accept changes), click that.

When the operation is complete, you can reboot and have 20 GiB more on your 'buntu.

I still would like to solve what are the space hogs, or this may happen again, but I have a 500 km roadtrip tomorrow so unavailable most of my day.

Wiz
 

Staff online

Members online


Latest posts

Top