Operating System - HP-UX
1832650 Members
2867 Online
110043 Solutions
New Discussion

Re: /dev erase by mistake

 
Fred Morin_1
Advisor

/dev erase by mistake

We erased /dev by mistake.

Now i'm not able to connect to the server with telnet and rlogin.

Not able to restore, because my tape is /dev/rmt/1m

What we have to do?
12 REPLIES 12
Mark Grant
Honored Contributor

Re: /dev erase by mistake

Try running "insf"

It re-creates all the device special files. Looks like you are going to have to do it from the console though.
Never preceed any demonstration with anything more predictive than "watch this"
Helen French
Honored Contributor

Re: /dev erase by mistake

One possible option (if you have an open active session with the server) is to recreate device files using:

# insf -e

And then restore your /dev directory completely from backup. If this doesn't work, you can recover the directory from make_tape_recovery (Ignite) tape.
Life is a promise, fulfill it!
Fred Morin_1
Advisor

Re: /dev erase by mistake

No.
I'm not able to connect with a console too,

I have the login prompt, but no tty are available.
Pete Randall
Outstanding Contributor

Re: /dev erase by mistake

If you can't login, then the only other option I see is to reboot. The device files will be re-created during the boot process just as if you had run insf. You will probably run into issues because you LVM device files aren't there so you'll have to limp through the boot and then restore /dev from backup.


Pete


Pete
A. Clay Stephenson
Acclaimed Contributor

Re: /dev erase by mistake

The technical term for your condition is "toast". It's time to pull out the Recovery Media, better still your Ignite tape -- that I'm sure that you have --- or even better pull out the boot disk and throw the "lifeboat" disk in the slot that you made with dd and be back in business.

A UNIX box just ain't gonna do nothing without no /dev directory on account of it ain't got no devices.

If it ain't broke, I can fix that.
GK_5
Regular Advisor

Re: /dev erase by mistake

Do you have Ignite backup? If downtime is allowed then recover it from Ignite backup.
IT is great!
Mark Grant
Honored Contributor

Re: /dev erase by mistake

Oh dear.

If you have absolutely no way of getting into this machine you have a slightly more difficult problem.

You might try running it using "rsh" from another machine, if only to create /dev/console. I don't think rsh needs a /dev entry BUT you will have lost a lot more than just terminal and tape and disk devices.

Never preceed any demonstration with anything more predictive than "watch this"
Fred Morin_1
Advisor

Re: /dev erase by mistake

We resolved our problem,

Logon CDE in failsafe mode.

insf -e

Restore with omniback /dev

Steven E. Protter
Exalted Contributor

Re: /dev erase by mistake

If your machine as A. Clay says is toast and there is no way to log in, you need to do as follows:

Take your latest make_tape_recovery tape and put it in the tape drive

power the machine off, since you can't log in and shut down

power it up.

Go to console

Interupt at the 10 second prompt

bo

Y Interact with the ISL
hpux -is

If it boots, do this.

find the mount command

mount /usr

insf -e

shutdown -ry now

If the solution works, you are on the road to recovery.

If not.

Power down again.

Interupt at the 10 second prompt at the console

sea


You'll see a sequential device. Sequential means tape. It will say something like P3

bo P3

N Do not interact.

Restore from that Ignite tape.
Its automated from there.

In case you are really screwed and can't recovery, you probably need to immediately explain to management that you made a big mistake and reinstall the operating system on that system. You might be able to get away without harming data, depending on how you laid out your volume groups.

When the system is back up, you need to run a script that looks like this once a week.

#!/usr/bin/sh
/opt/ignite/bin/make_tape_recovery -Av -x inc_entire=vg00

Good Luck,

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
A. Clay Stephenson
Acclaimed Contributor

Re: /dev erase by mistake

Here's a Plan "C" or "D" IF you have another box.

You could install the boot disk in another box, import the VG, and mount the root filesystem as, perhaps, /dev/root. You could then run mknod to create a few of the critical devices, along with /dev/vg00, and be back in business rather quickly. If you do have another box in which you can mount your boot disk then we can probably talk you through the process.

Yours is the kind of problem that mirrors don't help because you simply mirror your booboo's. That's why a "lifeboat disk" (or an Ignite tape) is such a good tool; it protects you from two things that mirrors do not: 1) really, really bad patches and 2) your own stupidity.

If it ain't broke, I can fix that.
doug mielke
Respected Contributor

Re: /dev erase by mistake

No help here, just a question:

I'm impressed that this was recoverable, and I've never tried to remove a /dev file.

If I tried rm -r /dev/* , why would it not try to access the devices there, try to 'erase' them, but leave my /dev/ directories alone?
Bill Hassell
Honored Contributor

Re: /dev erase by mistake

The rm -r /dev/* command will remove the device files *AND* directories below /dev leaving an empty /dev/ directoy. It turns out that you can remove device files for hardware like disks while the system is running since the device is already open (ie, LVM).

However, insf -e (or a reboot) is NOT guarenteed to create the same device file names. This is because insf scans the backplane as it exists at the moment. If you never added any new disks or tapes or LAN cards, most likely the device files will have the same name. When the system was first installed, the new device files were created the same way, but later I/O cards will not necessarily be in numerical order and the device names (based on the card's instance number) will likely not be the same.


Bill Hassell, sysadmin