[systemd-devel] Get rid of /etc/fstab

Lennart Poettering lennart at poettering.net
Mon Feb 4 01:18:44 PST 2013

On Sat, 02.02.13 15:24, Sébastien Luttringer (seblu at seblu.net) wrote:

> Hello,
> Looking forward to mount custom partitions I decided to use unit.mount
> files to define my new fs. Everything works perfectly, so I tried to
> do the same with all my mounted filesystems and removing /etc/fstab.

I am not sure it is worth getting rid of fstab. I mean, that file is                                                                  
very simple and sufficiently powerful for many cases. It is exposed in                                                                
glibc's setmntent() API and widely understood by programs, including                                                                  
.mount units are more powerful than fstab but actually not as easy to                                                                 
write as fstab.                                                                                                                       
So, /etc/fstab and /etc/crypttab I believe are really things that are                                                                 
going to stay, and we don't really see any point in deprecating or                                                                    
moving them out of focus. That said, systemd should work fine if they                                                                 
are non-existant, and there might be many setups where not including an                                                               
fstab might be a really good idea, for example those where it is                                                                      
desirable to use root= on the kernel command line as only place where                                                                 
the root file system is defined (probably particularly useful on                                                                      
embedded and virtualized setups).     

> But unfortunatly, creating a -.mount file in
> /etc/systemd/system/local-fs.target.wants not work as I expected. I
> guess it's because generated file /run/systemd/generator/-.mount take
> precedence.

Hmm, -.mount is a special case as the root fs is mounted via the
kernel's root= command line parameter rather than this unit
file. Defining -.mount manually currently doesn't really do anything
useful. Also, if you want to make changes to the mount options of the
root directory, then /etc/fstab is really the only option, as that's the
only place where systemd-remount-fs will look.

> Is there any way of removing old fstab to full unit configuration?

Only if don't have any special mount options to apply to the root fs.


Lennart Poettering - Red Hat, Inc.

More information about the systemd-devel mailing list