recovering from overwriting fstab

General support questions including new installations
Post Reply
hoodcanaljim
Posts: 312
Joined: 2006/02/05 17:49:10

recovering from overwriting fstab

Post by 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

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: recovering from overwriting fstab

Post by pschaff » 2012/02/18 00:00:29

[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.

hoodcanaljim
Posts: 312
Joined: 2006/02/05 17:49:10

Re: recovering from overwriting fstab

Post by 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

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: recovering from overwriting fstab

Post by 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.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: recovering from overwriting fstab

Post by 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]
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.

Post Reply