Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ?

share|improve this question
up vote 49 down vote accepted

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.

share|improve this answer
1  
...and compare it to /etc/mtab once you've done a "sudo mount -a", just to make sure all your options have been honoured. – adebaumann Aug 25 '10 at 10:25
1  
mount -a by rereading /etc/fstab would also reload /etc/mtab so he should be fine with that only. – Prix Aug 26 '10 at 2:41
    
isn't that the point which adebaumann is trying to raise here? mount -a might return success, but doesn't necessarily mean that all the specific mount options have been honoured. since this will also reload /etc/mtab, you should check to see if all option are working? – RapidWebs Jun 28 '14 at 7:21

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.

share|improve this answer
2  
mount -fav doesn't check that device with specified UUID is actually in the system. Also one would like to combine -f with -n not to pollute /etc/mtab – Alexandr Priymak Feb 6 '15 at 17:55

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.