Configuring volumes
Once a volume is attached - manual configuration is necessary in order to interact with the block storage volume as a filesystem. This should be performed via command-line.
Configure the volume
Once you have gained an SSH session to your virtual machine - begin configuring the block storage volume for use.
Note down the mount point previously referenced when attaching the volume, e.g. /dev/vdb2
.
- Verify the volume has correctly attached
[root@login1(hpc1) ~]# fdisk -l
Disk /dev/vdb: 5368 MB, 5368709120 bytes
16 heads, 63 sectors/track, 10402 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
- Format the block storage volume
[root@login1(hpc1) ~]# 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
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 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
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
- Mount the block storage volume ready for use
[root@login1(hpc1) ~]# mkdir -p /mnt/refdata01
[root@login1(hpc1) ~]# mount /dev/vdb /mnt/refdata01
[root@login1(hpc1) ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
8.3G 2.3G 5.6G 30% /
tmpfs 939M 0 939M 0% /dev/shm
/dev/vda1 477M 95M 357M 22% /boot
/dev/vdb 4.8G 10M 4.6G 1% /mnt/refdata01
- Verify success by writing some test files
[root@login1(hpc1) ~]# mkdir -p /mnt/refdata01
[root@login1(hpc1) ~]# mount /dev/vdb /mnt/refdata01
[root@login1(hpc1) ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
8.3G 2.3G 5.6G 30% /
tmpfs 939M 0 939M 0% /dev/shm
/dev/vda1 477M 95M 357M 22% /boot
/dev/vdb 4.8G 10M 4.6G 1% /mnt/refdata01
[root@login1(hpc1) ~]# dd if=/dev/zero of=/mnt/refdata01/bigfile count=1024 bs=1M
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 7.35199 s, 146 MB/s