recovering from overwriting fstab

General support questions including new installations

recovering from overwriting fstab

Postby hoodcanaljim » 2012/02/17 22:47:58

Hi

Is there a way to recover from overwriting fstab? I reinstalled 5.7 and then ran tar -xvf restoring /etc and /home. That has caused the system to no longer boot and I am guessing that it is because of different LVM names.

Thanks
Jim

edit:
linux rescue mode does not give a chroot option instead reports problem trying to mount some
or all of your system.

lvm lvs reports

LogVol00 VolGroup00 -wi -a- 43.97G
LogVol01 VolGroup00 -wi -a- 1.00G

fdisk -l reports

/dev/hda1 1 13 104391 83 Linux
/dev/hda2 14 1023 8112825 8e Linux
/dev/hda3 1024 2434 11333857+ c Win95 FAT32 (LBA)

/dev/hdb1 1 4865 39078081 83 Linux LVM
hoodcanaljim
 
Posts: 196
Joined: 2006/02/05 17:49:10

Re: recovering from overwriting fstab

Postby pschaff » 2012/02/18 00:00:29

Bad Idea [TM]!

Short answer is no - at least not easily. The right way is to compare old and new files in /etc and adjust. Restoring /home may also be problematic if SELinux contexts were not preserved, or if there was a big change in the OS.

If you just reinstalled another reinstall may be the easiest way to go.

To proceed, please show the following from a rescue or LiveCD boot:
Code: Select all
fdisk -l
blkid | sort

There are likely to be other issues with /etc hiding.
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: recovering from overwriting fstab

Postby hoodcanaljim » 2012/02/18 00:11:30

Phil

fdisk -l output was edited into my original post. You may not have caught it.

blkid is not available on the compromised system.

I am going to take your advise and reinstall.
But after the install how should I recover the original data now stored in a tar file on another computer?
Just running tar -xvf sometar over writes to many files. Is there an easy way to avoid my original error?

Thanks
Jim
hoodcanaljim
 
Posts: 196
Joined: 2006/02/05 17:49:10

Re: recovering from overwriting fstab

Postby pschaff » 2012/02/18 00:15:13

Restore to a subdirectory and then copy or compare/edit files as required. Tar automatically removes the leading "/" to enable this, and to prevent the issues you encountered.
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: recovering from overwriting fstab

Postby TrevorH » 2012/02/18 01:12:08

So drop to a command prompt in the rescue disk and manually mount the filesystem in question. From the looks of it, you need to

Code: Select all
mount /dev/mapper/VolGroup00-LogVol00 /mnt/sysimage


Now you can edit /mnt/sysimage/etc/fstab and see its contents and work out how to fix it.
User avatar
TrevorH
Forum Moderator
 
Posts: 9103
Joined: 2009/09/24 10:40:56
Location: Brighton, UK


Return to CentOS 5 - General Support

Who is online

Users browsing this forum: Bing [Bot] and 1 guest