Page 1 of 1

recovering from overwriting fstab

Posted: 2012/02/17 22:47:58
by hoodcanaljim
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

Re: recovering from overwriting fstab

Posted: 2012/02/18 00:00:29
by pschaff
[i][b]Bad Idea [TM]![/b][/i]

Short answer is [b]no[/b] - at least not easily. The [u][i]right way[/i][/u] 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]
fdisk -l
blkid | sort[/code]
There are likely to be other issues with /etc hiding.

Re: recovering from overwriting fstab

Posted: 2012/02/18 00:11:30
by hoodcanaljim
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

Re: recovering from overwriting fstab

Posted: 2012/02/18 00:15:13
by pschaff
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.

Re: recovering from overwriting fstab

Posted: 2012/02/18 01:12:08
by TrevorH
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]
mount /dev/mapper/VolGroup00-LogVol00 /mnt/sysimage
[/code]

Now you can edit /mnt/sysimage/etc/fstab and see its contents and work out how to fix it.