Page 1 of 1
Volume Group Setup
Posted: Wed Apr 12, 2017 1:25 pm
by ahoward12
Hello All, I would like some help setting up my NNA server to make it easier to increase the space. I have Nextcloud box and was hoping I might be able to do a similar setup.
I would like to create a volume group to make it easier to expand. My NNA server is virtual (CentOS 6) in a VMware environment. The only disk right now is /dev/sda1. It was 10G and after trying and failing to implement a VG the correct way, I added some space, booted to an ISO and then extended the volume 15G. While this worked, it's simply not the way I want to do it.
I took a snapshot prior to this and here is what I have tried so far: Obviously my step 7 is screwing me because that is wiping the partition. Is there any way to add my /dev/sda1 to a volume group without wiping it?
1) cfdisk /dev/sda
2) created a new logical extended partition /dev/sda2
3) created lvm 5G /dev/sda5
4) pvcreate /dev/sda5
5) vgcreate nagios-vg /dev/sda5
6) lvcreate -l 100%FREE -n root nagios-vg
7) vgextend nagios-vg /dev/sda1 **Warning: ext4 signature detected on /dev/sda1 at offset 1080. Wipe it? [y/n]: Y
8) lvextend /dev/nagios-vg/root /dev/sda1 extended from 5 to 19.99G
Re: Volume Group Setup
Posted: Wed Apr 12, 2017 3:01 pm
by tgriep
We do have some instructions for resizing the Nagios XI server if your NNA server was setup using the same partition scheme, you could use those instructions to increase the systems drive.
https://assets.nagios.com/downloads/nag ... M-Disk.pdf
Re: Volume Group Setup
Posted: Wed Apr 12, 2017 3:11 pm
by ahoward12
I imported an OVF template from you guys but it does not have the scheme outlined in this pdf. That pdf indicates that I should have a logical volume in place, and for that to be, it would have to belong to a volume group, which again is not there. The tools used in that pdf, mainly lvm2, were not on the machine.
Nevertheless, I followed the directions correctly and I get to where it says pvresize /dev/sda2. I cannot resize a pv that was never created.
Re: Volume Group Setup
Posted: Wed Apr 12, 2017 3:23 pm
by tgriep
OK, I wasn't sure if you used the pre-configured OVF file but I do have some instructions for increasing the space for that image.
Make proper backups of your Nagios NA installation before proceeding.
Code: Select all
Resizing the Virtual Disk
The first step is to modify the amount of disk space VMware is allocating to your XI image.
VMware ESX Server has the capability to change virtual disk size with the VM running. DO NOT do this, as it is confirmed to be
unstable for some setups and environments. Shutdown the VM before making any changes to the virtual disk.
The virtual disk size setting you need can be found under:
(Your VM) → Summary → Commands → Edit Settings → Hardware → Hard Disk 1 → Capacity → New Size.
For VMware Player:
The disk size setting can be found using the following options on the overview page:
(Your VM) → Edit virtual machine settings → Hardware → Hard Disk (SCSI) → Utilities → Expand → Maximum disk size
Increase the drive to the size you require and then power on the Virtual Appliance.
Resizing the Partition
The next step is to modify the Linux partition table within the XI virtual machine to recognize that the disk size has changed. This can
be done using the fdisk utility, which is a partition editor. For the virtual machine provided by Nagios Enterprises:
/dev/sda1 is used for the root/boot partition
Establish a terminal session to your Nagios NA server and then execute the following command:
fdisk /dev/sda
You should print the current partition table so you can keep track of your changes as you go.
Command (m for help): p
Take a screenshot of it or copy the screen contents for a text file in case you want to reference it later.
To resize a partition, you actually “delete” it and then add a new one with the new size, making sure to place the beginning of the new
partition at the same sector/cylinder as the old one started. This process is NOT destructive, your data still remains on the disk. These
first steps are for deleting the partition:
Press d to delete the partition
Command (m for help): d
These next steps re-create the Primary partition:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
Type p
Partition number (1-4): 1
You should be able to accept the defaults for the start and end point (just press Enter).
Double-check that they make sense when compared to the information printed earlier.
These steps configure the partition type to Linux:
Command (m for help): t
Hex code (type L to list codes): 83
At this point you are done making your changes, and just need to write them to the disk. It is a good idea to print the new partition table
to ensure you entered things correctly. Once thing look okay, you can commit (write) the partition table to disk:
Command (m for help): w
The partition table has been altered!
The write command will exit the fdisk program.
You will now need to reboot the virtual machine to allow the kernel to recognize the new partition table, execute the following command:
reboot
Resizing the Filesystem
The last step is to change the filesystem residing on the logical volume so that it knows to put files in that space. Execute the following command:
resize2fs /dev/sda1
It will take a few seconds and the drive will be resized.
You can confirm the disk resize worked by using df -h to display a summary of filesystem size and usage.
Re: Volume Group Setup
Posted: Wed Apr 12, 2017 3:35 pm
by ahoward12
That doesn't make logical sense to do that..However, I did it and wiped the file system, when I try to boot I get an "Error 17". I have a snap shot I can revert to, problem still isn't solved.
Appreciate your time
Re: Volume Group Setup
Posted: Wed Apr 12, 2017 4:00 pm
by tgriep
That is strange, I used those steps to resize my NNA server from the OVF file install.
Another option is to add a second drive to the image and add any new sources to that new partition or move the existing sources data to the new partition and create a symlink to the existing folder.
If you create a source and click on Advanced Settings link, it gives you the option to point the source's data directory to a different folder.
This will also show you the folder where an existing source is storing it's data.
Re: Volume Group Setup
Posted: Thu Apr 13, 2017 7:35 am
by ahoward12
Tgriep thanks. I was hoping to establish a Volume Group and do it that way but that is a reasonable work around. Is there anyone at Nagios that still may be able to assist me with the Volume Group route of this, or am I out of luck here? As I said in my original post, I am not really looking for a step by step of how to do it, I am more looking for an answer of whether it is possible or not?
Edit 1: Looking into my NAGIOS XI server, that PDF, as well as your scenario will work perfectly. However, it will not work the same on my NNA server. Imported a fresh OVF Template for Network Analyzer 64-bit from your website and it is not setup the way it is referred to in that PDF. Again that PDF outlines using a Volume Group and a Logical Volume. IF* it is intended to be set up like the Nagios XI OVF template / PDF scheme is, I would love to get that fixed and I'll import a new one.
Edit 2: Continuing from above, I imported a new OVF Template I was able to extend the drive using your* method, not the method outlined in the PDF.
Re: Volume Group Setup
Posted: Thu Apr 13, 2017 8:56 am
by tgriep
A lot of customers install the products on to their own images so that is why I posted the PDF file as a guide to help out in the steps.
You could create your own install anyway you want so you can increase it when needed and then use the following instructions to download and install NNA on that.
http://assets.nagios.com/downloads/nagi ... ctions.pdf
I am hoping that the next release of NNA, the partition scheme is changed to allow an easier way to grow it.
Re: Volume Group Setup
Posted: Thu Apr 13, 2017 9:30 am
by ahoward12
Ok awesome, thank you for the help. What I am going to do is give 5 more GB of space in VMware, create Volume Group from it, tell NNA to store the data there (the way you outlined to do it in the web interface). Once I start putting data in that Volume Group I can then extend that volume group live with no issues, as many times as I want without any worry of losing data. Steps are below for anyone coming across this. I appreciate all of your help and ideas on this! Hopefully the next OVF template, as you said will be built slightly different. You can close this ticket.
With only /dev/sda1 existing (Snapshot your machine prior to this..)
1) cfdisk /dev/sda
a. Creates a new logical extended partition /dev/sda2
b. Changed the partition type of /dev/sda5 to 8e (LVM)
2) pvcreate /dev/sda5
a. Creates a physical volume /dev/sda5
3) mkfs.ext4 /dev/sda5
a. Creates a physical volume /dev/sda5
4) vgcreate nagios-vg /dev/sda5
a. Creates a Volume Group named nagios-vg and adds /dev/sda5 to it
5) lvcreate -l 100%FREE -n root nagios-vg
a. Creates a Logical Volume named root with 100% of the free space available from the nagios-vg volume group
6) mkfs.ext4 /dev/nagios-vg/root
a. Creates an ext4 file system on the on the lvm
7) mkdir /nagios-vg/
mount /dev/nagios-vg/root /nagios-vg
a. Creates a directory to mount the LVM
b. Mounts the LVM for use.
Go into NNA Web UI, recreate the source and change the directory under advanced to the new logical volume "root"
At a later time if you want to extend that VG, follow these steps
1) cfdisk /dev/sda
a. Create a new logical extended partition /dev/sda*
b. Changed the partition type of /dev/sda* to 8e (LVM)
2) reboot*
2) pvcreate /dev/sda*
a. Creates a physical volume /dev/sda*
3) mkfs.ext4 /dev/sda*
a. Creates an ext4 file system on the PV /dev/sda*
4) vgextend nagios-vg /dev/sda*
a. Extends the VG to encompass /dev/sda*
5) lvextend /dev/nagios-vg/root /dev/sda*
a. Extends the logical volume root within the volume group nagios-vg to “see” the space encompassed from adding the new partition /dev/sda*
b. Logical Volume extended from *G to *G
6) mkfs.ext4 /dev/nagios-vg/root
a. Creates an ext4 file system on the on the lvm
The asterisk after the PV's is to represent different partitions you will have. Make sure you grant 755 to the /nagios-vg directory, recursively. Also may want to add it to your fstab