Ot: linux/ubuntu guru here?


#1

sorry for ot, for my ubuntu 16.04, all of a sudden, my user partition is 100% used, what’s wrong and how to free it up?
thanks.

did a bit of googling,

/boot

has
54MB intrig-img-4.15.0-29-generic
54MB intrig-img-4.15.0-36-generic

uname -a
indicates that it’s on/using 4.15.0-36-generic

does it mean I can safely delete intrig-img-4.15.0-29-generic ?

would rm -rf that file better or

sudo dpkg -r that file better?

and last time when I df it had at least 6 GB free before my sucker windows 10 crashed then of course all the VMs on it too, would that explain it? tks again


#2

Anyone? this is killing me


#3

You might try: du -sh /some_folder to figure out what is taking up all the space. Sometimes you can free up space with apt-get:

# remove unused kernels
sudo apt-get autoremove --purge

# clean apt cache
sudo apt-get clean

# remove stuff that is no longer required
sudo apt-get autoremove

Then you might also be able to remove some packages that are installed that you don’t need by using apt-get remove


#4

It’s… full.

df

du -mxs /* |sort -nr

Identify the big folder

du -mxs /bigfolder/* |sort -nr

Continue until you identify the cause.

Delete files as necessary.

Or use something like daisydisk or this https://blog.aclarke.eu/2011/09/21/a-simple-treesize-shell-script-for-linux/

-G


#5

rm will get rid of the file, but it’ll still be there in the packages database, and you’ll miss the related files (i.e. /lib/modules/4.15.0-29-generic is likely FAR bigger than 54MB)

However it’s unlikely 54MB is killing your drive. You’re better off using du as I indicated to identify the big offending directories/files.

Post df to start.

To delete old kernels, dpkg -l 'linux-*'… You’ll see packages like linux-image-4.15.0-29-generic, linux-image-extra-4.15.0-29-generic, etc. Pass those into apt-get purge.

apt-cache policy linux-image-generic |grep Candidate: shows what the most recent kernel in the repo is.
uname -a shows what you’re running.


#6

du very helpful, it got me

9141 /var
3509 /usr

distant others…

how to further identify some packages/stuff under each of them that can be removed?

thanks.


#7

uname -r
Now run this command for a list of installed kernels:

dpkg --list 'linux-image*' | grep ^ii
and delete the kernels you don’t want/need anymore by running this:

sudo apt-get remove linux-image-{VERSION}

failed to purge older linux image, not sure why.

UPDATE:
ok, some progress, was finally able to remove an older linux kernel image, then ran,

sudo apt-get autoremove

but only freed up about 1G,
df -BG display 15G total 14G used, but why it still says 0G available 100% used?

thanks


#8

yeah, my first attempt, but they didn’t do the job, thanks tho.

and du is cool.


#9

Did you try rebooting?


#10

Yes, rebooted twice, thanks tho.


#11

If you did du -mxs /* |sort -nr, now do du -mxs /usr/* |sort -nr or /var/* or whatever.

Linux reserves approx 5% of filesystems for use by root and root alone, so even if you have “free bytes” the percentage will only show what non-root users can use.

So of a 15GB volume only 14.25G is available for non-root. You should probably trim some more :smiley:
If you can’t find more stuff to trim there are things you may not need.

/usr/share/doc is all documentation
/usr/share/man is all manpages. If you aren’t using manpages you can dump them. (you can find them all online anyway)

/var/log tends to grow - especially if you don’t have logrotation on one or a couple files. If you delete a file from /var/log, just be aware if the file descriptor is still open (i.e. syslog has it open) the space will NOT be released. It would after you restart the service holding the file open, or you reboot.


#12

Joe, thank you so much, previously i’ve looked at the /var/temp directory and googling seems to confirm stuff can be deleted there, so, I did, but that did not seem help much.
But removing stuff from these two directories and their subdirectories of /usr/share/doc and its /man helps A LOT, now I have 5G free.

Your rock, man !


#13

By the way, do you have Docker installed on that machine?


#14

Yes.


#15

Well, a new issue just popped up, that is, our cloud service provider, Digital Ocean, seems to have misconfigured the “|” process redirect command for the “console” access to a Ubuntu 16.04 server, thus, instead of redirecting the current process output to another, it redirects current process output to a file, and I’m not sure what else could go wrong…
“console” access is preferable to “ssh” for our current work. I’ve brought up the issue with them, but not sure what they’ll do …


#16

Run the following command and let us know if you have more disk space:

docker system prune  --all

#17

I have mounted several containers, that is, several containers are up and running, are you sure it would not have any adverse effect on them?


#18

System Prune Removes unused data.

See https://docs.docker.com/engine/reference/commandline/system_prune/

Be sure to NOT use the volumes option if you want to preserve volumes.

If you want an interactive mode then don’t use the --all switch. See link above, which shows:

$ docker system prune

WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all dangling images
        - all build cache

#19

Great, it freed up 2.3 GB, thanks.