LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-31-2015, 08:15 AM   #1
sagar666
Member
 
Registered: Feb 2013
Posts: 212

Rep: Reputation: Disabled
/etc/fstab overwritten Please help to recover


Hi,

By mistakenly i overwritten /etc/fstab like below

echo "bigfoot:/t6_dump /t6_dump nfs ro,sync,tcp,nfsvers=3,rsize=262144,wsize=262144 0 0" > /etc/fstab

instead of using >> i have used it > It has 50 servers all got overwritten with above entry and i don't have backup.

[root@vncin47 etc]# cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext3 rw,data=ordered 0 0
/dev /dev tmpfs rw 0 0
/proc /proc proc rw 0 0
/sys /sys sysfs rw 0 0
/proc/bus/usb /proc/bus/usb usbfs rw 0 0
devpts /dev/pts devpts rw 0 0
/dev/sda1 /boot ext3 rw,data=ordered 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
bigfoot:/ecad /ecad nfs ro,sync,vers=3,rsize=262144,wsize=262144,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=bigfoot 0 0
bigfoot:/pd1 /pd1 nfs ro,sync,vers=3,rsize=262144,wsize=262144,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=bigfoot 0 0
bigfoot:/pd3 /pd3 nfs ro,sync,vers=3,rsize=262144,wsize=262144,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=bigfoot 0 0
bigfoot:/pd5 /pd5 nfs ro,sync,vers=3,rsize=262144,wsize=262144,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=bigfoot 0 0
bigfoot:/pd6 /pd6 nfs ro,sync,vers=3,rsize=262144,wsize=262144,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=bigfoot 0 0
bigfoot:/pd8 /pd8 nfs ro,sync,vers=3,rsize=262144,wsize=262144,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=bigfoot 0 0
bigfoot:/dv3 /dv3 nfs rw,sync,vers=3,rsize=262144,wsize=262144,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=bigfoot 0 0
asteroid:/dv4 /dv4 nfs rw,vers=3,rsize=65536,wsize=65536,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=asteroid 0 0
asteroid:/dv5 /dv5 nfs rw,vers=3,rsize=65536,wsize=65536,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=asteroid 0 0
bigfoot:/dv6 /dv6 nfs rw,vers=3,rsize=65536,wsize=65536,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=bigfoot 0 0
/etc/auto.misc /misc autofs rw,fd=6,pgrp=2822,timeout=300,minproto=5,maxproto=5,indirect 0 0
-hosts /net autofs rw,fd=12,pgrp=2822,timeout=300,minproto=5,maxproto=5,indirect 0 0
auto.home /home autofs rw,fd=18,pgrp=2822,timeout=60,minproto=5,maxproto=5,indirect 0 0
10.193.182.150:/hw_home/murali /home/murali nfs rw,vers=3,rsize=1048576,wsize=1048576,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=bigfoot 0 0
bigfoot:/pd7 /pd7 nfs ro,sync,vers=3,rsize=262144,wsize=262144,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=bigfoot 0 0

I got nfs share mount point info and but i did not get system mount point info

If any one server reboots it wont boot. Is there any way i can restore before server reboot? Please help. Immediate help is highly appreciated.

Last edited by sagar666; 08-31-2015 at 08:18 AM.
 
Old 08-31-2015, 08:43 AM   #2
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 875

Rep: Reputation: 282Reputation: 282Reputation: 282
First "cat /proc/mounts > /etc/fstab"

It wont be pretty but it should let it boot, actually it will have an incorrect / partition as yours is showing /dev/root (fix it manually)

You'll have to clean it up from that depending on your distro's startup files some of those mounts will be done directly.
 
Old 08-31-2015, 08:50 AM   #3
sagar666
Member
 
Registered: Feb 2013
Posts: 212

Original Poster
Rep: Reputation: Disabled
Thanks for the quick help and its RHEL 5.7. Please help me how exactly need to be modify for root filesystem.

