LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   recover fstab (https://www.linuxquestions.org/questions/linux-newbie-8/recover-fstab-4175609500/)

nandlal 07-09-2017 03:59 AM

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

rm -f /etc/fstab

i am using Cantos 7

hydrurga 07-09-2017 04:46 AM

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.

Jjanel 07-09-2017 06:15 AM

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"
#


IsaacKuo 07-09-2017 07:49 AM

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.


All times are GMT -5. The time now is 12:15 AM.