ltsp: automatic swapfile creation
tags 367606 pending
thanks
so, i think i have a working method to automatically create nbd
swapfiles on demand. it turned out to be much simpler than i thought. :)
stick this in /usr/sbin/nbdswapd:
#!/bin/sh
SIZE=32
tmp=$(tempfile)
dd if=/dev/zero of=$tmp bs=1024k count=$SIZE 2> /dev/null
/bin/nbd-server 0 $tmp
rm -f $tmp
and then run:
update-inetd --group LTSP --add "9572 stream tcp nowait nobody /usr/sbin/tcpd /usr/sbin/nbdswapd"
add to /opt/ltsp/ARCH/etc/lts.conf:
NBD_PORT=9572
SWAP_SERVER=ip.of.swap.server
and you should be ready to go.
it creates swap files as needed, and deletes them when the client
disconnects. note that it will use considerable space in /tmp, 32MB for
each connected client- though adjust to your tasts.
another nice feature is that a client could connect multiple times if it
needed more swap.
i'm not sure weather we should enable it by default(as it's a security
risk to pass swap data over the network), but i will definitely include
the above code in the next release and make it simple to enable. might
include features to encrypt swap in the next release, too :)
live well,
vagrant
Reply to: