Unneeded /dev/sdb in /etc/fstab

Setting up an Ubuntu 20.04 LTS server today, I noticed the first (and later) startup taking 90 seconds looking for a non-existing /dev/sdb

It looks like Linode set up the machines with this /etc/fstab (and was also doing it on my 18.04 machines)

/dev/sda / ext4 defaults 0 0
/dev/sdb none swap defaults 0 0

I haven't configured the machine to set up any /dev/sdb - so I wonder why that swap line is there

Am I correct that Linode's scripts put it there, and is that something I can fix when configuring, or they have to? It would be nice to shave off 90 second off machine construction (I guess for now I'll have Ansible clean this up after install)

3 Replies

It's part of the default templates, not even scripted. You can remove the line if you don't have the device (note you have to do this after first boot), but you really should have a small swap disk. Linux behaves more sanely wrt memory allocation when swap is present, and you're much less likely to run into an OOM or ENOMEM situation when you've got a little breathing room under high memory usage.

Ubuntus' templates or Linode's templates? I haven't seen it elsewhere I think, but if they don't add it through a cloudscript I guess there's not much I can do about the 90 seconds delay. They'll never beat Digitalocean's new machine times this way then :P

The sanity of Linux when reaching OOM is very much up for debate. But don't worry, there's swap - it's just in files of 4GB each so I can manage it more easily than with a partition. And some monitoring of swap usage through Nagios, because if you're worried about Linux's behaviour when reaching OOM without swap, you don't want to see it reaching the end of its swap sapce…

Any new machine built from a Linode image gets a root disk at /dev/sda and a swap disk at /dev/sdb.

I’ve just built a new 20.04 Linode in London, and here is the /etc/fstab and /proc/swaps. There was no 90 second delay on boot.

root@localhost:~# cat /etc/fstab 
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during curtin installation
/dev/sda / ext4 defaults 0 0
/dev/sdb none swap defaults 0 0

As you can see, there is a 512MB swap device at /dev/sdb:

root@localhost:~# cat /proc/swaps 
Filename                                Type            Size    Used    Priority
/dev/sdb                                partition       524284  0       -2

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct