Operating System - HP-UX
1839998 Members
2798 Online
110158 Solutions
New Discussion

If I delete the files /etc by accident. How could I restore them back?

 
Apichart_2
New Member

If I delete the files /etc by accident. How could I restore them back?

If I delete the files under /etc by accident with (rm *). How could I restore them back?
make_recovery can help?
7 REPLIES 7
Massimo Bianchi
Honored Contributor

Re: If I delete the files /etc by accident. How could I restore them back?

It's theory or practice ?

Best solution would be to use frecover / makre_tape_recovery, but for sure you would need a reovery CD to start the server.


Even booting in LVM mode will be problematic.


Best way is to avoid this situation: for example, creare an alias where rm='rm -i', so that you are always prompted with confirmation BEFORE the damage.

If it happens.... it's too late.

HTH,
Massimo
Apichart_2
New Member

Re: If I delete the files /etc by accident. How could I restore them back?

It did happen. No way to restore them?
How about make_tape_recovery?
I used to do make_tape_recovery but I don't know if it cna help.
Slawomir Gora
Honored Contributor

Re: If I delete the files /etc by accident. How could I restore them back?

Hi,

if you have make_recovery tape you can restore
/etc by:

mt -f /dev/rmt/0mn rewind
mt -f /dev/rmt/0mn fsf 1
tar xvf /dev/rmt/0m etc


Apichart_2
New Member

Re: If I delete the files /etc by accident. How could I restore them back?

May you explain me more?
What does "mt -f /dev/rmt/0mn fsf 1" do?
Thanks a lot, You could save my life.
Massimo Bianchi
Honored Contributor

Re: If I delete the files /etc by accident. How could I restore them back?

Hi,
yes, it can help.

From "man make_recovery" (older version)

To extract a single file from the recovery archive:

mt -t /dev/rmt/0mn fsf 1
tar -xvf /dev/rmt/0m filename

Extracting files from tape can take a long time, especially when
archives are large.


HTH,
Massimo
Slawomir Gora
Honored Contributor

Re: If I delete the files /etc by accident. How could I restore them back?

Hi,
mt -f /dev/rmt/0mn fsf 1
- tape is positioned on the beginning sied of the 1-file

first file 0 - it is LIF header
second file 1 - it is file containing archived files by make_recovery

Cheryl Griffin
Honored Contributor

Re: If I delete the files /etc by accident. How could I restore them back?

First restore the files from /usr/newconfig/etc

In doing so, you will at least have an /etc/passwd as well as all other critical files that otherwise without them would render the system unbootable in multiuser.

Next restore any system specifc files from a backup, such as passwd, nsswitch.conf, resolv.conf (any custom *.conf file), inittab, fstab, etc.
"Downtime is a Crime."