amenditman Posted June 3, 2015 Share Posted June 3, 2015 Most documentation, nearly all I saw, says to have your /etc/fstab entry for swap look like this UUID=somebigstring none swap defaults 0 0 and if you let most installers build your fstab for you it will look like that. A few places have documentation for swap that says to leave it blank except if you need to alter priority, say if you have swap on multiple disks. And yet others list mount options for Swap as "sw". With no listing of what flags are included when "sw" is used. I was wondering about it this week and this is what struck me. The "defaults" mount option = rw,suid,dev,exec,auto,nouser,async . Those mount options seem odd for the swap space. rw = read,write OK, we need this for Swap. suid = set user id Why does this need to be available on Swap? I don't think it does. dev = Interpret character or block special devices on the filesystem. Why does this need to be set on Swap? exec = permit execution of binaries We do not need this in Swap. auto = can be mounted with the -a option I don't think we need this for Swap. nouser = forbid ordinary users from mounting the filesystem OK, we need this for Swap. async = all I/O done asynchronously I don't think that is how Swap should work. It is supposed to be used to get things out of RAM, quickly, Anyone have opinions about this or links to explanations of what mount options to use and why? Quote Link to comment Share on other sites More sharing options...
securitybreach Posted June 3, 2015 Share Posted June 3, 2015 Swap should always have the following options: #/dev/sda4 UUID= none swap defaults 0 0 And use the discard option when running off of a ssd drive: https://wiki.archlin...#Swap_partition My fstab: http://ix.io/ish Quote Link to comment Share on other sites More sharing options...
securitybreach Posted June 3, 2015 Share Posted June 3, 2015 This is why UUID (Blkid) is better than using a /dev/ option: The advantage of using the UUID is that it is independent from the actual device number the operating system gives your hard disk. Image you add another hard disk to the system, and for some reason the OS decides that your old disk is now sdb instead of sba. Your boot process would be screwed up if fstab would point to the device name. However, in case of the UUIDs, it would be fine. Basically drive letters can change but the UUID value will never change Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.