The following – whether this is a good idea aside – appears not to work:
me@client:~ $ ssh host
me@host:~ $ cd /media/big-hdd
me@host:/media/big-hdd $ sudo fallocate -l 8g swapfile
me@host:/media/big-hdd $ sudo chown me swapfile
me@host:/media/big-hdd $ logout
me@client:~ $ sudo mkdir /media/big-hdd
me@client:~ $ sudo sshfs me@host:/media/big-hdd /media/big-hdd
me@client:~ $ sudo mkswap /media/big-hdd/swapfile
Setting up swapspace version 1, size = 8388604 KiB
no label, UUID=7d6b9704-7692-4463-b0c7-8a94668d715f
me@client:~ $ sudo swapon /media/big-hdd/swapfile
swapon: /media/big-hdd/swapfile: insecure permissions 0644, 0600 suggested.
swapon: /media/big-hdd/swapfile: insecure file owner 1002, 0 (root) suggested.
swapon: /media/big-hdd/swapfile: swapon failed: Invalid argument
It was suggested elsewhere that this Invalid argument
problem is because fallocate
does not actually allocate, only reserve the memory. But replacing it with the (much slower)
me@host:/media/big-hdd $ sudo dd if=/dev/zero of=swapfile count=2048 bs=4MiB
also doesn't change anything.
Is this just in principle not possible, or am I just making a mistake that prevents it from working?