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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
07-09-2017, 04:59 AM
|
#1
|
LQ Newbie
Registered: Jul 2017
Posts: 1
Rep:
|
recover fstab
how to recover stab file
i have run the query on my system
rm -f /etc/fstab
i am using Cantos 7
|
|
|
07-09-2017, 05:46 AM
|
#2
|
LQ Guru
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
|
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.
|
|
|
07-09-2017, 07:15 AM
|
#3
|
Member
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
|
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"
#
|
|
|
07-09-2017, 08:49 AM
|
#4
|
Senior Member
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
|
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 05:32 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|