Operating System - HP-UX
1753648 Members
5966 Online
108798 Solutions
New Discussion юеВ

How to create separte /usr which is created now on / file-system

 
Unix-Support
Advisor

How to create separte /usr which is created now on / file-system

In my Current HP-UX 11. 31 Server. /usr directory is created on same file-system /. Now the / file-system is filled because /usr directory needs more space.
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 3080192 2853984 226208 93% /
/dev/vg00/lvol1 1998072 103384 1694880 6% /stand
/dev/vg00/lvol7 61440000 860272 60106752 1% /var
/dev/vgxa1/lvtss1 674758656 9518281 623662859 2% /tss1
/dev/vg00/lvol6 4096000 25944 4041200 1% /tmp
/dev/vg00/lvol5 7176192 2983600 4159896 42% /opt
/dev/vg00/lvol4 5242880 4643824 594432 89% /home

I want to create separate file-system for /usr. My concern is how to copy the data which is there on /usr . Will it work if I do scp/tar? Which is better in this? Are any other method there to do same?

As /usr contains binary and lib files so I am confused if I do copy using scp will it give problem accessing the binary files later.

Thank you in Advance.
7 REPLIES 7
singh sanjeev
Trusted Contributor

Re: How to create separte /usr which is created now on / file-system

mount your new LV on /usr_new
enter the entry in fstab
copy the content from /usr to /usr_new

may be u have to go into single user mode and rename the original /usr to /usr.old and /usr_new to /usr


..correct me if i am wrong somewhere.
Sanjeev Singh
singh sanjeev
Trusted Contributor

Re: How to create separte /usr which is created now on / file-system

mount your new LV on /usr_new
enter the entry in fstab
copy[with tar ] the content from /usr to /usr_new

may be u have to go into single user mode and rename the original /usr to /usr.old and /usr_new to /usr


..correct me if i am wrong somewhere.
Sanjeev Singh
Pete Randall
Outstanding Contributor

Re: How to create separte /usr which is created now on / file-system

I have to wonder how your server got configured like this to start with. Normally /usr is created as a separate file system within vg00. You have all the other normal ones: /var, /tmp, /opt, /stand, /home. I also have to wonder about /var - it looks like it has 61 GB allocated to it and virtually none of it is used.

If I were you, I would do an Ignite make_tape_recovery, then boot from the tape, re-allocate all your root file systems with more realistic sizing and create a separate /usr volume, all at the same time.


Pete

Pete
Steven E. Protter
Exalted Contributor

Re: How to create separte /usr which is created now on / file-system

Shalom,

I'd create a new filesystem named /usrtemp

Since /usr is not currently on its own logical volume, you can't use dd to copy the contents.

So you will need to use cp -pr /usr /usrtemp

Then you can take your system to single user mode and change the mount information.

The reason we use /usrtemp (pick a name) in this case is there already is a /usr directory on the system. We go to single user to make sure no processes are open on the old infrastructure which will prevent a smooth transition.

There are probably 10 different ways to get this done.

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
Unix-Support
Advisor

Re: How to create separte /usr which is created now on / file-system

Hi All,

I am successfully able to create separate /usr file-system on HP-UX 11.31.
I followed below steps.
1. Created new lvol8 on vg00.
2. Mounted /dev/vg00/lvol8 as /user_new
3. tar the /usr contents (tar ├в cvf /usr_new/usr.tar usr)
4. Extracted the tar -xvf /usr_new/usr.tar (but it extracted as /usr_new/usr so again copied
scp ├в rp /user_new/usr /usr_new/
so I think No need of tar, Even scp works fine.
5. v the existing /usr as /usr.orig (mv /usr /usr.orig)
6. un-mounted /usr_new
7. mounted /dev/vg00/lvol8 as /usr
As this server is new and nobody accessing at that time so I think it allowed me to un-mount /usr_new and mount back as /usr.
Thank you for support and your precious time.


Pete Randall
Outstanding Contributor

Re: How to create separte /usr which is created now on / file-system

And thank you for the precious point!

I still say that your root file systems are totally mis-allocated and that should be addressed, but it's your system. Do with it what you will.


Pete

Pete
Michael Steele_2
Honored Contributor

Re: How to create separte /usr which is created now on / file-system

Hi

This looks good except I would use 'cp -p -r' instead of 'tar' for step 3.

Also, note that as long as the sub directory /usr, which is currently mounted to /, has enough space under /, then it is not a problem. Except to say that once you remove /usr from / then you're going to have a 2GB plus lvol3, formatted contiguously, instead of random like lvol8 is, and you'll be wasting disk.

Also note that having /usr under / is how you are going to see many Solaris and linux boxes and the occaisional HP-UX box. It's not really a problem and more of an organizational issue.
Support Fatherhood - Stop Family Law