Skip to content

Instantly share code, notes, and snippets.

@grantr
Created September 13, 2010 18:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantr/577798 to your computer and use it in GitHub Desktop.
Save grantr/577798 to your computer and use it in GitHub Desktop.
if node[:ec2][:ephemeral][:devices].include?("/dev/sdd")
# if we also have sdd and sde, raid0 them and put data there
data_raid_block_devs = [ "/dev/sdd", "/dev/sde" ]
data_raid_mountpoint = "/mnt/cassandra_data"
data_raid_dev = "/dev/md0"
data_file_dir = Array(node[:cassandra][:data_file_dirs]).first
package "mdadm" do
action :install
end
mdadm data_raid_dev do
devices data_raid_block_devs
level 0
chunk 128
action [ :create, :assemble ]
end
#TODO this doesn't work the first time, maybe mdadm needs a delay?
execute "mkfs.xfs -f #{data_raid_dev}" do
only_if "xfs_admin -l #{data_raid_dev} 2>&1 | grep -qx 'xfs_admin: #{data_raid_dev} is not a valid XFS filesystem (unexpected SB magic number 0x00000000)'"
end
#TODO this doesn't get the proper perms, its root/root for some reason
directory data_raid_mountpoint do
owner "cassandra"
group "nogroup"
mode 0755
end
mount data_raid_mountpoint do
device data_raid_dev
fstype "xfs"
options "noatime"
action :mount
end
directory data_file_dir do
owner "cassandra"
group "nogroup"
mode 0755
end
mount data_file_dir do
device data_raid_mountpoint
fstype "none"
options "bind,rw"
action :mount
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment