I modified /etc/fstab
.
I verified the new devices and I can mount them with the mount
command.
How may I validate the modifications made to /etc/fstab
?
asked Aug 25, 2010 at 2:51
You can simple run: mount -a
-a
Mount all filesystems (of the given types) mentioned in fstab.
This command will mount all (not-yet-mounted) filesystems mentioned in fstab and is used in system script startup during booting.
answered Aug 25, 2010 at 2:57
PrixPrix
4,9013 gold badges24 silver badges25 bronze badges
4
The mount command take an --fake
or -f
for short. The following command should do what you need:
mount -fav
The following is in the documentation for -f
option:
Causes everything to be done except for the actual system call; if it’s not obvious, this «fakes» mounting the filesystem. This option is useful in conjunction with the -v flag to determine what the mount command is trying to do.
(Note this is Linux — check before using elsewhere: FreeBSD uses -f
for ‘force’ — exactly the opposite meaning.)
Paul
3,0476 gold badges27 silver badges40 bronze badges
answered May 19, 2013 at 6:22
trondatronda
1,3911 gold badge10 silver badges13 bronze badges
6
sudo findmnt --verify --verbose
is the best way I’ve found
answered Aug 4, 2019 at 21:36
rockwotjrockwotj
1,2711 gold badge8 silver badges3 bronze badges
3
Note that if you add a swap file to your fstab, mount -a
won’t turn it on: you’ll want to run swapon -a
.
answered Mar 4, 2019 at 19:08
Ian HunterIan Hunter
2173 silver badges11 bronze badges
I found this /problem/ but the solution didn’t meet my requirements.
When rebooting with any invalid entries in the /etc/fstab, such as missing file systems that fsck cannot check; the system will fail to boot. That can be much more difficult to deal with if you have a headless box.
This is my solution to checking /etc/fstab to avoid this boot problem:
# cat /usr/local/bin/check-fstab-uuid-entries.sh
#!/usr/bin/env bash
for x in $(grep ^UUID /etc/fstab|cut -d \ -f 1|cut -d = -f 2)
do
if [ ! -h /dev/disk/by-uuid/$x ];then
echo $(grep $x /etc/fstab) ..... not found
fi
done
answered Apr 5, 2016 at 13:43
2
TBH even fake mounting doesn’t safely validate the fstab for bad fs type entries.
you can have entries that have correct uuid’s, directories etc but if you specify a noexistant FS type this will halt your boot next time.
[root@grumpy ~]# grep backup /etc/fstab UUID=5ed48e5e-7251-4d49-a273-195cf0432a89 /mnt/backup noatime,nodiratime,xfs defaults,nodev,nosuid 0 0 [root@grump ~]# [root@grumpy ~]# mount -fav | grep backup /mnt/backup : successfully mounted [root@grumpy ~]#
answered Aug 2, 2019 at 10:41
mount -a is safe method to check /etc/fstab otherwise wrong entry could break the system
It is also advised to keep a backup copy of original /etc/fstab file. it could be copied to home directory of root
answered Nov 28, 2016 at 7:36
I open another term or tab and run: tail -f /var/log/kern.log
Sometimes errors show there that don’t show when mounting.
answered Nov 8, 2020 at 21:59
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.
I modified /etc/fstab
.
I verified the new devices and I can mount them with the mount
command.
How may I validate the modifications made to /etc/fstab
?
asked Aug 25, 2010 at 2:51
You can simple run: mount -a
-a
Mount all filesystems (of the given types) mentioned in fstab.
This command will mount all (not-yet-mounted) filesystems mentioned in fstab and is used in system script startup during booting.
answered Aug 25, 2010 at 2:57
PrixPrix
4,9013 gold badges24 silver badges25 bronze badges
4
The mount command take an --fake
or -f
for short. The following command should do what you need:
mount -fav
The following is in the documentation for -f
option:
Causes everything to be done except for the actual system call; if it’s not obvious, this «fakes» mounting the filesystem. This option is useful in conjunction with the -v flag to determine what the mount command is trying to do.
(Note this is Linux — check before using elsewhere: FreeBSD uses -f
for ‘force’ — exactly the opposite meaning.)
Paul
3,0476 gold badges27 silver badges40 bronze badges
answered May 19, 2013 at 6:22
trondatronda
1,3911 gold badge10 silver badges13 bronze badges
6
sudo findmnt --verify --verbose
is the best way I’ve found
answered Aug 4, 2019 at 21:36
rockwotjrockwotj
1,2711 gold badge8 silver badges3 bronze badges
3
Note that if you add a swap file to your fstab, mount -a
won’t turn it on: you’ll want to run swapon -a
.
answered Mar 4, 2019 at 19:08
Ian HunterIan Hunter
2173 silver badges11 bronze badges
I found this /problem/ but the solution didn’t meet my requirements.
When rebooting with any invalid entries in the /etc/fstab, such as missing file systems that fsck cannot check; the system will fail to boot. That can be much more difficult to deal with if you have a headless box.
This is my solution to checking /etc/fstab to avoid this boot problem:
# cat /usr/local/bin/check-fstab-uuid-entries.sh
#!/usr/bin/env bash
for x in $(grep ^UUID /etc/fstab|cut -d \ -f 1|cut -d = -f 2)
do
if [ ! -h /dev/disk/by-uuid/$x ];then
echo $(grep $x /etc/fstab) ..... not found
fi
done
answered Apr 5, 2016 at 13:43
2
TBH even fake mounting doesn’t safely validate the fstab for bad fs type entries.
you can have entries that have correct uuid’s, directories etc but if you specify a noexistant FS type this will halt your boot next time.
[root@grumpy ~]# grep backup /etc/fstab UUID=5ed48e5e-7251-4d49-a273-195cf0432a89 /mnt/backup noatime,nodiratime,xfs defaults,nodev,nosuid 0 0 [root@grump ~]# [root@grumpy ~]# mount -fav | grep backup /mnt/backup : successfully mounted [root@grumpy ~]#
answered Aug 2, 2019 at 10:41
mount -a is safe method to check /etc/fstab otherwise wrong entry could break the system
It is also advised to keep a backup copy of original /etc/fstab file. it could be copied to home directory of root
answered Nov 28, 2016 at 7:36
I open another term or tab and run: tail -f /var/log/kern.log
Sometimes errors show there that don’t show when mounting.
answered Nov 8, 2020 at 21:59
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.
/etc/fstab contains information about the disks. It has the details about where the partitions and storage devices should be mounted. We usually configure automount, disk quota, mount points etc in this fstab.
Inorder to test the entries or modifications in fstab without restart the following commands will be helpful
mount -a
The above command will mount all the filesystems mentioned in the fstab. This is just like a refresh command to activate the entries in fstab.
mount -fav
The above command will help if you don’t want to apply the modifications in the fstab and want to validate the entries only. This will just fake the entries in the fstab without applying the changes. This is a very useful command.
Проверьте информацию статической файловой системы, определенную в файле fstab, после применения изменений, чтобы убедиться, что ваша система загрузится без проблем.
Это особенно важно в удаленных местах или машинах, где вы не можете легко выполнить экстренные операции.
Отображение статической информации о файловой системе, определенной в файле fstab.
# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # # / was on /dev/vda1 during installation UUID=9d749b55-a024-4d89-b1c0-950bd38b98d8 / ext4 errors=remount-ro 0 1 # swap was on /dev/vda5 during installation UUID=33d7420a-1ab7-4872-8944-369c37354d1b none swap sw 0 0 /dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
Проверьте содержимое файла /etc/fstab.
/media/cdrom0 [W] udf,iso9660 seems unsupported by the current kernel [W] cannot detect on-disk filesystem type 0 parse errors, 0 errors, 2 warnings
Проверьте содержимое файла /etc/fstab и выведите подробный вывод.
$ sudo findmnt --verify --verbose
/ [ ] target exists [ ] FS options: errors=remount-ro [ ] UUID=9d749b55-a024-4d89-b1c0-950bd38b98d8 translated to /dev/vda1 [ ] source /dev/vda1 exists [ ] FS type is ext4 none [ ] UUID=33d7420a-1ab7-4872-8944-369c37354d1b translated to /dev/vda5 [ ] source /dev/vda5 exists [ ] FS type is swap /media/cdrom0 [ ] target exists [ ] userspace options: user,noauto [ ] source /dev/sr0 exists [W] udf,iso9660 seems unsupported by the current kernel [W] cannot detect on-disk filesystem type 0 parse errors, 0 errors, 2 warnings
Проверьте статическую информацию о типе файловой системы ext4, определенную в конкретном файле (таблица смонтированных файловых систем).
$ sudo findmnt --verify --tab-file /etc/mtab --type ext4
/ [W] recommended root FS passno is 1 (current is 0) 0 parse errors, 0 errors, 1 warning
Пример статического файла с информацией о файловой системе, который намеренно содержит несколько ошибок.
# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # # / was on /dev/vda1 during installation UUID=9d749b55-a024-4d89-b1c0-950bd38b98d8 / ext3 errors=remount-ro UUID=9d749b55-a024-4d89-b1c0-950bd38b98d8 /opt xt4 errors=remount-ro 0 # swap was on /dev/vda5 during installation UUID=33d7420a-1ab7-4872-8944-369c37354d1b none swap sw 0 0 /dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0
Проверьте это несовместимое и ошибочное содержимое файла.
/ [E] ext3 does not match with on-disk ext4 [W] recommended root FS passno is 1 (current is 0) /opt [W] xt4 seems unsupported by the current kernel [E] xt4 does not match with on-disk ext4 /media/cdrom0 [W] udf,iso9660 seems unsupported by the current kernel [W] cannot detect on-disk filesystem type 0 parse errors, 2 errors, 4 warnings
Код вывода укажет, что произошла ошибка.
1
Отобразите подробный вывод, чтобы изучить его дальше.
$ sudo findmnt --verify --tab-file /etc/fstab --verbose
/ [ ] target exists [ ] FS options: errors=remount-ro [ ] UUID=9d749b55-a024-4d89-b1c0-950bd38b98d8 translated to /dev/vda1 [ ] source /dev/vda1 exists [E] ext3 does not match with on-disk ext4 [W] recommended root FS passno is 1 (current is 0) /opt [ ] target exists [ ] FS options: errors=remount-ro [ ] UUID=9d749b55-a024-4d89-b1c0-950bd38b98d8 translated to /dev/vda1 [ ] source /dev/vda1 exists [W] xt4 seems unsupported by the current kernel [E] xt4 does not match with on-disk ext4 none [ ] UUID=33d7420a-1ab7-4872-8944-369c37354d1b translated to /dev/vda5 [ ] source /dev/vda5 exists [ ] FS type is swap /media/cdrom0 [ ] target exists [ ] userspace options: user,noauto [ ] source /dev/sr0 exists [W] udf,iso9660 seems unsupported by the current kernel [W] cannot detect on-disk filesystem type 0 parse errors, 2 errors, 4 warnings
You may also like
Leave a Comment
I have been using the following command so far to verify my /etc/fstab
:
sudo findmnt --verify
Unfortunately, it spills out warnings for each unreachable disk (which I don’t care about) and I have not found a flag to change that. Any clever tip to get rid of these warnings or an alternative standard tool?
asked Feb 7, 2022 at 19:27
4
You can use sudo findmnt -T /mnt/foo
or sudo findmnt -S UUID=insertuuidhere
to limit devices you want to verify, though you can only specify one device at a time (run the command for each device)
or you can specify a separate fstab file and use sudo findmnt -F /path/to/alt/fstab --verify
and remove entries you don’t need in the latter.
answered Jul 19, 2022 at 8:36
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.