LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 11-23-2005, 10:39 AM   #1
CrashedAgain
Member
 
Registered: Jan 2004
Posts: 307

Rep: Reputation: 32
moving /home /root & /var to new partition


I have only 4.2G on my / partition (hda8) & am constantly running out of space, however I have a now empty 3.0G partition (hda5) so I want to move /home, /root and /var to hda5.

I have copied /home/crashedagain (the only user) to hda5 & mounted it via fstab as /home. (fstab entry: /dev/hda5 /home ext3 auto,users,exec 0 0). This seems to be OK & is now working.

Now I want to move /root and /var. These will now become /home/root and /home/var since the partition is mounted as /home.

Since the system expects to find /var not /home/var, can I just replace /var with a symlink to /home/var.

I have read that some applications will not follow symlinks.

Will there be problems with using a symlink here?

If so, what is the alternative?
 
Old 11-23-2005, 10:47 AM   #2
abisko00
Senior Member
 
Registered: Mar 2004
Location: Munich
Distribution: SuSE, Ubuntu
Posts: 3,511

Rep: Reputation: 58
You need to create a separate partition for every out-sourced part of the root-tree. Although I have never tried your symlink solution, I can't imagine that this will work without trouble.
 
Old 11-23-2005, 03:40 PM   #3
alienDog
Member
 
Registered: Apr 2004
Location: Europe
Distribution: Debian, Slackware
Posts: 505

Rep: Reputation: 46
How big is your var? Is there really a point in moving it at all? I think mount also has an option to move part of the filesystem to another place (--bind option?), see man mount for this.

Last edited by alienDog; 11-23-2005 at 03:44 PM.
 
Old 11-23-2005, 03:46 PM   #4
CrashedAgain
Member
 
Registered: Jan 2004
Posts: 307

Original Poster
Rep: Reputation: 32
It's not really that big (about 400M at the moment) but sometimes it needs a lot of space, for instance apt-get upgrade (Debian system) can download as much as 500 or 600M of .deb files. These can be cleaned up once the upgrade is done but it needs the space with it is doing the upgrade.
 
Old 11-23-2005, 04:38 PM   #5
alienDog
Member
 
Registered: Apr 2004
Location: Europe
Distribution: Debian, Slackware
Posts: 505

Rep: Reputation: 46
400 MB seems a lot to me, mine is 17 MB I think you could make it happen with mount --bind so that you don't have to start partitioning hda5. Partitioning would seem a bin inconvenient.
 
Old 11-23-2005, 08:50 PM   #6
CrashedAgain
Member
 
Registered: Jan 2004
Posts: 307

Original Poster
Rep: Reputation: 32
crashedagain@desktop:~$ sudo du -s /var
391996 /var

most of it is in /var/lib & /var/log:
crashedagain@desktop:~$ sudo du -s /var/*
12 /var/autofs
3848 /var/backups
43412 /var/cache
162572 /var/lib
4 /var/local
12 /var/lock
172136 /var/log
48 /var/mail
4 /var/opt
252 /var/run
4328 /var/spool
5348 /var/tmp
16 /var/www
crashedagain@desktop:~$

most of /var/lib is apt & dpkg but there are a couple of really big files in /var/log:
crashedagain@desktop:~$ ls -ls /var/log | sort -n
{snip}
3436 -rw-r----- 1 root adm 3514197 Oct 20 06:33 syslog.2.gz
6556 -rw-r----- 1 root adm 6698794 Oct 20 06:33 messages.0
60720 -rw-r----- 1 root adm 62108905 Oct 20 04:54 debug.0
68892 -rw-r----- 1 root adm 70467752 Oct 20 06:25 kern.log.0

If I can get rid of these (and set the system up to keep them from growing...130Meg in log files is ridiculous!) then var will be small enough it won't be worth moving. I think logrotate is what cleans them up but I haven't figured out how it works yet.
 
Old 11-24-2005, 08:49 AM   #7
alienDog
Member
 
Registered: Apr 2004
Location: Europe
Distribution: Debian, Slackware
Posts: 505

Rep: Reputation: 46
It has it's own configfile in /etc/ called logrotate.conf that defines how often the logs should be rotated and for how long the old logfiles should be kept. I have:

Code:
weekly
rotate 1
create
compress
/var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
}
It will rotate the logs weekly, keep 1 week worth of old logfiles, create new (empty) logfiles upon rotation and compress the old logs. In addition there might be some additional settings for certain logfiles in /etc/logrotate.d. They mainly deal with what happens when a certain logfile gets rotated (a bit like the part for wtmp above). Probably all you need to touch is /etc/logrotate.conf. Also make sure that logrotate gets run by cron (i.e. your machine is up at the time of the cronjob).

--edit--

Oh, and check the logging settings of your firewall, it can quite quickly bloat the logs, could be the reason for the size of your kern logfile. What goes into debug in your system?

Last edited by alienDog; 11-24-2005 at 08:54 AM.
 
Old 11-24-2005, 09:15 AM   #8
CrashedAgain
Member
 
Registered: Jan 2004
Posts: 307

Original Poster
Rep: Reputation: 32
That's pretty much what mine looks like too except I had rotate 5 so I had 5 .gz compressed old files for most logs instead of 1.
But the 60+ Meg files debug.0 and kern.log.0 were dated Oct 20 so why weren't they rotated? Does rotate work on ALL log files in /var/log or is it necessary to specify which ones get rotated? The manpage doesn't say.
I manually removed them & recreated empty files so as to avoid something looking for them & giving an error.
Drive space is probably OK now:
Filesystem Size Used Avail Use% Mounted on
/dev/hda8 4.2G 2.6G 1.4G 67% /
/dev/hda1 4.6G 3.0G 1.6G 66% /mnt/hda1
/dev/hda5 3.0G 791M 2.1G 28% /home
/dev/hda7 26G 8.9G 17G 36% /mnt/hda7
/dev/hdb1 25G 301M 23G 2% /mnt/hdb1
/dev/hdb2 50G 20G 28G 42% /mnt/hdb2

hda1 is windows, hda7 is vfat & hdb is a data drive. but with 1.6G free on hda8 I should be OK, Previously I had about 90% full on this drive.
 
Old 11-24-2005, 10:44 AM   #9
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,066

Rep: Reputation: 295Reputation: 295Reputation: 295
You probably shouldn't move /root to a new partition. The reason /root is put on the root filesystem is so that if there's a boot problem and Linux is unable to mount any other partitions besides the root partition, then root can still get to all his files. If /root is on a separate partition, he'll still be able to log in in that case, but won't have any access to files in his home dir.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving VAR TMP HOME OPT to new partitions JWatson Linux - Newbie 2 01-03-2005 04:54 AM
Moving contents of /var to separate partition TexasDex Linux - Software 2 03-01-2004 08:30 PM
Moving /var to new partition burnpile Slackware 2 12-10-2003 12:33 PM
moving /home partition bhodi Linux - Newbie 2 11-22-2003 07:57 AM
Moving/using new /home partition concoran Linux - General 1 05-20-2002 09:32 PM


All times are GMT -5. The time now is 02:03 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration