Operating System - HP-UX
1838541 Members
4034 Online
110127 Solutions
New Discussion

recovery from loss of /usr/bin and /usr/sbin

 
SOLVED
Go to solution
ramesh_6
Frequent Advisor

recovery from loss of /usr/bin and /usr/sbin

Hi
I've a HP-UX K-class server. We rebooted the server after a long time. There was problem while booting. I found the /etc/inittab entry was corrupt and respawning multiple times without stopping.

I went into single user mode and tried to edit /etc/inittab but to my dismay found /usr/bin and /usr/sbin missing. So i went on a plan to backup the existing data and rebuild the machine.

Since /usr/bin and /usr/sbin missing how should i be able to backup the data? Is there a way to copy the /usr/bin from another server HP-ux 11.00 to this server. Is that will work? Any help is highly appreciated.

Regds
Ramesh
11 REPLIES 11
harry d brown jr
Honored Contributor

Re: recovery from loss of /usr/bin and /usr/sbin

Did you mount /usr while you were in single user mode?

live free or die
harry
Live Free or Die
ramesh_6
Frequent Advisor

Re: recovery from loss of /usr/bin and /usr/sbin

I have mounted /usr

Regds
Ramesh
Patrick Wallek
Honored Contributor

Re: recovery from loss of /usr/bin and /usr/sbin

Whoa now.... Lets back up a bit before you panic and rebuild your system.

When you boot into single-user mode, NOTHING gets mounted. If you want access to /usr, /var, and other parts of VG00 then you have to mount them manually.

Do a:

# vgchange -a y vg00
# mount -a

This will make sure that vg00 is activated and the 'mount -a' will mount everything that it can with vg00 active. If you have other VGs and you get errors when you do the mount, don't worry. Mount can't mount anything unless the other volume groups are active. You probably don't need to worry about them right now.

Once you do the 'mount -a' you will have access to /usr and everything else in vg00. Now try modifying your inittab and go from there.

There is no good reason for a re-install yet.
H.Merijn Brand (procura
Honored Contributor

Re: recovery from loss of /usr/bin and /usr/sbin

if the mount refuses for whatever reason, you might want to try `repairing' the possibly damaged file system with fsck

by any means, have the instant information handy, most likely now mounted on a pc, so you *can* access the manual pages
Enjoy, Have FUN! H.Merijn
Bill Hassell
Honored Contributor

Re: recovery from loss of /usr/bin and /usr/sbin

Single user mode means: no mounted filesystems at all (except / and possibly /stand). Therefore, vi will be missing because /usr is not mounted. So it is very likely not missing, /usr is simply not mounted. Since VG00 is already activated, just type the two commands:

mount /var
mount /usr

(you need both to run vi)

Don't try to restore any data to /usr as it is really the / driectory. It becomes the /usr volume after mount is performed.

Something I like to do in single user mode is to create a reminder in *every* mountpoint directory. The reminder lets me know why there are no files there. So in single user mode, I will type the commands:

umask 077
touch /usr/IamNOTmounted
touch /var/IamNOTmounted
...

and so on. Or in a loop:

for MYDIR in /usr /var /opt /home /tmp
do
touch $MYDIR/IamNOTmounted
done

Feel free to add other directories like /ora1 /ora2 or whatever additional mountpoints you have.


Bill Hassell, sysadmin
MANOJ SRIVASTAVA
Honored Contributor

Re: recovery from loss of /usr/bin and /usr/sbin

Hi Ramesh


Please go into single user mode , then
run fsck -y /dev/vg00/rvol*
then do a mount -a

and you are good to go.


Manoj Srivastava
ramesh_6
Frequent Advisor

Re: recovery from loss of /usr/bin and /usr/sbin

Hi all thanks for all your replies. But i would like to tell you that i've mounted /usr and after that i am not able to see any of the binaries in /usr/bin.

All your help is hihgly appreciated

Regds
Ramesh
Michael Tully
Honored Contributor

Re: recovery from loss of /usr/bin and /usr/sbin

Hi,

If these files are definitely missing you will need to recover them. The simplest way is to get them off you latest ignite tape (assuming you have one) and change to the device that your using.

# cd /
# mt -t /dev/rmt/0mn rew
# mt -t /dev/rmt/0mn fsf 1
# tar xvf usr/bin
# mt -t /dev/rmt/0m rew
# mt -t /dev/rmt/0mn fsf 1
# tar xvf usr/sbin

If you don't have an ignite tape you will need
to recover from your local backup method. It
certainly seems that someone has run an 'rm -rf' on your system. Are there any other directories missing information in /usr ?? /usr/contrib
/usr/etc

-Michael
Anyone for a Mutiny ?
Magdi KAMAL
Respected Contributor

Re: recovery from loss of /usr/bin and /usr/sbin

Hi Ramesh,

I am afraid you need to rebuild your box !

Since you do not have any binaries in /usr/bin then you also do not have any of the restaure commands (ie. tar, frecover, cpio) !

So you are NOT able even to :

1. copy them from another system via tape.

2. Mount root disk from another server into your actual server and copy the /usr/bin and /usr/sbin since you do not have the "cp" command under /usr/bin !

So Sorry for that ... You need to rebuild.
Good luck.

Magdi
Michael Tully
Honored Contributor
Solution

Re: recovery from loss of /usr/bin and /usr/sbin

Under HPUX 11, there is a hard link for tar,
pax (which can use cpio) and frecover under /sbin

# ls /sbin
(ls is also under /sbin)
Anyone for a Mutiny ?
Magdi KAMAL
Respected Contributor

Re: recovery from loss of /usr/bin and /usr/sbin

Hi Michael,

You are right ... I forgot to check it in the /sbin ! And I hope in this case that the /sbin had not been removed also !

Magdi