Printer FriendlyEmail Article Link

Landslide: How to expand the size of the virtual hard disk of your Landslide virtual

Environment/Versions
Landslide virtual system version 19.4 or beyond
 
Answer
By default, the hard disk comes with virtual Landslide has only 20G volume, which always causes customer trouble as big test case results file and pcap files on vTAS could eat up the disk space very easily.
So since Landslide 19.4GA, Spirent has provided two ways to expand the disk size of your Landslide virtual without impacting your current system by just one comman run.
1. Add a second volume between 20GB and 500GB for storage of results files.
     This is preferred way as it's won't impact your current system even if there is anything goes wrong during re-size.
      The script mount_sms.sh will automatically move the whole /usr/sms/data directory to the new volume, so that all the big results files will be generated on second volume and you don't need to worry about disk space anymore.
First, in your hypervisor, add a second volume into your virtual machine.
The mount point can be specified while adding the volume to your virtual machine.
To activate the second volume for use by the Landslide application, login to the virtual machine via console or ssh as cfguser and execute the following command mount_sms.sh. 
(Examples assume that the second drive is mounted at /dev/vdc)
sudo /usr/sms/bin/mount_sms.sh "/dev/vdc"
In Openstack you can find the volume location by using following commands
vol_id=\$voldata_id"
vol_dev=/dev/disk/by-id/virtio-\$(echo \$ | cut -c -20)
sudo /usr/sms/bin/mount_sms.sh "$ "
(This step can be done automatically using a Heat template in OpenStack.)
2.  change the size of current drive to a bigger value in hypervisor, then run command expandPartition.sh on landslide coming with 19.4GA to make it effective inside virtual machine.
 The new expandPartition.sh script coming with 19.4GA can be used to “expand” the filesystem within a storage device that is larger than 20GB without adding a second storage device.
 The advantage of the second way is that you will have only hard disk on your virtual Landslide, and the change is transpant for user. But it involves change the partition table using fdisk,  there might be a very small chance that anything goes wrong with parition table change, in that case, you might end up with a corrupted hard disk. So back up your landslide system by TAS manager GUI or command "backup-tas" before re-sizing the disk might be a good idea.
       Follow below steps to re-size your existing disk on virtual machine:
  • Add 200G to the vm’s HD in hypervisor:
  • ​        In KVM, this could be done by running below command in hypervisor (below example is base on adding 300G into current disk):
  •         qemu-img resize -q <the location of your qcow2 image file> +300G
  •         In VMware, this could be done by modifying the Provisioned Size of your disk in VSphere client GUI.
  • Run command: sudo /usr/sms/bin/expandPartition.sh
  • Run command: sudo reboot
  • Double check the new size with df -lh
 
Example output below:

##>lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:        16.04
Codename:       xenial
##>uname -a
Linux CI039 4.15.0-70-generic #79~16.04.1-Ubuntu SMP Tue Nov 12 14:01:10 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
(before resize)
##>df -lh   
Filesystem      Size  Used Avail Use% Mounted on
udev            2.9G     0  2.9G   0% /dev
tmpfs           798M   15M  784M   2% /run
/dev/vda1        19G  6.3G   12G  36% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
cgmfs           100K     0  100K   0% /run/cgmanager/fs
tmpfs           798M     0  798M   0% /run/user/1004
(execution of command)
##>sudo /usr/sms/bin/expandPartition.sh
## expandPartition.sh: fdisk info:: vda2: /dev/vda2       39944190 41940991  1996802  975M  5 Extended
## expandPartition.sh: fdisk info:: vda5: /dev/vda5       39944192 41940991  1996800  975M 82 Linux swap / Solaris
## expandPartition.sh: fdisk info:: vda1: /dev/vda1  *        2048 39942143 39940096   19G 83 Linux
## expandPartition.sh: vda1 last sector (original):: 39942143
## expandPartition.sh: vda1 last sector (adjusted final): 459378624
## expandPartition.sh: computed sector summary:
## expandPartition.sh: vda1 sectors:  2048 --> 459378624;
## expandPartition.sh: vda2 sectors:  459380672 --> 461377535;
## expandPartition.sh: vda5 sectors:  459382720 --> 461377535;
## STEP 1200::expandPartition.sh: Turn off swap...
## STEP 1220::expandPartition.sh: Sync filesystem: sleep, sync, sleep,please wait for a couple of minutes here...
## STEP 1300::expandPartition.sh: Partitions: delete vda2 and vda5, recreate vda1,vda2,vda5...
fdisk from util-linux 2.27.1
 
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
 
 
Command (m for help): Disk /dev/vda: 220 GiB, 236225298432 bytes, 461377536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9c987047
 
Device     Boot    Start      End  Sectors  Size Id Type
/dev/vda1  *        2048 39942143 39940096   19G 83 Linux
/dev/vda2       39944190 41940991  1996802  975M  5 Extended
/dev/vda5       39944192 41940991  1996800  975M 82 Linux swap / Solaris
 
Command (m for help): Partition number (1,2,5, default 5):
Partition 5 has been deleted.
 
Command (m for help): Partition number (1,2, default 2):
Partition 2 has been deleted.
 
Command (m for help): Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): Partition number (2-4, default 2): First sector (39942144-461377535, default 39942144): Last sector, +sectors or +size{K,M,G,T,P} (459380672-461377535, default 461377535):
Created a new partition 2 of type 'Extended' and of size 975 MiB.
 
Command (m for help): Partition type
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p):
Adding logical partition 5
First sector (459382720-461377535, default 459382784): Value out of range.
First sector (459382720-461377535, default 459382784): Last sector, +sectors or +size{K,M,G,T,P} (459382720-461377535, default 461377535):
Created a new partition 5 of type 'Linux' and of size 974 MiB.
 
Command (m for help): Partition number (1,2,5, default 5): Partition type (type L to list all types):
Changed type of partition 'Linux' to 'Linux swap / Solaris'.
 
Command (m for help): Partition number (1,2,5, default 5):
Partition 1 has been deleted.
 
Command (m for help): Partition type
   p   primary (0 primary, 1 extended, 3 free)
   l   logical (numbered from 5)
Select (default p): Partition number (1,3,4, default 1): First sector (2048-461377535, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-459380671, default 459380671):
Created a new partition 1 of type 'Linux' and of size 219 GiB.
 
Command (m for help): Disk /dev/vda: 220 GiB, 236225298432 bytes, 461377536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9c987047
 
Device     Boot     Start       End   Sectors  Size Id Type
/dev/vda1            2048 459378624 459376577  219G 83 Linux
/dev/vda2       459380672 461377535   1996864  975M  5 Extended
/dev/vda5       459382720 461377535   1994816  974M 82 Linux swap / Solaris
 
Command (m for help): Re-reading the partition table failed.: Device or resource busy
The partition table has been altered.
Calling ioctl() to re-read partition table.
 
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
 
## expandPartition.sh: the bootable flag is not enabled on /dev/vda1, enable it now....
 
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
 
 
Command (m for help): Disk /dev/vda: 220 GiB, 236225298432 bytes, 461377536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9c987047
 
Device     Boot     Start       End   Sectors  Size Id Type
/dev/vda1            2048 459378624 459376577  219G 83 Linux
/dev/vda2       459380672 461377535   1996864  975M  5 Extended
/dev/vda5       459382720 461377535   1994816  974M 82 Linux swap / Solaris
 
Command (m for help): Partition number (1,2,5, default 5):
The bootable flag on partition 1 is enabled now.
 
Command (m for help): Disk /dev/vda: 220 GiB, 236225298432 bytes, 461377536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9c987047
 
Device     Boot     Start       End   Sectors  Size Id Type
/dev/vda1  *         2048 459378624 459376577  219G 83 Linux
/dev/vda2       459380672 461377535   1996864  975M  5 Extended
/dev/vda5       459382720 461377535   1994816  974M 82 Linux swap / Solaris
 
Command (m for help): Re-reading the partition table failed.: Device or resource busy
The partition table has been altered.
Calling ioctl() to re-read partition table.
 
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
 
## expandPartition.sh:  The previous warning from fdisk about Re-reading the partition table failed is not be problem, please ignore it
## expandPartition.sh: Expand Partition: Done, Please manually reboot your server, then wait up to 5 minutes for system up.
## expandPartition.sh: Exit expandPartition.sh
##>
##>df -lh  #Before reboots
Filesystem      Size  Used Avail Use% Mounted on
udev            2.9G     0  2.9G   0% /dev
tmpfs           798M   15M  784M   2% /run
/dev/vda1        19G  6.3G   12G  36% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
cgmfs           100K     0  100K   0% /run/cgmanager/fs
tmpfs           798M     0  798M   0% /run/user/1004
##>
 
====== Reboots ======
 
Ubuntu 16.04.6 LTS CI039 ttyS0
 
CI039 login: cfguser
Password:
Last login: Tue Sep 15 10:52:23 CDT 2020 from 10.70.132.85 on pts/0
Spirent Landslide TAS: CI039
TAS Version: 19.4.0.7
|---------------------------------------------|
|        TAS/TS Configuration System          |
| For a list of TAS commands, run 'tas-help'  |
|---------------------------------------------|
(after reboot)

##>df -lh
Filesystem      Size  Used Avail Use% Mounted on
udev            2.9G     0  2.9G   0% /dev
tmpfs           798M   15M  784M   2% /run
/dev/vda1       216G  6.3G  201G   4% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
cgmfs           100K     0  100K   0% /run/cgmanager/fs
tmpfs           798M     0  798M   0% /run/user/1004
##>

Product : TAS Manager,Results Manager,Landslide Client,Tcl API