• Sales: 1-800-961-2888
  • Support: 1-800-961-4454

Prepare Your Cloud Block Storage Volume


After you have created and attached your Cloud Block Storage (CBS) Volume you must prepare it for use on your Server. In order to prepare your Volume you must partition, format, and mount it.  Once you have successfully completed these steps your Volume will be usable like a drive on your Server.

On This Page:

 

Prepare your Volume for use with a Linux Server

Step 1: SSH into your Server.

When you created your Server, you were given a password. You will need that password for this step. If you do not have the password, click the "Actions" button next to the server name and select "Change Password." Find the IP for your Server on the Server Details page. SSH into the Server with its IP address and password.

Input:

MHC03SDV7M:~ user4975$ ssh root@198.61.222.58
root@198.61.222.58's password:

Output:

Linux nosnetdfw 2.6.32-31-server #61-Ubuntu SMP Fri Apr 8 19:44:42 UTC 2011 x86_64 GNU/Linux
Ubuntu 10.04 LTS

Welcome to the Ubuntu Server!
 * Documentation:  http://www.ubuntu.com/server/doc
Last login: Thu Oct 18 02:26:38 2012 from 70.114.215.201

Once you are logged in, you can list the disks on your Server. Your CBS Volume will typically be listed as the last drive in this list. In this example, our 100 GB drive is attached to /dev/xvdb. (It shows up as 107.4 GB due to how the MB are counted.)

Input:

root@nosnetdfw:~# fdisk -l

Output:

Disk /dev/xvdc: 1073 MB, 1073741824 bytes
127 heads, 3 sectors/track, 5504 cylinders
Units = cylinders of 381 * 512 = 195072 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00029648

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdc1               1        5250     1000000   83  Linux

Disk /dev/xvda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000dc852

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1               1        5222    41942016   83  Linux

Disk /dev/xvdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/xvdb doesn't contain a valid partition table

Step 2: Partition the disk.

Partitioning the disk tells the Server how much space on the drive you want to use. We want to use all of it, so we tell the Server to start at the first cylinder of the drive and go to the last.

Input:

root@nosnetdfw:~# fdisk /dev/xvdb

Output:

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x59a4ec2c.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help):

Enter "n" for new partition:

Input:

Command (m for help): n

Output:

Command action
   e   extended
   p   primary partition (1-4)

Enter "p" for primary partition

Input:

p

Output:

Partition number (1-4):

Enter "1"; we are only creating one partition on this disk.

Input:

Partition number (1-4): 1

 Output:

First cylinder (1-13054, default 1):   

Press the "Enter" key to use the default, which is "1". We are using the entire Volume for our partition, so we start the partition at the beginning.

Input:

<Enter>

Output:

Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-13054, default 13054):

 

We select the last cylinder of the disk for the partiton to use up the entire disk. The last partition is the default, so we just need to press the "Enter" key on the keyboard.

Input:

<Enter>

 Ouput:

Using default value 13054

Command (m for help):

Enter "w" to write the partition.

Input:

Command (m for help): w

Output:

The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

If we list the disks on our Server again, we see that our CBS Volume is ready as a disk. Remember, it was attached at /dev/xvdb and we created one partition on it. So, now our available drive shows up at /dev/xvdb1.

Input:

 root@nosnetdfw:~# fdisk -l

Ouput:

Disk /dev/xvdc: 1073 MB, 1073741824 bytes
127 heads, 3 sectors/track, 5504 cylinders
Units = cylinders of 381 * 512 = 195072 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00029648

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdc1               1        5250     1000000   83  Linux

Disk /dev/xvda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000dc852

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1               1        5222    41942016   83  Linux

Disk /dev/xvdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x59a4ec2c

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdb1               1       13054   104856223+  83  Linux

Step 3. Format the Volume

Formatting the drive makes it speak the language of your Server. In this example, we format the drive with ext3.

Input:

root@nosnetdfw:~# mkfs -t ext3 /dev/xvdb1

Output:

mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214055 blocks
1310702 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

You can substitute another file system your installation supports for "ext3" in the command (like ext4).

Step 4. Mount the Device

After partitioning and formatting the disk, you must mount it on the Server. Once the drive is mounted, it is available for use. Here you assign the drive a name for use on your Server. In this example, the drive is called "cbsvolume1".

Input:

root@nosnetdfw:~# mkdir -p /mnt/cbsvolume1
root@nosnetdfw:~# mount /dev/xvdb1 /mnt/cbsvolume1/

Output:

There is no feedback given once the drive is mounted. However, you may check that your drive is ready by running the df command to show your free disk space. Your new drive is listed last in the list of available drives.

Input:

root@nosnetdfw:~# df -h

Output:

Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1             40G  632M   37G   2% /
none                  493M  136K  493M   1% /dev
none                  498M     0  498M   0% /dev/shm
none                  498M   36K  498M   1% /var/run
none                  498M     0  498M   0% /var/lock
none                  498M     0  498M   0% /lib/init/rw
none                   40G  632M   37G   2% /var/lib/ureadahead/debugfs
/dev/xvdb1             99G  188M   94G   1% /mnt/cbsvolume1

Your drive is ready for use with your Linux Server. However, you may want to add the following step to ensure that your Volume remains persistant after a server reboots.

Step 5. Make Volume permanent

This is an optional step, but it will keep your Volume attached to your Server after reboots. To make this happen, add your Volume to the static file system information in the fstab file.

Input:

root@nosnetdfw:~# nano /etc/fstab 

Output:

#
# /etc/fstab
# Created by anaconda on Tue May 29 20:13:27 2012
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/xvda1          /               ext3    defaults,noatime,barrier=0 1 1
/dev/xvdc1          swap            swap    defaults    0 0

For this example, we add the following line beneath /dev/xvdc1... to add the volume to the static filesystem:

/dev/xvdb1          /mnt/cbsvolume1  ext3    defaults,noatime      0      2

The Volume persists on the Server after reboot.

 

Prepare your Volume for use with a Windows Server

Note: In the example below, we attach a 100 GB Volume to a Windows Server 2012. The steps taken are similar for all Next Generation Windows Servers.

Step 1: Remote into your Server.

When you created your Server, you were given a password. You will need that password for this step. If you do not have the password, click the "Actions" button next to the server name and select "Change Password." Find the IP for your Server on the Server Details page. Remote Desktop into the Server as administrator with its IP address and password.

When you first log in and view the "Computer" window, you will not see the Cloud Block Storage Volume that is attached to the Server. In the example below, we only see the Server's C drive.

 Click the Server Manager Window. If the Server Manager window is not displayed, right-click on the "Computer" icon and select "Manage". You may also click the "Server Manager" icon at the bottom left of the Windows taskbar.

The Server Manager window:

At the left side of the Server Manager window, select the "File and Storage Services" link:

 Select "Disks" in the left-hand panel. Here we see a 100 GB Volume attached to the Server. It is listed as "Offline", it has 100 GB of unallocated space, and its partition size is "Unknown".

Step 2 - Partition and Format the Drive

For Windows Servers, the Volume is partitioned, formatted, and mounted in the New Volume Wizard. The mounting process--called bringing it Online in Windows terminology--is done automatically.

Under the "Disks" window, right-click the offline drive and select "Bring Online" from the pop-up menu.

Under "Disks", right-click the drive and select "New Volume" from the pop-up menu. In Windows Server 2008, you right-click the unallocated drive and select "New Simple Volume".

The "New Volume Wizard" launches.

Click the "Next" button. Under the "Disk" window, the unformatted CBS Volume displays.

Select the disk and click "Next".If the "Offline or Uninitialized Disk" window displays, click the "OK" button.

Select the drive size, then drive letter, and then format and name. Confirm your settings in the "File System Settings" window. In this example, we have used the disk's full 100GB, assigned it drive letter D, formatted it as NTFS, and named it "My New CBS Volume".

Click the "Create" button to complete the process.

When you display the "My Computer" window, the new CBS drive displays like a regular hard drive.

Your CBS Volume is now ready for use.



© 2011-2013 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


See license specifics and DISCLAIMER

27 Comments

installing mysql to the mounted SSD after using these instructions causes errors

are there special mounting instructions or formatting for it to be able to run MySQL

Oct 26 02:15:40 localhost kernel: [ 4284.801641] audit_printk_skb: 15 callbacks suppressed
Oct 26 02:15:40 localhost kernel: [ 4284.801647] type=1400 audit(1351217740.557:43): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=13920 comm="apparmor_parser"
Oct 26 02:15:40 localhost kernel: [ 4284.837539] type=1400 audit(1351217740.593:44): apparmor="DENIED" operation="mknod" parent=1 profile="/usr/sbin/mysqld" name="/mnt/bth-db/mysql/gen-bth02.lower-test" pid=13924 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
Oct 26 02:15:40 localhost kernel: [ 4284.837679] type=1400 audit(1351217740.593:45): apparmor="DENIED" operation="mknod" parent=1 profile="/usr/sbin/mysqld" name="/mnt/bth-db/mysql/gen-bth02.lower-test" pid=13924 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
Oct 26 02:15:40 localhost kernel: [ 4284.848740] type=1400 audit(1351217740.605:46): apparmor="DENIED" operation="open" parent=1 profile="/usr/sbin/mysqld" name="/mnt/bth-db/mysql/mysql/plugin.frm" pid=13924 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=106 ouid=106
Oct 26 02:15:40 localhost kernel: [ 4284.906724] type=1400 audit(1351217740.661:47): apparmor="DENIED" operation="open" parent=1 profile="/usr/sbin/mysqld" name="/mnt/bth-db/mysql/ibdata1" pid=13924 comm="mysqld" requested_mask="rw" denied_mask="rw" fsuid=106 ouid=106
Oct 26 02:15:40 localhost kernel: [ 4284.914430] init: mysql main process (13924) terminated with status 1
Oct 26 02:15:40 localhost kernel: [ 4284.914485] init: mysql main process ended, respawning
Oct 26 02:15:41 localhost kernel: [ 4285.864986] init: mysql post-start process (13925) terminated with status 1
Oct 26 02:15:41 localhost kernel: [ 4285.885564] type=1400 audit(1351217741.641:48): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=13958 comm="apparmor_parser"
Oct 26 02:15:41 localhost kernel: [ 4285.916757] type=1400 audit(1351217741.673:49): apparmor="DENIED" operation="mknod" parent=1 profile="/usr/sbin/mysqld" name="/mnt/bth-db/mysql/gen-bth02.lower-test" pid=13962 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
Oct 26 02:15:41 localhost kernel: [ 4285.916918] type=1400 audit(1351217741.673:50): apparmor="DENIED" operation="mknod" parent=1 profile="/usr/sbin/mysqld" name="/mnt/bth-db/mysql/gen-bth02.lower-test" pid=13962 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
Oct 26 02:15:41 localhost kernel: [ 4285.928275] type=1400 audit(1351217741.685:51): apparmor="DENIED" operation="open" parent=1 profile="/usr/sbin/mysqld" name="/mnt/bth-db/mysql/mysql/plugin.frm" pid=13962 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=106 ouid=106
Oct 26 02:15:41 localhost kernel: [ 4285.985635] type=1400 audit(1351217741.741:52): apparmor="DENIED" operation="open" parent=1 profile="/usr/sbin/mysqld" name="/mnt/bth-db/mysql/ibdata1" pid=13962 comm="mysqld" requested_mask="rw" denied_mask="rw" fsuid=106 ouid=106
Oct 26 02:15:41 localhost kernel: [ 4285.993246] init: mysql main process (13962) terminated with status 1
Oct 26 02:15:41 localhost kernel: [ 4285.993303] init: mysql main process ended, respawning
Oct 26 02:15:42 localhost kernel: [ 4286.951042] init: mysql post-start process (13963) terminated with status 1
Oct 26 02:15:42 localhost kernel: [ 4287.074251] init: mysql main process (14000) terminated with status 1
Oct 26 02:15:42 localhost kernel: [ 4287.074304] init: mysql respawning too fast, stopped

had to edit
/etc/apparmor.d/usr.sbin.mysqld

and add the lines
/mnt/bth-db/mysql/ r,
/mnt/bth-db/mysql/** rwk,

then
service app-armor restart

In the sentence "Your new drive is listed last in the list of avaialbe drives." s/avaialbe/available/

Also, since the Linux section seems aimed at a very general audience, it might be worth mentioning that extra steps are required to make the mount persist across reboots.

Hey David C,

Thanks for catching that. We've corrected the typo and we'll definitely make note of your suggestion. Thanks again!

-Rae

So, what's the solution when server is rebooted?

Farid,

Check step 5 here: http://www.rackspace.com/knowledge_center/article/prepare-your-cloud-block-storage-volume#prepare_linux

When you add your Volume information to the fstab file, the volume will persist on your Server after reboot.

Can you provide a way to also extend the drive in linux, as this would be a more popular solution in the cloud hosting environments as opposed to mounting, as I personally would not use this for backup of images, but for extending the drive space of the cloud I am on.

Thanks for the suggestion Carlos. You're not the first person to ask for this feature, but I can't say if or when it will be implemented. You can add your vote and comment to this topic on our feedback forum:

http://feedback.rackspace.com/forums/71021-product-feedback/suggestions/997213-the-ability-to-choose-amount-of-ram-and-hd-space-s

Hi, we intend to run MongoDB with the CBS. MongoDB can be configured to put all its data on a CBS drive; however, this requires that the CBS drive is mounted and available when the server reboots. What is a proper way to auto mount a CBS drive after rebooting? Will adding an entry to the /etc/fstab work? I tried and it does not seem so.

Thanks,
Alex

Alex,

Check step 5 here: http://www.rackspace.com/knowledge_center/article/prepare-your-cloud-block-storage-volume#prepare_linux

When you add your Volume information to the fstab file, the volume will persist on your Server after reboot.

fstab example has a typo in it, it should be /mnt/cbsvolume1 NOT /mnt/cbsvolum1

Thanks Richard. Typo fixed.

the disk has to be regularly checked or it wont mount properly all the time
there should be instructions of how to fdisk upon boot

I don't think fdisk is required at each boot for a Cloud Block Storage volume (just for the initial format), so you might mean that the /etc/fstab file needs to be edited. Step 5 discusses the line that should be added to the fstab file to ensure that the volume is mounted when the system boots.

We'll pass this back to the devs to have them check on the fdisk question, just in case.

Personally, I suspect that Andre really meant fsck rather than fdisk. Not hard to get it mixed up after reading the word "fdisk" so many times above.

Also, at the end of the fstab line for the CBS, the two numbers should really be "0 2" rather than "0 1". The '1' is generally used only for the root filesystem; using the right number '2' will let the automatic fsck check the root filesystem first, as it should be.

man fstab(5)
"The root filesystem should be specified with a fs_passno of 1, and other filesystems should have a fs_passno of 2."

Thanks Randy. I'll pass the recommendation on to the author/devs so they can review it for inclusion in the article.

Hi Andre,

Like Jered mentioned, fdisk should only be required when you first set up the volume. Can you provide any more details on what checks you are doing regularly with fdisk and what happens when you say it won't mount properly all the time?

Thanks,
Jose

Jose,

When following the steps as indicated, it simply states to type /etc/fstab and 'Permission Denied' is returned in the terminal. The suggested command should be 'nano /etc/fstab' to enter the editor, otherwise it is trying to run /etc/fstab.

Thanks,
Sean

An excellent point, thanks Sean. We'll get that line edited.

Everything ran smoothly until the formatting step. It was giving me a file not found error. I had to run yum install e4fsprogs in order to get ext4 available as an option. Then I could run the formatting command. This was a pretty old CentOS image that was being converted to a nexgen.

Thanks for letting us know about that one Aaron. We'll get a caution about that added to the documentation.

Efforts to change permission by editing cnf file paid no result. Finally changing permission from command prompt solved the problem. Pasting log here...

root@ubuntu:/media/vdb1# chown -R mysql:mysql /media/vdb1/
lost+found/ mysql-data/ mysql-tmp/
root@ubuntu:/media/vdb1# chown -R mysql:mysql /media/vdb1/
lost+found/ mysql-data/ mysql-tmp/
root@ubuntu:/media/vdb1# chown -R mysql:mysql /media/vdb1/mysql-
mysql-data/ mysql-tmp/
root@ubuntu:/media/vdb1# chown -R mysql:mysql /media/vdb1/mysql-*
root@ubuntu:/media/vdb1# chown -R mysql:mysql /media/vdb1/mysql-*^C
root@ubuntu:/media/vdb1# mysqld

I set up a new server with a 100GB SSD block last night -- and would be able to work for a while until the disk would suddenly revert to read-only. (producing a "Read-only file system" error). I compared it to another server I set up a month ago and noticed that this article used to specify ext4 and is now ext3.

I tried dropping the block storage completely to start from scratch twice -- and each time it produced the read-only problem. It may be coincidence, but as of this morning using ext4, I haven't had the problem.

Interesting, thanks Brian. We'll look at that more closely. Did you check to make sure the fstab referred to the volume as ext3 instead of ext4 on the new server?

Sorry to change the article on you there, too. We did that because not all of our images include the ext4 tools by default. Using ext3 instead felt like it would take some potential complication out of the tutorial. Guess we might have been wrong on that score...

Definitely had it set in the fstab for ext3. It was very flaky -- it would work ok for a while and then freeze up into read-only. I'd reboot and it would work for a while, then freeze again. So far, the problem hasn't resurfaced since I formatted with ext4 (and specified in fstab).

echo RTFM >&2;
exit -1;

N=1
yum install -y lvm2
D=$(grep "unknown partition table" /var/log/messages | tail -n 1 | perl -pe 's/.*: ([^:]*): unknown.*/$1/g');
D=/dev/$D
pvcreate $D
vgcreate vg_$N $D
S=$(vgdisplay vg_$N | grep Total | perl -pe 's/[^0-9]+//g')
lvcreate -l $S vg_$N -n lv_$N
mke2fs -t ext4 /dev/vg_"$N"/lv_$N
tune2fs -m 0 /dev/vg_"$N"/lv_$N
mkdir /media/Volume-$N
mount /dev/vg_"$N"/lv_$N /media/Volume-$N
echo -e "/dev/vg_"$N"/lv_"$N"\t\t/media/Volume-"$N"\t\text4\tnoatime\t\t0 2" >> /etc/fstab

Thanks Tim. Note to others: Make sure you know what the commands in the script do before you try running it.

Add new comment