Article View: comp.sys.sun
Article #7804Recovering from 'rm *' in the root directory.
From: Joe Smith
Date: Thu, 23 May 1991 18:47
Date: Thu, 23 May 1991 18:47
85 lines
3236 bytes
3236 bytes
After a recent disaster, we have added a new page to our "Disaster
Recovery Manual". I thought I'd post this in case it is of use to anyone
else.
------------------------------------
How to recover from an accidental "rm *" while cd'd to root.
On two of our servers a command was executed that ended up doing "rm *" as
root. This immediately wiped out all symbolic links and regular files in
the root directory, but left all the dot files and directories. This
error is a lot easier to recover from than "rm -r /".
The first indication of problems was that no new users can login; the file
/bin/login could not be found because the symbolic links "bin -> usr/bin"
and "lib -> usr/lib" were missing. Daemons and user programs running at
the time continued to run.
Attempts to reboot the system failed for two reasons. The file /vmunix
could not be found, and the PROM monitor could not load 'boot' because
/boot was deleted and its blocks were overwritten by some other file.
To return the system to operation, the following steps were performed:
Boot the mini-root from the SunOS-4.0 or SunOS-4.0.3 Installation tape.
>b xt(0,0,0)
Boot: xt(0,0,2)
From: xt(0,0,3)
To: xd(0,0,1)
Boot: xd(0,0,1)vmunix -asw
root device: xd0b
root type: 4.2
swap device: xd0b
swap type: spec
swap on root: y
#
Run 'fsck' on the root and usr partition. (Failure to do so will cause
the system to panic when copying files to the root partition.)
# fsck /dev/xd0a
# fsck /dev/xd0g
(each question fsck asked was answered with 'y' in this case)
Mount the xd0a root partition and 'cd' into it. Mount the /usr partition.
# mkdir /mnt
# mount /dev/xd0a /mnt
# mount /dev/xd0g /mnt/usr
# cd /mnt
Create the missing symbolic links.
# ln -s usr/bin .
# ln -s usr/lib .
# ln -s usr/share/sys .
Copy the three boot-related files from /usr back to root.
# cp usr/kvm/stand/boot.sun3 boot
# cp usr/kvm/boot/kadb .
# cp usr/kvm/boot/vmunix .
Use the customized kernel if it is still on disk.
# cp usr/share/sys/sun3/XDXT260_X25/vmunix .
Set up the boot block.
# cd /usr/kvm/mdec
# sync
# installboot -v /mnt/boot bootxd /dev/xd0a
# sync
Dismount the partitions.
# umount /dev/xd0g
# umount /dev/xd0a
Press the BREAK key, and boot up as normal.
Joe Smith (408)922-6220 | SMTP: jms@tardis.tymnet.com or jms@gemini.tymnet.com
BT Tymnet Tech Services | UUCP: ...!{ames,pyramid}!oliveb!tymix!tardis!jms
PO Box 49019, MS-C51 | BIX: smithjoe | CA license plate: "POPJ P," (PDP-10)
San Jose, CA 95161-9019 | humorous dislaimer: "My Amiga 3000 speaks for me."
Technical Details
Message-ID:
<2887@brchh104.bnr.ca>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!cunews2!bnrgate!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-requestShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews2!bnrgate!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request From: jms@tardis.tymnet.com (Joe Smith) Newsgroups: comp.sys.sun Subject: Recovering from 'rm *' in the root directory. Keywords: Miscellaneous Message-ID: <2887@brchh104.bnr.ca> Date: 23 May 91 18:47:00 GMT Sender: news@brchh104.bnr.ca Organization: Sun-Spots Lines: 86 Approved: Sun-Spots@rice.edu X-Original-Date: Mon, 6 May 91 00:39:21 PDT X-Sun-Spots-Digest: Volume 10, Issue 102, message 8 X-Note: Submissions: sun-spots@rice.edu, Admin: sun-spots-request@rice.edu