You are not logged in.

#1 2017-10-22 07:52:11

snovik
Member
Registered: 2012-05-06
Posts: 140

File path for swap file in systemd-swap on another disk

I am trying to setup systemd-swap file on another disk.

/etc/systemd/swap.conf

swapfu_path=/home/sergej/data/

This folder is mounted in /etc/fstab:

/dev/sda4               /home/sergej/data       ext4            rw,relatime,data=ordered        0 2

This is what I get when I try to start the service sudo systemctl status systemd-swap

● systemd-swap.service - Manage swap spaces on zram, files and partitions.
   Loaded: loaded (/usr/lib/systemd/system/systemd-swap.service; enabled; vendor preset: disabled)
   Active: active (exited) since Sun 2017-10-22 10:47:58 EEST; 4s ago
  Process: 6019 ExecStop=/usr/bin/systemd-swap stop (code=exited, status=0/SUCCESS)
  Process: 6381 ExecStart=/usr/bin/systemd-swap start (code=exited, status=0/SUCCESS)
 Main PID: 6381 (code=exited, status=0/SUCCESS)
      CPU: 133ms

Oct 22 10:47:59 sergej systemd-swap[6381]: INFO: swapFU: using
Oct 22 10:47:59 sergej systemd-swap[6381]: rm: cannot remove '/home/sergej/data/swap': No such file or directory
Oct 22 10:47:59 sergej systemd-swap[6381]: INFO: swapFU: initialize swap device
Oct 22 10:47:59 sergej systemd-swap[6381]: INFO: swapFU: swapon - discard: disabled
Oct 22 10:47:59 sergej systemd-swap[6381]: ln: failed to create symbolic link './swapfu': File exists
Oct 22 10:47:59 sergej systemd-swap[6381]: losetup: option requires an argument -- 'd'
Oct 22 10:47:59 sergej systemd-swap[6381]: Try 'losetup --help' for more information.
Oct 22 10:47:59 sergej systemd-swap[6381]: INFO: swapFU: enable directio for
Oct 22 10:47:59 sergej systemd-swap[6381]: losetup: no loop device specified
Oct 22 10:47:59 sergej systemd-swap[6381]: INFO: swapD: searching swap devices

If I let the system create the swap where it wants it is all fine. However my boot partition is only 3 gb free and I cannot afford swap there.

How can I use a swap file from another partition in the boot process?

Last edited by snovik (2017-10-22 11:19:31)

Offline

#2 2017-10-22 11:21:15

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,869

Re: File path for swap file in systemd-swap on another disk

This. Is. Not. About. God. Damn. Disks.

a) doing this via fstab is far more straight forward, less convoluted and fragile than the systemd service.
b) If you still want to do this via systemd, look at /usr/lib/systemd/system/systemd-swap.service - specifically the "Requires*" keys - do you think they fit your desires?

Online

Board footer

Powered by FluxBB