blkid shows
/dev/sr0: LABEL="RHEL/5.7 x86_64 DVD" TYPE="iso9660"
/dev/sda5: LABEL="/share" UUID="4f1dbed0-3ab9-4ec1-b6e7-3db6a1974e30" TYPE="ext3"
/dev/sda3: LABEL="SWAP-sda3" TYPE="swap"
/dev/sda2: LABEL="/" UUID="76635581-564e-42b3-a596-2d0d46d1fb13" TYPE="ext3"
/dev/sda1: LABEL="/boot" UUID="097e37c6-0113-441f-8c5e-3abcdcc5fcf5" TYPE="ext3"

/dev/sda2: LABEL="/" UUID="76635581-564e-42b3-a596-2d0d46d1fb13" TYPE="ext3" is root right?

Last edited by sagar666; 08-31-2015 at 08:52 AM.
 
Old 08-31-2015, 08:53 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Post the output of the command
/sbin/blkid
 
Old 08-31-2015, 08:59 AM   #5
sagar666
Member
 
Registered: Feb 2013
Posts: 212

Original Poster
Rep: Reputation: Disabled
blkid shows
/dev/sr0: LABEL="RHEL/5.7 x86_64 DVD" TYPE="iso9660"
/dev/sda5: LABEL="/share" UUID="4f1dbed0-3ab9-4ec1-b6e7-3db6a1974e30" TYPE="ext3"
/dev/sda3: LABEL="SWAP-sda3" TYPE="swap"
/dev/sda2: LABEL="/" UUID="76635581-564e-42b3-a596-2d0d46d1fb13" TYPE="ext3"
/dev/sda1: LABEL="/boot" UUID="097e37c6-0113-441f-8c5e-3abcdcc5fcf5" TYPE="ext3"
 
Old 08-31-2015, 09:22 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
No backups?

I would save the output of /proc/mounts to a file but not /etc/fstab. I do not see the /share mounted but you can add it. I can not guarantee it matches the original minus the nfs mounts but should boot...

Code:
LABEL=/                 /                       ext3    rw                      0 0 
LABEL=/boot             /boot                   ext3    rw,data=ordered         0 0 
/LABEL=SWAP-sda3        swap                    swap    defaults                0 0
tmpfs                   /dev/shm                tmpfs   defaults                0 0
devpts                  /dev/pts                devpts  defaults                0 0
sysfs                   /sys                    sysfs   defaults                0 0
proc                    /proc                   proc    defaults                0 0

Last edited by michaelk; 08-31-2015 at 01:07 PM.
 
1 members found this post helpful.
Old 08-31-2015, 10:17 AM   #7
sagar666
Member
 
Registered: Feb 2013
Posts: 212

Original Poster
Rep: Reputation: Disabled
thanks a lot michaelk and No backup,

I have changed to /etc/fstab/ like below. anything wrong in below file or I need to put format like above you mentioned?

/dev/mapper/VolGroup00-LogVol00 / ext3 rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
/dev/sda1 /boot ext3 rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
bigfoot:/ecad /ecad nfs ro,sync,tcp,nfsvers=3,rsize=262144,wsize=262144 0 0
bigfoot:/pd1 /pd1 nfs ro,sync,tcp,nfsvers=3,rsize=262144,wsize=262144 0 0
bigfoot:/pd3 /pd3 nfs ro,sync,tcp,nfsvers=3,rsize=262144,wsize=262144 0 0
bigfoot:/pd5 /pd5 nfs ro,sync,tcp,nfsvers=3,rsize=262144,wsize=262144 0 0
bigfoot:/pd6 /pd6 nfs ro,sync,tcp,nfsvers=3,rsize=262144,wsize=262144 0 0
bigfoot:/pd8 /pd8 nfs ro,sync,tcp,nfsvers=3,rsize=262144,wsize=262144 0 0
bigfoot:/dv3 /dv3 nfs rw,sync,tcp,nfsvers=3,rsize=262144,wsize=262144 0 0
asteroid:/dv4 /dv4 nfs rw,tcp,nfsvers=3,rsize=65536,wsize=65536 0 0
asteroid:/dv5 /dv5 nfs rw,tcp,nfsvers=3,rsize=65536,wsize=65536 0 0
bigfoot:/dv6 /dv6 nfs rw,tcp,nfsvers=3,rsize=65536,wsize=65536 0 0
bigfoot:/pd7 /pd7 nfs ro,sync,tcp,nfsvers=3,rsize=262144,wsize=262144 0 0
bigfoot:/t6_dump /t6_dump nfs ro,sync,tcp,nfsvers=3,rsize=262144,wsize=262144 0 0

