In the following example, the large disk is /dev/sdb and the customer has allocated a new, smaller disk (/dev/sdd) for the swap partition.
To create a 24gb swap partition on /dev/sdd, use the following command:
$ tw_disk_utils --new-swap 24576:/dev/sdd
Notes:
1. The disk must be a "new disk" as seen in the Disk Configuration utility, i.e. it has not been formatted or partitioned.
2. If the appliance is a member of a cluster, tideway services must be stopped. This should not be required on a standalone appliance.
3. This command does not "move" the existing partition, it just creates a new swap partition.
4. To add a swap file to an existing disk rather creating a swap partition on a new disk, see KA 000296638: Discovery: How to manually add or remove a swap file on an existing partition.
To remove the old swap partition before returning the old disk:
1. Run "swapon -s" to get the partition name of the original swap partition (i.e. /dev/sdb1).
2. As root, execute the following command to disable the swap partition:
$ swapoff /dev/sdb1
3. Login as root then make a backup of the /etc/fstab file, e.g:
$ su
# cp /etc/fstab /etc/fstab.bak
4. Browse /etc/fstab to see the UUIDs of the existing swap partitions, for example:
UUID=db116c8c-d900-4e9b-82ca-23d4895a6041 swap swap defaults 0 0
UUID=a48f504a-8520-4abb-9787-c60fd69850c7 swap swap defaults 0 0
5. Run the blkid command to determine which UUID corresponds to the old swap partition. For example:
[tideway@myaddm ~]$ blkid -U db116c8c-d900-4e9b-82ca-23d4895a6041
/dev/sdb1
6. Remove the entry associated with this UUID from /etc/fstab.
7. Reboot the appliance
8. Run these commands and check the output to make sure everything is configured properly:
$ mount
$ df - h
$ swapon -s
If so, the /dev/sdb disk can be removed from the appliance.