0

I created a swap file on an ec2 instance following this procedure: https://aws.amazon.com/premiumsupport/knowledge-center/ec2-memory-swap-file/

When I run sudo findmnt --verify I get the following error:

swap
   [W] non-bind mount source /swapfile is a directory or regular file

Is the procedure on amazon's site wrong?

StevieD
  • 514
  • 8
  • 24

2 Answers2

1

The linked article doesn't say anything about using findmnt - what output do you expect from it and why?

If sudo swapon -s shows your swapfile then everything is all good and the instructions worked.

MLu
  • 24,849
  • 5
  • 59
  • 86
  • I don't expect there to be a warning. – StevieD Dec 15 '20 at 07:40
  • 1
    @StevieD `findmnt` is used to display mounted filesystems. If you point it to a regular file it rightfully complains that it’s a regular file and not a mountpoint of a filesystem. What *exactly* are you trying to use `findmnt` for? It’s got nothing to do with enabling the swap space. – MLu Dec 15 '20 at 08:28
  • I'm just kicking the tires of the command. I've never used it before. I'm just assuming no warnings should be issues when the command is run. – StevieD Dec 15 '20 at 08:35
  • 1
    @StevieD You run it in a way it wasn’t designed to run so it warns you that you’re possibly doing something wrong. Use it the way it’s supposed to be used and there will be no warning. And you even conclude that the instructions on the Amazon website for enabling swap are wrong just because you then run some random unrelated command and it gives you a warning. Really?! – MLu Dec 15 '20 at 08:41
1

While using findmnt --verify will test the fstab before rebooting (an incorrect fstab can render a disk unbootable).

The error for swap file is a common warning and needs no attention.