Skip to content

Commit

Permalink
[sys] Swapfile defaults to /mnt/ephemeral/swapfile w4131
Browse files Browse the repository at this point in the history
  • Loading branch information
ekargard committed Nov 23, 2011
1 parent e8bac47 commit fa5bb5b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions metadata.json
Expand Up @@ -27,13 +27,13 @@
"choice": [

],
"default": "/swapfile",
"default": "/mnt/ephemeral/swapfile",
"type": "string",
"recipes": [
"sys::setup_swap"
],
"display_name": "Swapfile location",
"description": "The location of swap file. Defaults to '/swapfile'."
"description": "The location of swap file. Defaults to '/mnt/ephemeral/swapfile'."
},
"sys/swap_size": {
"required": "required",
Expand Down
4 changes: 2 additions & 2 deletions metadata.rb
Expand Up @@ -28,7 +28,7 @@

attribute "sys/swap_file",
:display_name => "Swapfile location",
:description => "The location of swap file. Defaults to '/swapfile'.",
:description => "The location of swap file. Defaults to '/mnt/ephemeral/swapfile'.",
:type => "string",
:default => "/swapfile",
:default => "/mnt/ephemeral/swapfile",
:recipes => [ "sys::setup_swap"]
3 changes: 2 additions & 1 deletion recipes/setup_swap.rb
Expand Up @@ -57,10 +57,11 @@ def clean_swap(swap_file)

def create_swap(swap_file, swap_size)

# Create swapfile, set it as swap, and turn swap on
# Make sure swapfile directory exists, create swapfile, set it as swap, and turn swap on
bash 'create swapfile' do
not_if { File.exists?(swap_file) }
code <<-eof
mkdir -p `dirname #{swap_file}`
dd if=/dev/zero of=#{swap_file} bs=1M count=#{swap_size}
chmod 600 #{swap_file}
mkswap #{swap_file}
Expand Down

0 comments on commit fa5bb5b

Please sign in to comment.