What does "sw" option mean in /etc/fstab?

Solution 1:

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

http://www.linuxquestions.org/questions/linux-newbie-8/fstab-defaults-sets-wrong-permissions-145958/

Solution 2:

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 the file system is swap, these mount options don'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.