You are not logged in.

#1 2010-04-10 18:35:13

Yes
Member
Registered: 2008-03-29
Posts: 163

What is safe to delete from /var?

I have a 7.6 GB /var partition, which is currently full.  What would be safe to delete from it, and should I enlarge it so it doesn't fill up again?

Thanks!

Offline

#2 2010-04-10 18:42:58

flamelab
Member
From: Athens, Hellas (Greece)
Registered: 2007-12-26
Posts: 2,160

Re: What is safe to delete from /var?

Check which subdirectory is so big (I guess /var/cache/pacman/pkg). You can free space from there with pacman -Scc (deletes the downloaded arch pkgs).

Offline

#3 2010-04-10 18:54:12

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: What is safe to delete from /var?

I guess it's caused by (a) big log file(s). But of course doing a pacman -Sc or pacman -Scc will give you a lot of space back.

Offline

#4 2010-04-10 18:58:02

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: What is safe to delete from /var?

du -hs /var/*

should tell you which subdirectory is eating up a lot of space. If you have a separate /var it's a smart move to clean out your cache periodically.

Make also sure you rotate your logs and have old ones compressed.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#5 2010-04-10 19:04:28

Yes
Member
Registered: 2008-03-29
Posts: 163

Re: What is safe to delete from /var?

Most of it seems to be /var/lib/pacman and /var/lib/nvidia (and /var/abs).  Can I delete anything from those directories?

I'll clear the cache once I can boot, but for now I can't even boot.

e:  Is the cache that would be cleared with pacman -Sc /var/cache/pacman/pkg?  Would it be safe to delete that manually?

e2:  Nevermind, I just chrooted into the install from an Ubuntu install and ran pacman -Sc from there.

Thanks all!

Last edited by Yes (2010-04-10 19:21:18)

Offline

#6 2010-04-10 19:36:39

uwinkelvos
Member
Registered: 2009-06-07
Posts: 129

Re: What is safe to delete from /var?

hum...
74M    /var/lib/pacman/
60M    /var/abs/
1,2G    /var/
1,1G    /var/cache/
1,1G    /var/cache/pacman/pkg/

Are you sure /var/lib/pacman(abs) are realy that big? Nevertheless it is safe to remove old packages from /var/cache/pacman/pkg/. so find some old package, delete it manually. some few mbs should be more than sufficient to boot again.

Offline

#7 2010-04-10 19:40:33

loafer
Member
From: the pub
Registered: 2009-04-14
Posts: 1,772

Re: What is safe to delete from /var?

The pacman cache will grow and grow if you let it.  There is no need to remove stuff manually either.  "pacman -Sc(c)" as mentioned above will do the job.


All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.

Offline

#8 2010-04-10 19:44:34

Acecero
Member
Registered: 2008-06-21
Posts: 1,373

Re: What is safe to delete from /var?

Along with cleaning all or uninstall package cache, you might be interested in a log cleaner app such as bleachbit to increase the leftover space.

Offline

#9 2010-04-10 19:58:19

uwinkelvos
Member
Registered: 2009-06-07
Posts: 129

Re: What is safe to delete from /var?

loafer wrote:

There is no need to remove stuff manually either.

...unless you cant even boot, because /var is filled up to the last byte.

Offline

#10 2010-04-10 20:00:10

flamelab
Member
From: Athens, Hellas (Greece)
Registered: 2007-12-26
Posts: 2,160

Re: What is safe to delete from /var?

uwinkelvos wrote:
loafer wrote:

There is no need to remove stuff manually either.

...unless you cant even boot, because /var is filled up to the last byte.

You can boot even if your system is filled up, since ext* fs allocates some space for root login.

Offline

#11 2010-04-10 22:57:07

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: What is safe to delete from /var?

flamelab wrote:

You can boot even if your system is filled up, since ext* fs allocates some space for root login.

Pacman is generally run as root, so its cache could conceivably fill up the reserved 5%.

Offline

#12 2010-04-10 23:06:03

flamelab
Member
From: Athens, Hellas (Greece)
Registered: 2007-12-26
Posts: 2,160

Re: What is safe to delete from /var?

tavianator wrote:
flamelab wrote:

You can boot even if your system is filled up, since ext* fs allocates some space for root login.

Pacman is generally run as root, so its cache could conceivably fill up the reserved 5%.

You've confused the term "root" and "ran as root" wink

Offline

#13 2010-04-10 23:20:14

raj7095
Member
Registered: 2010-02-14
Posts: 91

Re: What is safe to delete from /var?

as everyone said, its probably because of the downloaded packages. do a pacman -Sc or pacman -Scc or empty the folder /var/cache/pacman/pkg manually. i dont think anything else can take up that much space.

Offline

#14 2010-04-10 23:46:40

uwinkelvos
Member
Registered: 2009-06-07
Posts: 129

Re: What is safe to delete from /var?

i know this is not the place for this kind of discussion, as this problem is probably solved, but tavianator is right. I think pacman filled up the cache dir and the last available bytes were allocated by some log files. (all these files are owned by root.)

Offline

#15 2010-04-11 01:53:19

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: What is safe to delete from /var?

I dont know where these 7 gigs come from - but this is the 2nd such problem in a short time! When oh when will people learn to make a root filesystem that is big enough. With today's disks and prices - why skimp??
Me - I use 20 gigs (but then I dont split it up any - the entire distro is on one single partition (which is great when you are distrohopping!).

For those unfortuneate enough to have such a problem - and it will occur again and again whenever you have large'ish updates - the solution is simple. Just move /var/cache to somewhere else - an otherwise unused partition eg. and then make a symbolic link.

Offline

#16 2010-04-11 17:55:51

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: What is safe to delete from /var?

flamelab wrote:
uwinkelvos wrote:
loafer wrote:

There is no need to remove stuff manually either.

...unless you cant even boot, because /var is filled up to the last byte.

You can boot even if your system is filled up, since ext* fs allocates some space for root login.

I have had a situation where a /var on the same partition as / would fill up the whole root partition to the brim and would not allow me to boot up any further - so I could not log in. Giving /var a separate partition prevents that. If you keep that in mind, what uwinkelvos said is probably true.

From the tune2fs manual (emphasis mine):

-m reserved-blocks-percentage
              Set the percentage of the filesystem which may only be allocated by privileged processes. Reserving some number of filesystem blocks
              for use by privileged processes is done to avoid filesystem fragmentation, and to allow system daemons, such as syslogd(8), to continue
              to function  correctly after non-privileged processes are prevented from writing to the filesystem.  Normally, the default percentage of
              reserved blocks is 5%.

Perbh, allow me to show you wrong:

/dev/sda5             3,9G  2,7G 1007M  74% /
udev                   10M  228K  9,8M   3% /dev
none                 1004M     0 1004M   0% /dev/shm
/dev/sda2              92M   14M   73M  16% /boot
/dev/sda6             1,5G  379M  1,1G  26% /var
/dev/sda7              24G   19G  5,5G  78% /home
none                  512M   44K  512M   1% /tmp

You don't need a huge /, you do need to know how much you'll be installing (and that's experience and calculation, pacman happily reports installed size for installs). Split out /var and you can trim down even further.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#17 2010-04-11 18:13:26

Anikom15
Banned
From: United States
Registered: 2009-04-30
Posts: 836
Website

Re: What is safe to delete from /var?

I have a script that'll keep your pacman cache trimmed (and fast), run it just when var gets big or pacman gets too slow:

#!/bin/bash

tar -cjvf /srv/rec/pacman-database.tar.bz2 /var/lib/pacman/local
pacman -Rscn $(pacman -Qtdq)
pacman -Sc
pacman-optimize && sync

You can use whatever compression you like. Don't run it too much. You'll need to run as root. You'll need to make a dir called /srv/rec/ or whatever you like.

Last edited by Anikom15 (2010-04-11 18:15:01)


Personally, I'd rather be back in Hobbiton.

Offline

#18 2010-04-11 19:07:17

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: What is safe to delete from /var?

Anikom15 wrote:

I have a script that'll keep your pacman cache trimmed (and fast), run it just when var gets big or pacman gets too slow:

#!/bin/bash

tar -cjvf /srv/rec/pacman-database.tar.bz2 /var/lib/pacman/local
pacman -Rscn $(pacman -Qtdq)
pacman -Sc
pacman-optimize && sync

You can use whatever compression you like. Don't run it too much. You'll need to run as root. You'll need to make a dir called /srv/rec/ or whatever you like.

That script will break things on many people's systems. I strongly recommend not using it until at least pacman -Qtdq is clear of any output.

Offline

#19 2010-04-11 19:53:04

Anikom15
Banned
From: United States
Registered: 2009-04-30
Posts: 836
Website

Re: What is safe to delete from /var?

kay, so is there a way I can fix it?

(I'm not a big bash scripter, but I've never had any problems with it.)


Personally, I'd rather be back in Hobbiton.

Offline

#20 2010-04-12 04:17:40

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: What is safe to delete from /var?

.:B:. wrote:

Perbh, allow me to show you wrong:

/dev/sda5             3,9G  2,7G 1007M  74% /
udev                   10M  228K  9,8M   3% /dev
none                 1004M     0 1004M   0% /dev/shm
/dev/sda2              92M   14M   73M  16% /boot
/dev/sda6             1,5G  379M  1,1G  26% /var
/dev/sda7              24G   19G  5,5G  78% /home
none                  512M   44K  512M   1% /tmp

You don't need a huge /, you do need to know how much you'll be installing (and that's experience and calculation, pacman happily reports installed size for installs). Split out /var and you can trim down even further.

Yeah - and this is a 'newbie' forum!! How many newbies has the kind of experience neccessary?
As for splitting it all up - that is fine if you have but one distro ... If you use more than one, you'll soon have almost unsurmountable problems keeping them all apart!
I didn't say it was _wrong_ to have small partitions, I just questioned the wisdom to do it for a _newbie_ - at least these days where you can get 1 TB disk for less than 100 bucks.

Offline

#21 2010-04-12 15:00:31

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: What is safe to delete from /var?

This is a newbie *subforum*. Last time I checked this is still the Arch forum, and Arch Linux is not a distro targeted at newbies. You've been around for five years, don't tell me you expect the hand holding certain distros offer, be it for you or for other people, even the new ones? This subforum is intended for new members needing a bit more leniency, but not a free pass at 'hey spell it out for me cuz I dunnoes how 2 google LULZ!'.

As for splitting things up, I must confess I lose track easily already now - with only one distro wink. While it may be a bit of a hassle at times, it's not like you need to recreate that layout every week. Three or four separate partitions is really not a problem if you stick with a single distro.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

Board footer

Powered by FluxBB