Why using swap file over a SMB/NFS mounted filesystem is not possible in Linux?
Posted
by
Avio
on Super User
See other posts from Super User
or by Avio
Published on 2012-10-31T21:25:49Z
Indexed on
2012/10/31
23:04 UTC
Read the original article
Hit count: 197
I'd like to use another machine's unused RAM as swapspace for my primary Linux installation. I was just curious about performance of network ramdisks compared to local (slow) mechanical hard disks.
The swapfile is on a tmpfs
mountpoint and is shared through samba
. However, every time I try to issue:
swapon /mnt/ramswap/swapfile
I get:
swapon: /mnt/ramswap/swapfile: swapon failed: Invalid argument
and in dmesg
I read:
[ 9569.806483] swapon: swapfile has holes
I've tried to allocate the swapfile with dd if=/dev/zero of=swapfile bs=1024 (but also =4096 and =1048576)
and with truncate -s 2G
(both followed by mkswap swapfile
) but the result is always the same.
In this post (dated back to 2002) someone says that using a swapfile over NFS/SMB is not possible in Linux. Is this statement still valid? And if yes, what is the reason of this choice and is there any workaround to have this working?
© Super User or respective owner