Scenario 2: Extending ASGARD Disk Space by Increasing Disk Size and Resize File System

This section is only relevant if you increased the disk size of your existing disk. If you attached a second disk, please refer Scenario 1: Extending Disk Space by Attaching a Second Disk to the Analysis Cockpit. This method is more advanced and should only be used if you are comfortable with the steps.

This section focuses on extending the disk space in case you increased the disk size of your existing/attached disk. We will extend the disk space by extending the partition and resizing the file system.

Step 1: Login to ASGARD via SSH

Step 2: Stop the service

Bash
sudo systemctl stop asgard-analysis-cockpit.service

This will stop the Analysis Cockpit service. You can start the service again after you have extended the disk space.

Step 3: Check current disk space

Run the following command to check the current disk space:

Bash
nextron@cokpit:~$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         2.0G     0  2.0G   0% /dev
tmpfs                        395M  5.4M  390M   2% /run
/dev/mapper/asgard--vg-root   24G  4.1G   18G  19% /
tmpfs                        2.0G     0  2.0G   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                        2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda1                    470M   83M  363M  19% /boot
tmpfs                        395M     0  395M   0% /run/user/1000

The output will show the current disk space usage.

Step 4: Identify attached disk

Run the following command to identify your attached disk:

Bash
nextron@cokpit:~$ lsblk
NAME                  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                     8:0    0   35G  0 disk
├─sda1                  8:1    0  487M  0 part /boot
├─sda2                  8:2    0    1K  0 part
└─sda5                  8:5    0 24.5G  0 part
  ├─asgard--vg-root   254:0    0 23.6G  0 lvm  /
  └─asgard--vg-swap_1 254:1    0  980M  0 lvm  [SWAP]
sr0                    11:0    1 1024M  0 rom

The output will show the attached disks. In this example, our disk is sda.

Step 5: Create new partition

We now have to increase the partition size. Please follow the next steps carefully:

Bash
nextron@cokpit:~$ sudo fdisk -u /dev/sda

Press "p" to print the current partitions of the disk:

Bash
Command (m for help): p
Disk /dev/sda: 35 GiB, 37580963840 bytes, 73400320 sectors
Disk model: HARDDISK
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: 0x492a1933

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sda1  *       2048   999423   997376  487M 83 Linux
/dev/sda2       1001470 52426751 51425282 24.5G  5 Extended
/dev/sda5       1001472 52426751 51425280 24.5G 8e Linux LVM

You can see that **/dev/sda2** is our extended partition. Please note
the ``End`` value of the ``Extended`` partition (52426751 in this case).

Please note that the First sector value should be the End value + 1 of the Extended partition from the previous step. The Last sector value can be left empty to use the remaining disk space. Please use the default value for the partition type (primary), partition number, and last sector.

Bash
Command (m for help): n
Partition type
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p): p
Partition number (3,4, default 3):
First sector (999424-73400319, default 999424): 52426752
Last sector, +/-sectors or +/-size{K,M,G,T,P} (52426752-73400319, default 73400319):

Created a new partition 3 of type 'Linux' and of size 10 GiB.

Command (m for help): p
Disk /dev/sda: 35 GiB, 37580963840 bytes, 73400320 sectors
Disk model: HARDDISK
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: 0x492a1933

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sda1  *        2048   999423   997376  487M 83 Linux
/dev/sda2        1001470 52426751 51425282 24.5G  5 Extended
/dev/sda3       52426752 73400319 20973568   10G 83 Linux
/dev/sda5        1001472 52426751 51425280 24.5G 8e Linux LVM

Partition table entries are not in disk order.

Change the partition type to Linux LVM:

Bash
Command (m for help): t
Partition number (1-3,5, default 5): 3
Hex code (type L to list all codes): 8e

Changed type of partition 'Linux' to 'Linux LVM'.

Command (m for help): p
Disk /dev/sda: 35 GiB, 37580963840 bytes, 73400320 sectors
Disk model: HARDDISK
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: 0x492a1933

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sda1  *        2048   999423   997376  487M 83 Linux
/dev/sda2        1001470 52426751 51425282 24.5G  5 Extended
/dev/sda3       52426752 73400319 20973568   10G 8e Linux LVM
/dev/sda5        1001472 52426751 51425280 24.5G 8e Linux LVM

Partition table entries are not in disk order.

We can save the new partition table. This will exit the tool:

Bash
Command (m for help): w
The partition table has been altered.
Syncing disks.

Running "lsblk" we can see a new partition:

Bash
nextron@ockpit:~$ lsblk
NAME                  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                     8:0    0   35G  0 disk
├─sda1                  8:1    0  487M  0 part /boot
├─sda2                  8:2    0    1K  0 part
├─sda3                  8:3    0   10G  0 part
└─sda5                  8:5    0 24.5G  0 part
  ├─asgard--vg-root   254:0    0 23.6G  0 lvm  /
  └─asgard--vg-swap_1 254:1    0  980M  0 lvm  [SWAP]
sr0                    11:0    1 1024M  0 rom

Step 7: Create new physical volume

Run “pvcreate” to create a new physical volume for the new partition:

Bash
nextron@ockpit:~$  sudo pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created.

Running “pvs” we can see all the physical volumes. The new physical volume /dev/sda3 has been created and is not yet part of the volume group (VG).

Bash
nextron@ockpit:~$ sudo pvs
  PV         VG        Fmt  Attr PSize   PFree
  /dev/sda3            lvm2 ---   10.00g 10.00g
  /dev/sda5  asgard-vg lvm2 a--  <24.52g     0

Step 8: Extend volume group

Extend the volume group with our new physical volume:

Bash
nextron@ockpit:~$ sudo vgextend asgard-vg /dev/sda3
  Volume group "asgard-vg" successfully extended

Running “vgs” we can see that the volume group asgard-vg has been extended (VFree).

Bash
nextron@ockpit:~$ sudo vgs
  VG        #PV #LV #SN Attr   VSize   VFree
  asgard-vg   2   2   0 wz--n- <34.52g 10.00g

Step 9: Add physical volume

Add the physical volume to the volume group:

Bash
nextron@ockpit:~$ sudo lvextend -l +100%FREE /dev/asgard-vg/root
  Size of logical volume asgard-vg/root changed from 23.56 GiB (6032 extents) to 33.56 GiB (8592 extents).
  Logical volume asgard-vg/root successfully resized.

Explanation: /dev/asgard-vg/root is the logical volume that we want to extend. The "-l +100%FREE" option tells the lvextend command to use all the free space available in the volume group. The device /dev/asgard-vg is our volume group. The logical volume root is what we extended (output of "sudo lvs").

Step 10: Resize file system

Bash
nextron@ockpit:~$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         2.0G     0  2.0G   0% /dev
tmpfs                        395M  5.4M  390M   2% /run
/dev/mapper/asgard--vg-root   33G  4.2G   28G  14% /
tmpfs                        2.0G     0  2.0G   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                        2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda1                    470M   83M  363M  19% /boot
tmpfs                        395M     0  395M   0% /run/user/1000

Step 11: Verify disk size changes

Run the following command to verify the change in disk size:

Bash
nextron@ockpit:~$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         2.0G     0  2.0G   0% /dev
tmpfs                        395M  5.4M  390M   2% /run
/dev/mapper/asgard--vg-root   33G  4.2G   28G  14% /
tmpfs                        2.0G     0  2.0G   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                        2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda1                    470M   83M  363M  19% /boot
tmpfs                        395M     0  395M   0% /run/user/1000

You will notice that /dev/mapper/debian--vg-root has grown.

Step 12: Reboot system

If everything looks correct, you can reboot your system to make sure everything is working as expected.

Bash
extron@ockpit:~$ sudo reboot