Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
stupid Unix tricks, changing filesys of /var on a live sys
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Mon Mar 31, 2003 11:12 am    Post subject: stupid Unix tricks, changing filesys of /var on a live sys Reply with quote

Having some qmail issues and it would be handy if I could change the filesystem of /var remotely. Something like

1. mkdir /home/newvar/ ;cd /var ; cp -a * /home/newvar
2. umount /var
3. format, etc
4. mount /var
5. copy files back
6. reboot and hope the box is happy, reinstall qmail.

I'm getting /var busy on the umount bit so I'm a little stuck. If this isn't something I'd actually want to do for one reason or another I'd consider that information useful too. :)

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
gilesjuk
Guru
Guru


Joined: 11 Feb 2003
Posts: 412
Location: Staffordshire, UK

PostPosted: Mon Mar 31, 2003 1:21 pm    Post subject: Re: stupid Unix tricks, changing filesys of /var on a live s Reply with quote

If you don't already have a /var partition then you don't umount it, just create the new /var partition and mount it.

/var is an important directory and such things should normally be fiddled with in singer user mode.
_________________
^<^>^<^>^
G. Jones
-=-=-=-=-=-
Back to top
View user's profile Send private message
arkhan_jg
Apprentice
Apprentice


Joined: 18 Mar 2003
Posts: 199
Location: Dorset, UK

PostPosted: Mon Mar 31, 2003 1:41 pm    Post subject: Reply with quote

I'm sure there's a more elegent way of doing it using remount or mount --move (2.5 kernels), but the simplest way for me is
Code:
lsof | grep /var

and stop all apps using /var long enough to unmount it!

(you can always mount it again in it's temporary location while you do the formatting)

Obviously, this is only relevent if you have /var as a separate partition.

Another option would be to alter your fstab to point /var to a temporary directory, reboot, copy the files to another temporary directory, format the /var partition, copy back, alter your fstab etc. The downside is, you'd lose all the logging your system did in the mean time, assuming you don't merge back in your log files.
_________________
make menuconfig not war
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Mon Mar 31, 2003 5:22 pm    Post subject: Reply with quote

Moved from Installing Gentoo.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Mon Mar 31, 2003 9:45 pm    Post subject: Reply with quote

arkhan_jg wrote:

Code:
lsof | grep /var

and stop all apps using /var long enough to unmount it!

(you can always mount it again in it's temporary location while you do the formatting)

Obviously, this is only relevent if you have /var as a separate partition.

Another option would be to alter your fstab to point /var to a temporary directory, reboot, copy the files to another temporary directory, format the /var partition, copy back, alter your fstab etc. The downside is, you'd lose all the logging your system did in the mean time, assuming you don't merge back in your log files.


Ah... looks like I mised cron when I attempted it. I can take the hit on the system logs, the box is only running qmail for an announcement list, so I have some leeway if I completely destroy it. :)

I couldn't think of a way to reboot the box and have /home/newvar be the new /var partition... am I missing something completely obvious or just /etc/fstab unfancy?

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Tue Apr 01, 2003 11:28 pm    Post subject: it worked oddly enough Reply with quote

No problems other than resintalling qmail, that was a given as qmail gets really unhappy when you touch anything in the queue and apparently changing the filesystem qualifies.

The other thing I learned was make sure you have installed all the software you need before starting, ie reiserprogs. :)

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum