Note: Please go to to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > Chef Cookbooks Developer Guide > Developer > ServerTemplate Development > Common Development Tasks > Increase the Number of Block Devices

Increase the Number of Block Devices


The database manager ServerTemplates published by RightScale (e.g. Database Manager for MySQL 5.1, Database Manager for MySQL 5.5, or Database Manager for PostgreSQL 9.1) contain scripts that will set up and configure up to two different block devices, each with its own set of configurable inputs. If you want to increase the number of configurable block devices, you will need to attach a modified version of the 'block_device' cookbook. Follow the steps below to change the number of block devices that a ServerTemplate supports.
Note: This tutorial assumes that you are using GitHub to store your cookbooks in a software repository. Although you can make the necessary modifications using a tarball, most users will have access to a source control management system.


  • 'designer' and 'actor' user role privileges
  • Access to a third party source control management (e.g. GitHub). 


Fork the Repository

You must go to GitHub and fork the 'rightscale_cookbooks' repository to your GitHub account.



Clone the Repository

After forking the repository, you must clone the repository to your local development environment.

  • You can either use the following git command: 
git clone<username>/rightscale_cookbooks
  • Or click the Clone in Desktop button and place the files in the appropriate working directory.


Delete Cookbooks

Since you only want to modify the 'block_device' cookbook, you should delete everything else in the working directory EXCEPT the 'block_device' cookbook. From the folder where the cookbooks are stored on your local development machine, run the following command to remove all of the cookbooks from your local directory except for the 'block_device' cookbook. (Note: To prevent any accidental deletions you can also run 'echo rm -rf !(block_device)' to review the action before running the delete command.)
# cd rightscale_cookbooks/cookbooks/
# shopt -s extglob
# rm -rf !(block_device)
# git commit -a -m "Removed all cookbooks accept 'block_device'"

Update the Metadata

Now you can change the number of configurable block devices. Edit the 'block_device' cookbook's metadata.rb file. 
vi metadata.rb
Locate the following lines to edit:
# Multiple Block Devices
device_count = 2
devices = 1.upto(device_count).map {|number| "device#{number}"}

Specify a new value for the "device_count" parameter. The new value will affect the list of configurable block device inputs that are made available in a ServerTemplate where this modified version of the 'block_device' cookbook is attached. Save the file and quit.


Important!  It's recommended that you do not change the version of the cookbook in the metadata because you do not want the version number to cause confusion in the future. For example, if the original version is 13.5.0 and you change your version to 13.5.1, it might cause problems in the future if/when RightScale publishes a newer version of the same cookbook with a 13.5.1 version. It's also recommended to keep the cookbook version the same to avoid possibly breaking any cookbook dependencies which might look for a 'block_device' cookbook with a specific version. (e.g. depends "block_device", "= 13.5.0")

Commit and Push to Master

Commit your changes to the branch and push the changes to your forked repository:

git commit –a
git push origin <branch_name>

Import the Modified Cookbook

The next step is to import the modified 'block_device' cookbook into your RightScale account so that you can add it to a ServerTemplate. 

  1. In the RightScale Dashboard, go to Design > Repositories.
  2. Create a new Repository object for the forked repository that contains your modified 'block_device' cookbook. Be sure to give the Repository object a descriptive name. (e.g. My block_device - v13.5.0)  See Add a Repository
  3. Import the 'block_device' cookbook. See Import Cookbooks from a Repository

Modify the ServerTemplate

  1. Go to the HEAD version of the ServerTemplate that you want to modify. If it's not editable, clone the ServerTemplate.
  2. Go to the Scripts tab of the editable ServerTemplate and click Modify.
    • If the ServerTemplate already has a 'block_device' cookbook attached to it, replace it with the modified cookbook. Hopefully you gave the Repository object a descriptive name so that it's obvious which version of the cookbook you should select, because you may have multiple versions of the 'block_device' cookbook with the same version in your account (where each version comes from a different source location).
    • If the 'block_device' cookbook is not attached to the ServerTemplate, attach the modified cookbook. Be sure to select the modified cookbook from the Repository object you just created in an earlier step.
  3. Go to the Inputs tab of the ServerTemplate. You should now see an additional set(s) of inputs for the additional block device(s). For example, if you increased the block device count to 3, you should see a set of inputs with (3) as the suffix in the name to denote the inputs that apply to the third block device. (e.g. Keep Daily Backups (3))

Test the Changes

  1. Use the HEAD version of the modified ServerTemplate to create a new server that you're going to use to test the changes.
  2. Set the inputs accordingly for the additional block device.
  3. Launch the server and verify the functionality.
  4. If you are satisfied with the changes, commit the modified ServerTemplate to save your changes.​


You must to post a comment.
Last modified
10:02, 2 Oct 2013



This page has no classifications.



© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.