Growing the Root Partition with Swap Partition at End of Disk
last updated on Sept. 16, 2022
The way to grow the root partition on your Access Anywhere depends on what version of Access Anywhere was originally installed. To determine whether these instructions apply to your Access Anywhere, please consult this page carefully.
To begin, grow the size of the first disk space by expanding storage via the hypervisor or cloud platform. Generally, the appliance will pick up the new disk space, but a reboot is recommended to ensure that the instance recognizes the increase.
After the reboot, log into the instance as smeconfiguser and become the root user:
su -
Check the current size of the root partition:
df -h
Sample Output:
Filesystem Size Used Avail Use% Mounted on /dev/vda2 26G 2.6G 24G 10% / devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 8.5M 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vdb1 36G 79M 34G 1% /var/lib/mysql /dev/vda1 509M 118M 392M 24% /boot tmpfs 591M 0 591M 0% /run/user/5000 tmpfs 591M 0 591M 0% /run/user/5003 tmpfs 591M 0 591M 0% /run/user/0 tmpfs 591M 0 591M 0% /run/user/5001
In the example above the root partition has 24GB free and is mounted on /dev/vda2
Next disable system swap:
swapoff -a sed -i '/swap/d' /etc/fstab
Ensure the partition manager tools are installed:
yum install cloud-utils-growpart parted -y
Get the id of the first disk:
ll /dev/*da
Sample Output:
brw-rw----. 1 root disk 253, 0 Jan 19 18:37 /dev/vda
In our example above the first disk is /dev/vda, however, in your environment the name might be different. Other common names would be /dev/sda or /dev/xvda
List the partitions on the first disk substituting your disk for /dev/vda in the example below:
parted /dev/vda print
Sample Output:
Model: Virtio Block Device (virtblk) Disk /dev/vda: 38.7GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 1049kB 538MB 537MB primary xfs boot 2 538MB 28.5GB 27.9GB primary xfs 3 28.5GB 37.0GB 8590MB primary linux-swap(v1)
Remove the linux-swap partition:
In our example above the linux-swap partition is partition 3 and is the last partition on this disk. If your linux-swap partition is not the last partition or not listed, STOP at this point and contact support. You are most likely not following the proper set of instructions.
parted /dev/vda rm 3 parted /dev/vda print
Sample Output:
Model: Virtio Block Device (virtblk) Disk /dev/vda: 38.7GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 1049kB 538MB 537MB primary xfs boot 2 538MB 28.5GB 27.9GB primary xfs
Grow the root partition (partition #2):
growpart /dev/vda 2
Sample Output:
CHANGED: partition=2 start=1050624 old: size=54525952 end=55576576 new: size=200275935 end=201326559
Expand the root filesystem:
xfs_growfs /
Sample Output:
meta-data=/dev/vda2 isize=512 agcount=6, agsize=1703936 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=9305851, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal bsize=4096 blocks=3328, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 9305851 to 25034491
Check the amount of available space on / partition to confirm success:
df -h
Sample Output:
Filesystem Size Used Avail Use% Mounted on /dev/vda2 96G 2.9G 93G 4% / devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 8.5M 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vdb1 36G 79M 34G 1% /var/lib/mysql /dev/vda1 509M 118M 392M 24% /boot tmpfs 591M 0 591M 0% /run/user/5000 tmpfs 591M 0 591M 0% /run/user/5003 tmpfs 591M 0 591M 0% /run/user/0 tmpfs 591M 0 591M 0% /run/user/5001
Recreate system swap:
dd if=/dev/zero of=/var/swapfile count=8192 bs=1MiB chmod 600 /var/swapfile mkswap /var/swapfile swapon /var/swapfile bash -c 'echo "/var/swapfile swap swap defaults 0 0" >> /etc/fstab' free -h
Sample Output:
total used free shared buff/cache available Mem: 7.8G 504M 134M 8.7M 7.2G 7.0G Swap: 8.0G 0B 8.0G