1753795 Members
6970 Online
108799 Solutions
New Discussion юеВ

Re: moving /var

 
SOLVED
Go to solution
Sandy Chen
Honored Contributor

moving /var

Hi all,

I've installed HPUX 11i from DVD, but I accidentally remove /var from the filesystem configuration, so now my /var is in the / filesystem. I want to mount /var into a separate filesystem, can I do these?

- Create a new lvol and mount it on /var2
- cp -rp /var/* /var2
- modify /etc/fstab, new lvol = /var

please advise

regards,
Sandy
I never think of the future. It comes soon enough.
3 REPLIES 3
Rajeev  Shukla
Honored Contributor

Re: moving /var

Hi Sandy,

Yes you could, but do it from single user.
Boot the system in single user where your / is already mounted, mount /var2 and you could then even do a mv instead of cp.
Once completed change your fstab entry to mount new lv as /var and reboot the server..

Cheers
Rajeev
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: moving /var

cp -r(even with -p) isn't really great for this because you need to preserve mode, links, and ownerships of all files and directories. You also are going to leave a bunch of space beneath the /var mountpoint with your method. Finally you are going to leave / much larger than it needs to be (~200MB is plenty) but if you don't mind the wasted space (even after we recover the stuff beneath /var) then I would do this:

Find enough space in some filesystem (or create one) to hold /var's current data.

cd /var
find . -print | cpio -ocv > /whereever/var.cpio.dat
create your new LVOL, make a filesystem, create a /var2 mountpoint, and mount the new filesystem as /var
cd /var2
cpio -icvdum < /whereever/var.cpio.dat

This form of cpio will preserve everything including directory ownerships which the -p version of cpio will not.

Now, edit /etc/fstab and change the /var2 mountpoint to /var but do not remount the filesystem.

Shutdown and bring the system up in single-user mode by interrupting the boot, boot pri, interact with ISL? At the ISL prompt, enter "hpux -is". You will be brought up as root with only / mounted.

/sbin/mv /var /varold
/sbin/mv /var2 /var

/sbin/reboot
and allow the system to come up normally.

If everything under /var look normal then you can "rm -r /varold" and "rm /whereever/var.cpio.dat".

Plan B. Reinstall from DVD and do it right this time.

Plan C. Install IgniteUX, do a make_tape_recovery, and Ignite the system.

I like Plan B because you need the practice.
If it ain't broke, I can fix that.
Sandy Chen
Honored Contributor

Re: moving /var

Hi all,

Thanks for the inputs.

I can't do installation from DVD, because the applications already installed from the DVD. Don't worry about the practice, I will have another chance for that.

regards,
Sandy
I never think of the future. It comes soon enough.