Thanks
 
Old 08-31-2015, 10:51 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Yes, you did not include swap and your / does not belong to a LVM. Those values are the defaults so it should not matter.

Does not go in fstab.
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0

Last edited by michaelk; 08-31-2015 at 11:28 AM. Reason: Additional info.
 
Old 08-31-2015, 12:58 PM   #9
sagar666
Member
 
Registered: Feb 2013
Posts: 212

Original Poster
Rep: Reputation: Disabled
Hi Michael,

So you are telling i have not added swap and root partition in fstab file? and none sunrpc isnot need in fstab Right?
 
Old 08-31-2015, 01:08 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Yes, what you posted for your root partition is not correct.

Code:
LABEL=/  /    ext3    rw      0 0
 
Old 09-08-2015, 05:34 AM   #11
sagar666
Member
 
Registered: Feb 2013
Posts: 212

Original Poster
Rep: Reputation: Disabled
Hi Michaelk,

One my server shows blkid like below

/dev/sr0: LABEL="RHEL/5.7 x86_64 DVD" TYPE="iso9660"
/dev/sda3: LABEL="/share1" UUID="c991154f-fa69-4340-914f-3e114950a136" TYPE="ext3"
/dev/sda2: LABEL="SWAP-sda2" TYPE="swap"
/dev/sda1: LABEL="/1" UUID="542a5bd7-3057-43c4-96a7-668f2d34c6c2" TYPE="ext3"

For above blkid i need to write /etc/fstab for root like below?

LABEL=/1 / ext3 rw 0 0

why it is showing like /1?

Also boot partition not showing why in blkid output?

Last edited by sagar666; 09-08-2015 at 05:40 AM. Reason: Also boot partition not showing why in blkid output?
 
Old 09-08-2015, 08:51 AM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Tell us what you did?

It appears that you reinstalled along side the original. You can't have multiple partitions with the same label so the installer adds a 1. And during the install process you did not select a boot partition.
 
Old 09-08-2015, 09:11 AM   #13
sagar666
Member
 
Registered: Feb 2013
Posts: 212

Original Poster
Rep: Reputation: Disabled
Hi Michaelk,

As i said earlier i overwrite the fstab entry in almost 50 server. Today i tried correct fstab entry as you suggested earlier but when do blkid its showing like below and i wondered why boot file system not showing when i do blkid

/dev/sr0: LABEL="RHEL/5.7 x86_64 DVD" TYPE="iso9660"
/dev/sda3: LABEL="/share1" UUID="c991154f-fa69-4340-914f-3e114950a136" TYPE="ext3"
/dev/sda2: LABEL="SWAP-sda2" TYPE="swap"
/dev/sda1: LABEL="/1" UUID="542a5bd7-3057-43c4-96a7-668f2d34c6c2" TYPE="ext3"

I have not reinstalled any thing and same behavior in few more machines.
 
Old 09-08-2015, 09:20 AM   #14
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Sorry you did mention 50 servers. About all I can say is the installations are not identical and these servers do not have a separate boot partition.
 
Old 09-08-2015, 09:42 AM   #15
sagar666
Member
 
Registered: Feb 2013
Posts: 212

Original Poster
Rep: Reputation: Disabled
So without boot partition system will boot? I guess root and boot partition are mandatory Right?
 
  


Reply

Tags
fstab, linux, nfs



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to recover overwritten file Imtiaz Deen Linux - General 12 06-20-2019 08:20 AM
[SOLVED] rebuild overwritten fstab? zedmelon Linux - General 11 05-24-2013 06:01 PM
Is there way to recover a overwritten log file. Vthimmap Linux - Newbie 1 10-05-2012 05:35 AM
How can I recover firefox which was overwritten bhatmahesht Linux - Software 1 05-05-2008 05:18 AM
fstab overwritten? (RedHat 8) hoborocks Linux - Software 2 01-08-2003 11:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration