Mount BlockStorage Device on Bluemix VM

129 views Asked by At

I have a debian VM deployed at BlueMix, and I want to increase the size of the hard drive mounting a BlockStorage Device.

I followed the instructions on the new Beta BlockStorage Service and created a volume, and then attached it to the VM as a new device, but seems that although the volume is attached to the VM; is not automatically mounted.

I tryed several ways to mount it, but I did not find it the correct way. In fact, I even tryed to clone the line that came on the fstab refering to the root device mounted (I suspected that the additional volume should be similar) but it did not work (even broke the reboot of my machine)... So.. Can someone please advice me how to mount the BlockStorage Bluemix Service on the VM Machine ?

THks!

1

There are 1 answers

0
cookiron On BEST ANSWER

By attaching a volume you've essentially done the equivalent of plugging a raw, physical hard disk into your system. Before you can mount it you'll have to format it with a filesystem known by your OS.

After attaching the device you should be able to see the raw block device, for example with the lsblk command:

[mysys]# lsblk
sr0     11:0    1  416K  0 rom
vda    252:0    0   20G  0 disk
--vda1 252:1    0   20G  0 part /
vdb    252:16   0   25G  0 disk

Typically vda is your root device, so in this example the additional device is vdb with 25GB. Now you can create a filesystem with the mkfs command, for example:

[mysys]# mkfs.ext4 /dev/vdb
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1638400 inodes, 6553600 blocks
...

mkfs supports different filesystems, so you might want to check the man pages on the system you're using (man mkfs).

Now all that's left is to create a mount point and mount the new filesystem:

[mysys]# mkdir /mnt/test
[mysys]# mount /dev/vdb /mnt/test

The additional space is now available:

[mysys]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G  946M   18G   5% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
/dev/vdb         25G  172M   24G   1% /mnt/test