Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the ganeti2 package on Debian 5. Instance creation goes pretty smoothly, except that it doesn't configure a swap disk automatically, and I'd like it to do so.

Googling around, I found absolutely no one with my problem, which makes me suspect a fundamental mistake on my part, but I can't figure out what. The Ganeti 2 documentation also doesn't touch the subject, though previous versions had an instance creation parameter for that.

So, how can I do it? Or what am I doing wrong?

share|improve this question
up vote 1 down vote accepted

I realize this question is three years old - but in case anyone else comes across it with the same issue, it looks like Pietro Abate has a ganeti-instance-debootstrap hook for doing this, which is pretty automatic:

share|improve this answer
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Scott Pack Jun 26 '13 at 1:50

You are likely explicitly telling it to just create one disk, as the --swap-size option is now deprecated. You should be able to add a swap partition like so:

--disks 0:size=200G --disks 1:size=2G ...[more config]

on instance creation. Make the usual adjustments after the instance is created -- mkswap, swapon, /etc/fstab etc. Alternatively, you can create a swap file on the instance itself from within the filesystem and keep your creation more or less the same:

dd if=/dev/zero of=/swap_file bs=1M count=2048
mkswap /swap_file
swapon /swap_file
echo '/swap_file swap swap defaults 0 0' >> /etc/fstab
share|improve this answer
No, I'm adding two disks. And I do have a rather tricky script to do it, which definitely does not qualify as "automatic". I need to check for a second disk, get the UUID, export it, fdisk it, de-export it (and this runs in background, and may cause problems unless there's a sleep), and only then mkswap/swapon/fstab. – Daniel C. Sobral Nov 6 '10 at 1:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.