LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-09-2017, 03:59 AM   #1
nandlal
LQ Newbie
 
Registered: Jul 2017
Posts: 1

Rep: Reputation: Disabled
recover fstab


how to recover stab file
i have run the query on my system

rm -f /etc/fstab

i am using Cantos 7
 
Old 07-09-2017, 04:46 AM   #2
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 20 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918
Hello, nandial, and welcome to LQ.

Can you restore the file from the last backup you made?

If not, your best bet is to recreate the file.

Alternatively you can try to undelete the file using a data recovery utility.
 
Old 07-09-2017, 06:15 AM   #3
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 363Reputation: 363Reputation: 363Reputation: 363
IF this is a 'real' ..., tell us why you did this. Anyway, here's some things to try:
Code:
# grep -v ^# /etc/fstab.hidden #Goal is to *RE-construct like* this:
/dev/mapper/centos_lvm-root /                       xfs     defaults        1 1
UUID=f3b744e4-e754-4842-93d1-43b06de64b66 /boot     xfs     defaults        1 2
UUID=971d09b6-8ce8-49c7-9ec9-16b0155f42cf swap      swap    defaults        0 0
# 
# df | grep ^/
/dev/mapper/centos_lvm-root   6813696 4544620   2269076  67% /
/dev/sda1                      508588  209632    298956  42% /boot
# egrep -w '/|/boot' /proc/mounts
rootfs / rootfs rw 0 0
/dev/mapper/centos_lvm-root / xfs rw,seclabel,relatime,attr2,inode64,noquota 0 0
/dev/sda1 /boot xfs rw,seclabel,relatime,attr2,inode64,noquota 0 0
# blkid
/dev/sda1: UUID="f3b744e4-e754-4842-93d1-43b06de64b66" TYPE="xfs"
/dev/sda2: UUID="kIogiH-f548-AELA-NMVK-sbr7-9u7j-2K6MDz" TYPE="LVM2_member"
/dev/sdb1: UUID="971d09b6-8ce8-49c7-9ec9-16b0155f42cf" TYPE="swap"
/dev/mapper/centos_lvm-root: UUID="b66fdf9b-16f0-4648-9663-536881db0ab1" TYPE="xfs"
#
 
Old 07-09-2017, 07:49 AM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,396
Blog Entries: 8

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
If you really know what you're doing, you can recreate currently mounted entries based on /etc/mtab. But there will be a heck of a lot of lines in /etc/mtab which you do NOT want in /etc/fstab. Any lines with file system type "ext4", you will want.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
/etc/fstab overwritten Please help to recover sagar666 Linux - Server 15 09-08-2015 10:07 AM
how recover /etc/fstab dineshdhiman Red Hat 6 09-20-2011 09:22 AM
How to recover fstab sunny_rhce Linux - Enterprise 2 03-10-2007 01:13 AM
Recover FSTAB bisht_mohit Linux - Desktop 1 02-04-2007 12:49 AM
Knoppix to recover fstab? kurtwisener Linux - Software 2 06-12-2005 12:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:40 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