What are all the spaces in the /etc/fstab for

configurationfstab

I get that I can use mount to set up / directories and that I can use the /etc/fstab to remount them on reboot.

Testing the fstab file is also fun with mount -faV.

When I'm looking at the fstab file, the number of space is disconcerting. I would have expected one space (like a separator between command parameters) or four spaces (like a tab). I'm seeing seven spaces at a time, almost as convention.

My question is: What are all the spaces in the /etc/fstab for?

(Perhaps also – Will it matter if I get the wrong number?)

Best Answer

The number of spaces is a way to cosmetically separate the columns/fields. It has no meaning other than that. I.e. no the amount of white space between columns does not matter.

The space between columns is comprised of white space (including tabs), and the columns themselves, e.g. comma-separated options, mustn't contain unquoted white space.

From the fstab(5) man page:

[...] fields on each line are separated by tabs or spaces.

and

If the name of the mount point contains spaces these can be escaped as `\040'.

Example

With the following lines alignment using solely a single tab becomes hard to achieve. In the end the fstab without white space looks messier than what you consider disconcerting now.

/dev/md3 /data/vm btrfs defaults 0   0
/var/spool/cron/crontabs /etc/crontabs bind defaults,bind
//bkpsrv/backup /mnt/backup-server cifs iocharset=utf8,rw,credentials=/etc/credentials.txt,file_mode=0660,dir_mode=0770,_netdev

Can you still see the "columns"?

Related Question