Operating System - HP-UX
1752808 Members
5942 Online
108789 Solutions
New Discussion юеВ

Reduction of LV for the /var and /opt directories

 
SOLVED
Go to solution
Phillip Popp
Regular Advisor

Reduction of LV for the /var and /opt directories

Hi, new to Unix admin. I need to free up some disk space alocated to my /var and /opt directories. I only have the basic tool set available on this machine, so I will have to copy contents of /var, then unmount it, then mount it with a smaller disk space. This will free up space for other volumes, specifically /. So my questions is, can I unmount /var and /opt safely with out crashing my machine. some one had suggested to me that there is vital operating system files in those directories, and deleting them wiould cause my machine to not function.

Is this true or can I unmount these directories safely?

Thanks, for the help.

Phil
13 REPLIES 13
Bill Hassell
Honored Contributor

Re: Reduction of LV for the /var and /opt directories

/var is used by just about every process in HP-UX, but don't worry, you can't umount /var -- it is marked as busy, just like /opt. Since these are active filesystems, you'll need to reboot into single user mode. Once there, mount all the filesystems with this command:

mount -al

Now perform your copy, unmount and recreate the lvol, then initialize it with newfs and mount it again. Now copy your files back to the lvol. Repeat for each filesystem. To quickly copy your filesystem, use cpio -p as in:

cd /old_dir
find . | cpio -pudlmv /temp_dir

Once the new lvol is available, use the same command to copy the files back.


Bill Hassell, sysadmin
sathish kannan
Valued Contributor

Re: Reduction of LV for the /var and /opt directories

Hi Phil,

IS your /opt and /var are not separate filesystems? Are they part of / ?


If they are individual filesystem, I recon cleaning up them will not increasse / filesystem free space.

Regards
Sathish
Don't Think too much
MarkSyder
Honored Contributor

Re: Reduction of LV for the /var and /opt directories

I have to ask why you want to increase /?

This is usually a static filesystem with little if any growth. Is it possible you have stuff in / that should be in a filesystem of its own? Probably on a non-operating system disc.

Let us know why you want to increase / and we'll be able to advise you.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Nick W
Frequent Advisor

Re: Reduction of LV for the /var and /opt directories

Phil,

Safer option might be to use make_tape_recovery, part of Ignite, available for free download from http://docs.hp.com/en/IUX/download.html
This would let you create a bootable tape - "The make_tape_recovery(1M) and make_net_recovery(1M) tools enable consistent, reliable recovery in the event of a catastrophic failure of the system disk or root volume group."

That way you should be able to restructure your vg00 layout and you also have your vg00 data secured

Hope this helps.
Nick
Phillip Popp
Regular Advisor

Re: Reduction of LV for the /var and /opt directories

Yes,
Who ever set up the system in the first place, put a lot of stuff under the / directory. This machine is destined to be a back up of another machine that was set up as mentioned above. I will eventually use rdist to keep both machines relatively the same so if the first machine goes down the other one can be switched to. This second machine does not have enough space under / to accomadate the frst machines set up. so it is either free up space on / on second machine or reformat from scratch on that machine. I have nvever reformated and started from scratch on a Unix box before, the experts here suggest not to do that if I can help it. You see I am not a full time admin, I am actually an EE who finds himself with the responsibility to maintain a small network of two servers and 20 clients.

Thanks,
MarkSyder
Honored Contributor

Re: Reduction of LV for the /var and /opt directories

It appears from your previous answer that you are able to identify the stuff that shouldn't be in /. Do you have a non-operating system disc you could move this stuff to? This would free up space in / and be a lot easier than reducing other filesystems so you can increase /.

Mark
The triumph of evil requires only that good men do nothing
Phillip Popp
Regular Advisor

Re: Reduction of LV for the /var and /opt directories

Thnaks Mark,
I would love to redue the files that do not belong in there. However there are so many scripts that reference those files, then other things are linked here and there, it is a mess. If i move some of these, it would surely break the system. This system is part of a database chain that provides a lot of critical data to our business. I do not have the luxury of experimenting.

Thanks,

phil
MarkSyder
Honored Contributor
Solution

Re: Reduction of LV for the /var and /opt directories

You could move them and still keep the old names (although this would admittedly involve a certain amount of downtime).

Let us say you have a directory called mydir in /. You would rename the directory (for example) mydir.old, then create a new logical volume with a filesystem called mydir. You would then move the contents of mydir.old to /mydir and there you have it - mydir is re-created on a different disc. You could then remove mydir.old when you were happy that the new filesystem was working properly.

Full instructions available if this looks feasible.

Mark
The triumph of evil requires only that good men do nothing
Phillip Popp
Regular Advisor

Re: Reduction of LV for the /var and /opt directories

Mark,
That sounds like a good plan, I could do it slowly over time to make sure nothing breaks along the way. Change one directory let it run for a while then do another if no issues arise.

A full set of instructions would be teriffic.

Thanks,

BTW, I am running HP 10.2

Phil