HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

migrate /var into nfs server

 
avizen9
Esteemed Contributor

migrate /var into nfs server

Hello,
this is interesting task i need to do for one of my linux server, its redhat EP 4, i need to move /var in to nfs due to some space issue,

i had created nfs drive and put entry in fstab.

and rebooted server but it does not work as /var is require to write some logs and other stuff, it just stop in half boot,

i think i need to change system path which are pointing to /var to write messages, while booting,

anybody having any good suggestion,
surely assign point for each reply and full point for correct answer,

thanks
9 REPLIES
Michal Kapalka (mikap)
Honored Contributor

Re: migrate /var into nfs server

hi,

check on wich runlevel is nfs client starting,

you could change the startup prioriy with the start scripts.

mikap
Steven E. Protter
Exalted Contributor

Re: migrate /var into nfs server

Shalom,

This is not a good idea.

Problem is the system wants to mount /var and start writing files to it before it starts the NFS client.

So where will all that output go?

To the root fs. Then when /var mounts on NFS you won't even be able to see or erase this output because there will be a file system mounted on /var

I call this the old hidden file trick.

Better strategy:

cd /var
du -sk | sort -rn | more

Identify a big directory.

See what is in it.

Lets say /var/log/httpd is huge.

You can safely move /var/log/httpd to NFS without doing yourself in with the old hidden file trick.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
avizen9
Esteemed Contributor

Re: migrate /var into nfs server

thanks for suggestion,
i have no other choise need to migrate it in nfs
any other clue?

as steven mentioned while booting up system want to write some files in /var and nfs will mount later so i can just change fstab and boot up system?

appricate any other suggestion here
Steven E. Protter
Exalted Contributor

Re: migrate /var into nfs server

You will damage your system by migrating all of /var to NFS.

Again:

cd /var

du -k | sort -rn | more

Pick three big directories.

say

/var/log/httpd
/var/log

Create nfs mount and make:

/var/log/httpd
/var/log

file systems located on nfs

mount -t nfs server:/path /var/log

now its on nfs.

Copy the data out first.

Please read the hidden file trick remakrs carefully. Moving all of /var will eventually lead to a clogged and potentially filled / filesystem.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
avizen9
Esteemed Contributor

Re: migrate /var into nfs server

Hello Steven
as i mentioned i have no choise i need to migrate i have few other reason to migrate it not only space,

please advice if you have any other better suggestion, how i can boot my system to point out nfs /var while it trying to write some files in booting period thanks,
Stephen P. Schaefer
Frequent Advisor

Re: migrate /var into nfs server

Consider very seriously Mr. Protter's recommendation; it will be much easier in the large majority of cases.

If, for some other reason you haven't explained, it is mandatory that /var be NFS mounted, then you'll need to do a lot of research. At a minimum, you'll need to replace /var/run (on both the local file system and on the NFS mounted /var) with a symbolic link to something like /var_local/run, on local storage mounted before any of the other startup scripts run. Change the netfs startup script to run immediately after the nfslock startup script (you may need to renumber, e.g., the mdmonitor script so that it runs after netfs). All the script renumberings will be subject to reversal if you ever apply patches to the packages owning the startup scripts, so be ready to deal with that. Read /etc/rc.d/rc.sysinit and all the other startup scripts preceding netfs, and note where they attempt to use /var, replacing any file or directory mentioned with a symlink such as that for /run. Keep detailed notes as you do all this on a test system, so that you haven't broken the production system while discovering all the little pieces you missed. I run a virtual machine hosted by my laptop for just this kind of research. Even better, write a script that performs all the changes, so that you can test the script on your test image - programs are less likely to miss a step than humans.

Now that you have an idea what you're in for, consider Mr. Protter's advice again ;-)

Re: migrate /var into nfs server

This is unrelated to this thread but Volkmar is waiting for you to reply to your congrats thread:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1346628
avizen9
Esteemed Contributor

Re: migrate /var into nfs server

ok now questions comes in mind that what are the system link i need to change which pointing to /var to write files while booting, any body having any specific list?
i may create one folder call /n-var and do link here so while bootup system can write all files here, what you guys think, thanks,

Re: migrate /var into nfs server

>symlink I need to change which pointing to /var to write files while booting

Why bother thinking, just create symlinks for every directory under /var and see which are changed.