Summary
The ECX virtual appliance ships with three virtual disks. This document describes how to add a new (fourth) virtual disk (hard disk) on your ECX virtual machine. By default, when you deploy the ECX virtual appliance you have the option to only deploy all three virtual disks to one datastore that you specify at the time of deployment. These instructions will guide you through adding a new disk within the virtual machine and to configure it as an LVM. You can then mount it as a new volume or attach this new disk to the existing /data or /data2 volumes within the virtual appliance. For example, if you are adding the fourth disk, you will see a disk device called /dev/sdd within the virtual machine.
Step By Step
ECX – Data Disk Expansion
Introduction
The ECX virtual appliance ships with three virtual disks. This document describes how to add a new (fourth) virtual disk (hard disk) on your ECX virtual machine. By default, when you deploy the ECX virtual appliance you have the option to only deploy all three virtual disks to one datastore that you specify at the time of deployment. These instructions will guide you through adding a new disk within the virtual machine and to configure it as an LVM. You can then mount it as a new volume or attach this new disk to the existing /data or /data2 volumes within the virtual appliance. For example, if you are adding the fourth disk, you will see a disk device called /dev/sdd within the virtual machine.After you deploy the ECX 2.x virtual appliance, below are the lists of disks and partitions on the ECX virtual machine. /dev/mapper/data_vg-data is the LVM disk configured out of the /dev/sdb disk.
In order to run the commands below you need to SSH into the ECX appliance’s command prompt as the root account. The default initial password is “ecxDP758” and you will be prompted to change the password at the first login.Review the disk partitions using the fdisk -l command
Device Boot Start End Blocks Id System
/dev/sda1 * 1 33 262144 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 33 2073 16384000 82 Linux swap / Solaris
/dev/sda3 2073 3917 14810112 83 Linux
Review the physical volumes and the volume groups on the ECX virtual appliance using the pvdisplay and vgdisplay commands respectively.
[root@localhost ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sdb
VG Name data_vg
PV Size 100.00 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 25599
Free PE 0
Allocated PE 25599
PV UUID t3t9cd-7zbq-n8hr-c5yb-7ZKm-231e-WalLIr
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name data_vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 100.00 GiB
PE Size 4.00 MiB
Total PE 25599
Alloc PE / Size 25599 / 100.00 GiB
Free PE / Size 0 / 0
VG UUID uGPDdF-WpNZ-QkpM-1wA5-wcq6-EsJc-pRv7CU
You can see that the allocated PE for the volume group is 100 GB and there is no free PE to allocate further.
Add a Disk to the VM
- Edit the settings of the VM.
- On the Hardware tab, click the “Add…” button.
- Select the option to “Create a new virtual disk.”
- Select the required Disk Size. Then in the “Location” section either:
- select “Store with the virtual machine” to use the current datastore.
- or select “Specfiy a datastore or datatore cluster:” and use the “Browse…” button to select the new datastore where you want your new virtual disk to reside.
- Leave the default values in the “Advanced Options” tab.
- Review and save your changes.
- Click on the "Edit settings" option for the virtual machine. You can see your new hard disk.
8.Add the new SCSI device without rebooting the virtual machine
This can be done by going back to the console of ECX virtual machine and running thecommand: echo "- - -" > /sys/class/scsi_host/host#/scan
Where # is the latest host number.
[root@localhost ~]# echo "- - -" > /sys/class/scsi_host/host2/scan
[root@localhost ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 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: 0x00092ba0
Device Boot Start End Blocks Id System
/dev/sda1 * 1 33 262144 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 33 2073 16384000 82 Linux swap / Solaris
/dev/sda3 2073 3917 14810112 83 Linux
Disk /dev/sdd: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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
You can now see the fourth disk /dev/sdd.
Disk Expansion Procedure
This section will guide you through adding storage capacity from the new disk to an existing ECX volume. For users that are simply adding an additional volume to their appliance, this section does not need to be completed. First you need to setup the filesystem for the new disk, /dev/sdc to be LVM type.
- Follow the commands below on the console. The commands set up a partition for /dev/sdd and set the partition to be of type Linux LVM. The output of fdisk in the end shows you the same.
[root@localhost ~]# fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xb1b293df.
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): n
Command action
e extended
p primary partition (1-4)
p [Selects the primary partition]
Partition number (1-4): 1
First cylinder (1-2610, default 1): [Leave Blank]
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): [Leave Blank]
Using default value 2610
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
- Review the changes to the disk.
Disk /dev/sdd: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0xf8fa3791
Device Boot Start End Blocks Id System
/dev/sdd1 1 2610 20964793+ 8e Linux LVM
3.Review the current list of Physical Volumes (PV).
[root@localhost ~]# pvdisplay--- Physical volume ---
PV Name /dev/sdc
VG Name data2_vg
PV Size 250.00 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 63999
Free PE 0
Allocated PE 63999
PV UUID GdXuqB-V85h-qY8M-EDMD-4bCU-eGFO-usNek5
--- Physical volume ---
PV Name /dev/sdb
VG Name data_vg
PV Size 100.00 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 25599
Free PE 0
Allocated PE 25599
PV UUID t3t9cd-7zbq-n8hr-c5yb-7ZKm-231e-WalLIr
4.Create a new Physical Volume (PV).
[root@localhost ~]# pvcreate /dev/sdd1Physical volume "/dev/sdd1" successfully created
- You can now see the new PV created from /dev/sdd1.
"/dev/sdd1" is a new physical volume of "19.99 GiB"
--- NEW Physical volume ---
PV Name /dev/sdd1
VG Name
PV Size 19.99 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID LwTLNd-VBjg-mWl4-9HtQ-Qync-kiH7-9VarkX
6.Review the Volume Group (VG).
[root@localhost ~]# vgdisplay--- Volume group ---
VG Name data_vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 100.00 GiB
PE Size 4.00 MiB
Total PE 25599
Alloc PE / Size 25599 / 100.00 GiB
Free PE / Size 0 / 0
VG UUID uGPDdF-WpNZ-QkpM-1wA5-wcq6-EsJc-pRv7CU
7.Add the new Physical Volume (PV) to the Volume Group (VG) to increase its space.
[root@localhost ~]# vgextend data_vg /dev/sdd1Volume group "data_vg" successfully extended
- You can see that after the Volume Group (VG) data_vg is extended, there is free space available for logical volumes (or /data volume) to use.
--- Volume group ---
VG Name data_vg
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 119.99 GiB
PE Size 4.00 MiB
Total PE 30717
Alloc PE / Size 25599 / 100.00 GiB
Free PE / Size 5118 / 19.99 GiB
VG UUID uGPDdF-WpNZ-QkpM-1wA5-wcq6-EsJc-pRv7CU
9.Review the Logical Volume (LV) /data. The /data volume currently has:
[root@localhost ~]# lvdisplay--- Logical volume ---
LV Path /dev/data_vg/data
LV Name data
VG Name data_vg
LV UUID gyfOJm-3klD-aapv-tsGA-qeT0-pJ4z-2Fpjba
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2016-04-26 11:35:38 -0400
LV Status available
# open 1
LV Size 100.00 GiB
Current LE 25599
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 14G 2.6G 11G 20% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/sda1 240M 40M 188M 18% /boot
/dev/mapper/data_vg-data
99G 6.4G 87G 7% /data
/dev/mapper/data2_vg-data2
246G 428M 234G 1% /data2
- Add space to the Logical Volume (LV) /data use the “lvextend” command by adding the additional space to the total volume capacity. Be sure to reduce the amount of space added by 1 gb.
In this example we are adding 20 gb of space to a 100 gb volume. First we reduce the amount of space we are adding by 1gb, then we add it to the overall volume capacity, it should read 119 gb:
Size of logical volume data_vg/data changed from 100.00 GiB (25599 extents) to 119.00 GiB (30464 extents).
Logical volume data successfully resized
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/data_vg-data is mounted on /data; on-line resizing required
old desc_blocks = 7, new_desc_blocks = 8
Performing an on-line resize of /dev/mapper/data_vg-data to 31195136 (4k) blocks.
The filesystem on /dev/mapper/data_vg-data is now 31195136 blocks long.
- After running the above, the size of the /data volume will display as:
--- Logical volume ---
LV Path /dev/data_vg/data
LV Name data
VG Name data_vg
LV UUID gyfOJm-3klD-aapv-tsGA-qeT0-pJ4z-2Fpjba
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2016-04-26 11:35:38 -0400
LV Status available
# open 1
LV Size 119.00 GiB
Current LE 30208
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 14G 2.6G 11G 20% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/sda1 240M 40M 188M 18% /boot
/dev/mapper/data_vg-data
118G 6.4G 104G 6% /data
/dev/mapper/data2_vg-data2
246G 428M 234G 1% /data2
The data disks have quotas in place to ensure disks are not filled to capacity. When a data disk is expanded, set a new disk quota hard limit, which is generally 90% of the total capacity. Through the
edquota –u mongod command, change the values under “blocks hard” to your desired quota.