Created
November 2, 2013 11:56
-
-
Save chilicat/7278139 to your computer and use it in GitHub Desktop.
Simple script to setup a cinder volume in a file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "$1" == "" ]; then | |
echo "[ERROR] Please specify volume size. Usage: $0 3G" | |
exit 1 | |
fi | |
# Create a file | |
dd if=/dev/zero of=cinder-volumes bs=1 count=0 seek=$1 | |
# Create a loop device | |
losetup /dev/loop2 /cinder-volumes | |
# Make a auto mount | |
echo "losetup /dev/loop2 /cinder-volumes; exit 0;" > /etc/init.d/cinder-setup-backing-file | |
chmod 755 /etc/init.d/cinder-setup-backing-file | |
ln -s /etc/init.d/cinder-setup-backing-file /etc/rc2.d/S10cinder-setup-backing-file | |
# Create cinder volume | |
pvcreate /dev/loop2 | |
vgcreate cinder-volumes /dev/loop2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment