best practise to mount swap partition

hi I have installed opensuse 13.1 with btfrs file system and swap partition extended on my laptop. I’d like to say that btfrs seems very good file system and faster than ext4.
In short I have a small issue:
at boot I have a strange error ‘failed to activate swap partition /dev/disk…’
but if I try to view the output ot swapon -s I notice that swap partition is mounted and work fine.
at the end I commented the swap’s line in fstab and I rebooted my laptop, now work well and without error at boot.
my question is, there are some other mode to mount swap partition? if yes (I think so :slight_smile: ) why opensuse default try to mount swap on fstab too?
thank you guys

AFAIU, swap partitions can be configured via /etc/fstab, or via systemd. However, it checks for the presence of /etc/fstab swap entries and unit files at boot, and…

If a swap device or file is configured in both /etc/fstab and a  unit file, the configuration in the latter takes precedence.
man systemd.swap

So maybe you’re talking about a different issue perhaps?

Yes it seems that the issue. How can check the priority and why I have this issue if I put in fstab the swap line too?

Post your /etc/fstab, and review /var/log/boot.log. It would be useful to see exact messages/errors.

This thread may be relevant to you

https://forums.opensuse.org/showthread.php/495871-13-1-64-Swap-fails-to-activate/page2

the line in my fstab is:
/dev/disk/by-id/ata-HGST_HTS…-part2 swap swap defaults 0 0

if I comment this line I can boot with not errors

Well, I have this and don’t see an error:

/dev/sdb2            swap                 swap       defaults              0 0

So try to change it to the /dev/sdxy notation, does the error disappear then?

As I wrote in your other thread, I have the suspicion that systemd or its swap unit generator do not recognize that /dev/disk/by-id/ata-HGST_HTS…-part2 and /dev/sdX2 are in fact the same partition.

Btw, I don’t see that error in my Factory VM either. There the installer added the swap partition by using the “UUID=xxx” notation.

On 2014-10-23 10:16, susecom wrote:

> at boot I have a strange error ‘failed to activate swap partition
> /dev/disk…’
> but if I try to view the output ot swapon -s I notice that swap
> partition is mounted and work fine.

Does it stop at that error, or does it continue very fast past it? If it
goes past it, ignoring it, you just do the same: ignore it. :slight_smile:

I mount fstab with this syntax in fstab, no “messages”:


LABEL=a_swap   swap        swap     pri=-1    0 0

Of course, I labeled it ‘a_swap’ myself.

Similarly, the kernel line in grub has this “equivalent” syntax:


kernel /vmlinuz-3.11.10-21-desktop
root=/dev/disk/by-label/a_main
resume=/dev/disk/by-label/b_swap
showopts splash=verbose console=tty0 vga=0x31a

# (one line)

Another machine using grub2 has:


GRUB_CMDLINE_LINUX_DEFAULT=" resume=/dev/disk/by-label/Swap ...


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)