Creating Swap partition for ZENworks Appliance

2 Likes
over 1 year ago

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/sdc

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/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/sdc1 none swap sw 0 0
    2. execute mount -a to check fstab file is properly edited

Labels:

Configuration Management
How To-Best Practice
Comment List
Anonymous
Related Discussions
Recommended