Creating Swap partition for ZENworks Appliance

Creating Swap partition for ZENworks Appliance

ISSUE:

ZENworks Appliance by default configured with swapfile as swap, to improve performance of the device a swap partition is helpful, which may be required in Embedded database ZCM zones

 

HOW TO STEPS:

Preparation:

  1. Since the following procedure requires changes to the partition table, a loss of data is possible. Please ensure to create a backup of the system before performing any action!
  2. Ensure your restore procedure works correctly!
  3. Check carefully if an MSDOS or GPT partition table was created. This information can easily be obtained from the parted -l / fdisk -l output easily

Note: Only parted is able to edit the GPT partition table. If a GPT partition table is used

This article is going to cover the following three approaches to accomplish the resize of a virtual disk in a VMware based environment:

  1. Expanding the file system by adding a new disk
  2. Resizing the disk using parted

 

Create Swap partition by Resizing 2nd HDD

We can create the swap partition by shrinking the second HDD mounted as Vastorage, follow the steps below:

  1. Stop ZENworks services using vastorage by running the following commands
    1. systemctl stop novell-*
    2. systemctl stop zenpostgresql.service
  2. use parted to resize the partition to make space for swap, for example, if the second HDD is of 100GB and 8 GB needed for swap below are the steps to shrink:
    1. /dev/sdb” to enter parted prompt:execute “parted 

hostname: ~ # parted /dev/sdb
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) resize
Partition number? 2
End?  [21.5GB]? 92.0GB
(parted) quit
Information: You may need to update /etc/fstab.

Note: changes cannot be reverted so take a backup of data and make sure recovery works.

  1. Now we can start ZENworks and Database services.
  2. Again enter parted prompt and create a partition for swap:
    1. Running parted -lwill show the new end of the partition
    2. Which would now be in our current example: 92.0GB
    3. Now to create new partition execute command parted /dev/sdb to get into parted prompt
      1. To get the available free space execute print free
      2. Now to create a 2 primary parttion execute mkpart primary

  (parted) mkpart primary                                                  

File system type?  [ext2]? linux-swap                                         

Start? 92.0GB

End? 100.0 %

5.Now we have created swap partition created by resizing existing partition.

 

Create swap by adding new HDD to Appliance

 

            In this option we add third HDD to the appliance and create a swap partition

  1. Shutdown the appliance and edit the vm setting to add new HDD of required swap size.
  2. Boot the Appliance and either use yast to create swap parttion on third HDD added or use below parted   
  3. Running parted -l command to see the new HDD is detected
  4. Execute command parted /dev/sdc  to get in to parted prompt

# parted /dev/sdc

GNU Parted 3.1

Using /dev/sdb

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) mklabel msdos                                                   

Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will

be lost. Do you want to continue?

Yes/No? Yes

(parted) mkpart primary                                                   

File system type?  [ext2]? linux-swap                                          

Start? 0                                                                 

End? 100%

 

now exit the parted prompt by giving command “q”

 

Enabling Swap and Making entry in /etc/fstab

  1. We have to format the new parttion with filesystem type swap:

#mkswap /dev/sdb2 or /dev/sdc1

Setting up swapspace version 1, size = 8 GiB (8588881920 bytes)

no label, UUID=e3af33ec-f587-48ba-af67-adcef4146c74

  1. Enable swap by executing the command swapon  /dev/sdb1  or swapon  /dev/sdb1 
  2. turnoff file based swap and delete the file swapoff  /swapfile and then rm /swapfile
  3. use free command to see the swap created in the system.
  4. edit /etc/fstab  file to make entry to the new swap partition
    1. add the below line to the end of the file:
      1. /dev/sdb2 none swap sw 0 0
    2. execute mount -a to check fstab file is properly edited
Labels (1)

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2019-10-16 05:59
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.