Author : Sanjeev Gupta
Move your Archive Version server’s database to a new location without losing any data or information.
Customers using Novell Archive and Version Services in their environment may face problems when the postgres database used by the Archive and Version server grows in size and can’t be kept anymore on the default location (/var/opt/novell/arkmanager/data). Moreover some customers may want to move the database files on a separate disk hereby providing faster response and performance benefit to Archive and Version Services.
Archive and Version Services or configuration wizard doesn’t provide a method or the steps to achieve this.
You can do this by following the steps below, without affecting the server service and with very little downtime on Archive and Version Services. This should not cause any loss of data or information if done correctly.
Steps involved in this procedure
- Identify the owner and user-group currently configured for the Archive and Version database files.
- Stop the Archive Version service and database.
- Copy or move the database files to other required location on server.
- Fix the owner and group of Postgres database files.
- Make the required changes in Archive and Version scripts.
- Start the Archive Version service.
- Test and verify.
- When Archive and Version Services is configured using YaST, it provides you an option to choose the database "username", "port" and "password" for the "postgres" database it uses internally to store information about archived files.
This information is required by the wizard to create database data-files and provide the right ownership to the files. We need this information before we go ahead with this job.
- One easy way to do this is to see the permissions on already existing database files. Archive and Version Services configures the database by default at "/var/opt/novell/arkmanager/data".
- On the terminal as root do a cd to "/var/opt/novell/arkmanager/data" and run "ls –la" to get the "owner" and "group" information of the files.
- As you can see in the above screenshot, the third column represents the owner of files (i.e arkuser) and the fourth column represents the user group (i.e arkuser_pggrp). Make a note of this information as we would require this in our steps later.
- Create a new ext or reiserfs partition on the disk which you want to use for our new moved database. If you just want to change the location of database files, you need not create a new partition.
- For this demo, I am moving my database files to a new partition and mounted as "/ark_db". You can create a new partition by running "yast2 disk" on the terminal as root user.
- Change your current directory to your new location for the database by doing a "cd /" on the terminal.
# cd /ark_db
- Before we copy the database files to the new location, it’s essential to close the current database files which are in use, by running instance of database and Archive Version service.
- To stop the Archive and Version service and database, run rcnovell-ark stop on the terminal.
# rcnovell-ark stop
- You can run rcnovell-ark status to verify that the service has indeed stopped.
To further verify that postgres database has been stopped, run ps –ef | grep postmaster to ensure that no instance of the process is running.
# rcnovell-ark status
# ps –ef | grep postmaster
- After ensuring that the database and ark service is stopped do a cd to the new location for the database files. And make a copy of the database files from the default location to the new location.
# cp –r /var/opt/novell/arkmanager/data/ /ark_db/
Note: In this step, we are copying the database files from the default location to our new location i.e /ark_db folder.
Note: You can choose to move the files directly to a new location but we are not copying to ensure an easy goback path in case something goes wrong. We can always delete the older files if all works well after moving the files.
Ensure that there is enough space on the new location before copying or moving the files.
- Depending on the size of the database and your server hardware, it may take some time to copy the files.
- After you have copied the files to the new location, the permissions of the files would have changed at the new location according to the user you used to copy the files. In our case, we are doing the operation as root, so the current owner of the files would be root. We need to change the owner and group of the copied files. The information collected by us in previous step-4 would be helpful here.
- To change the ownership of the copied files to the original user, issue the following command on the terminal.
# chown –R <owner of original data files> <folder or location of copied files>
# chown –R arkuser /ark_db/data
- To change the group of the copied files to the original user, issue the following command on the terminal.
# chgrp –R <owner of original files> <folder/location of copied files>
# chgrp –R arkuser_pggrp /ark_db/data
Note: The -R option will make the change recursively to all the files and folders of new data folder.
- After we have copied the database and provided it the right owner and group, we need to inform this change to the Archive and Version server. We need to change the path of the database files to the new one in the Archive Version server configuration files for this. This change needs to be made in the two files below.
- Open the first file for edit using vi or your favorite file editor.
# vi /etc/opt/novell/arkmanager/conf/arkdatadir.conf
This file keeps the path of the database data files. Change the path from the current location of the data files to the new one where we have made a copy of the data files. (i.e /ark_db/data)
- Open the second file for edit using vi or some other file editor.
# vi /opt/novell/arkmanager/bin/pg_restart.sh
You will see an entry which has the location of the old database data files. Edit the line and change the path to the new location of the data files.
su arkuser -c "postmaster -D /var/opt/novell/arkmanager/data -h 127.0.0.1 -p 5432 -i"
Change the above entry to:
su arkuser -c "postmaster -D /ark_db/data -h 127.0.0.1 -p 5432 -i"
Note: It’s always a good idea to make a copy of configuration files. This will ensure quick restore to original position.
- You have now changed the location of your database files. To verify all is good, issue rcnovell-ark start on the terminal.
# rcnovell-ark start
- If you see an entry "done" in green for postgreSQL database and Archive and Version server, your configuration is correct.
- To do a second level check that the postgres server is now using the files at the new location, issue ps –ef | grep postmaster on the terminal.
# ps –ef | grep postmaster
- If you see the postmaster process using the new location of the data files, you can be sure that your database configuration is correct.
- To verify proper working of Archive and Version Services, restore or view the version of a file on the NSS volume configured for archive service. If you are successful in restoring and viewing older versions of a file, everything is correct.
- You can now delete the old data files of postgres server to free space on your disk. For this, issue the following command on a terminal.
# rm –rf /var/opt/novell/arkmanager/data
- This completes your move of an Archive and Versioning postgres database to a new location without losing any data or files.
Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).
It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.