Sous-Chefs-Boneyard/swap

Cannot create swap smaller than 1GB.

Closed this issue · 13 comments

At the moment the minimum size of swap is 1GB, as size can only be a Fixnum and denotes Gigabytes.

Would it possible to change this to denote Megabytes instead, to allow for smaller swap sizes (Say, on a small VPS)?

I'm willing to do the work, I wanted your thoughts on this.

Ummm... I don't really see how anything less than 1GB is actually going to help your system when in swap, that's the reason I used GBs.

If you want to change the datatype to allow fractions, that's fine, but I don't want to break bw compatibility by changing it to megabytes.

I've just noticed there's a bug where the size is actually MB, not GB.

The default block size is 1048576. If you use a size of 1, you get a 1MB swap file.

Block size configurability in f22d384

Examples of usage working around MB/GB bug:

# 1GB
swap_file '/swapfile' do
  size  1024
end

# 512MB
swap_file '/swapfile' do
  size  512 * 1024
  block_size 1024
end

Documentation would need changed, as size isn't really the size but multiples of the block size.

Okay. Do you want to update the docs? I can do it, but you seemed excited to PR :)

Woah. I'm confused. Where'd that commit come from?

Woah. That looks like a github bug where it loads the commit under the current repo. It must be something to do with the way they store forks, as when I paste in the hash for an unrelated repo's commit it shows a 404 at the resulting link.

Commit is actually in a branch on my fork: dougal@f22d384

Okay. You can PR that and I'll probably accept it :)

Done.

Thanks for working on this cookbook, saved me a lot of time rolling my own.

Can you submit a Pull Request so I can merge your changes into master?

Sorry, thought the commit appearing here would make this a pull request.

I haven't bumped the cookbook version.

That's fine - I prefer if you didn't. Just click the "Pull Request" button on your fork and gh should automatically figure it out.

Done.

Yep, I hate when people update versions or add stuff to changelogs, that's a maintainer's job.

Thanks again.

lock commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.