In my Ubuntu 14.04 /etc/fstab, I have following line:

UUID=e4YGg1-2bHU-Ylum-3FwK-MK3s-1Fjf-ZvQEh2 none            swap    sw              0       0

Which seems pretty current for swap.

I can't figure out what the sw option stand for. There is no indication in fstab man neither swapon's.

Any idea?

  • 2
    I think this may tell you what you want to know: it confirms what I always assumed. – AFH Mar 26 '16 at 0:19

According to the link below, the 'sw' option indicates that the swap partition is to be activated with 'swapon -a' command:

/dev/hda6 none swap sw 0 0



This column is described in Linux's man fstab as:

The fourth field, (fs_mntops), describes the mount options associated with the filesystem.

It is formatted as a comma separated list of options. It contains at least the type of mount plus any additional options appropriate to the filesystem type. For documentation on the available options for non-nfs file systems, see mount(8).

When file system is swap, these mount options doesn't do anything. See: What is the difference between swap entries in fstab?

These fstab options are part of struct fstab:

 struct fstab {
         char    *fs_spec;       /* block special device name */
         char    *fs_file;       /* filesystem path prefix */
         char    *fs_vfstype;    /* type of filesystem */
         char    *fs_mntops;     /* comma separated mount options */
         char    *fs_type;       /* rw, ro, sw, or xx */
         int     fs_freq;        /* dump frequency, in days */
         int     fs_passno;      /* pass number on parallel fsck */

So in summary there are 6 columns in /etc/fstab means:

  1. fs_spec: describes the block special device, the local filesystem, or the remote filesystem to be mounted.
  2. fs_file: describes the mount point for the filesystem. For swap partitions, this field should be specified as none.
  3. fs_vfstype: describes the type of the filesystem.
  4. fs_mntops: describes the mount options associated with the filesystem.
  5. fs_freq: is used for these filesystems by the dump command to determine which filesystems need to be dumped.
  6. fs_passno: is used by the fsck program to determine the order in which filesystem checks are done at reboot time.
  • Well, ro and rw are documented in mount(8): man7.org/linux/man-pages/man8/mount.8.html, while sw and xx probably make no sense in Linux. Also, fstab in Linux has only 6 fields, ro and rw belongs to the mount options field. – Tom Yan Mar 26 '16 at 17:20
  • That's correct, 4th column describes the mount options associated with the filesystem. – kenorb Mar 26 '16 at 18:27
  • Clarified further more. – kenorb Mar 26 '16 at 18:41
  • Hm actually my point is, it's a bit pointless to bring up the BSD fstab for the question. fstab in Linux has 6 fields, while according to the code you quoted, fstab in BSD has 7. And the extra one that BSD has while Linux doesn't is char *fs_type; /* rw, ro, sw, or xx */. I mean, yeah BSD has it, but so? It's a bit like saying "both sw and swap starts with sw, so sw means swap". – Tom Yan Mar 26 '16 at 18:57
  • @Tom Corrected the inconsistency issues. – kenorb Mar 27 '16 at 0:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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