Move Your Archive Version Server’s Database to a New Location Without Losing Any Data


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

    1. Identify the owner and user-group currently configured for the Archive and Version database files.


    1. Stop the Archive Version service and database.


    1. Copy or move the database files to other required location on server.


    1. Fix the owner and group of Postgres database files.


    1. Make the required changes in Archive and Version scripts.


    1. Start the Archive Version service.


    1. Test and verify.


      1. 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.

    1. 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".


    1. 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.


    1. 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.


    1. 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.


    1. 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.


    1. Change your current directory to your new location for the database by doing a "cd /" on the terminal.
      # cd /ark_db


    1. 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.


    1. To stop the Archive and Version service and database, run rcnovell-ark stop on the terminal.
      # rcnovell-ark stop


    1. 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


    1. 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.


    1. Depending on the size of the database and your server hardware, it may take some time to copy the files.


    1. 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.


    1. 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


    1. 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.


    1. 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.


    1. 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)


    1. Open the second file for edit using vi or some other file editor.
      # vi /opt/novell/arkmanager/bin/

      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.

      Original entry:
      su arkuser -c "postmaster -D /var/opt/novell/arkmanager/data -h -p 5432 -i"

      Change the above entry to:
      su arkuser -c "postmaster -D /ark_db/data -h -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.


    1. 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


    1. If you see an entry "done" in green for postgreSQL database and Archive and Version server, your configuration is correct.


    1. 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


    1. If you see the postmaster process using the new location of the data files, you can be sure that your database configuration is correct.


    1. 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.


    1. 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


    1. This completes your move of an Archive and Versioning postgres database to a new location without losing any data or files.



How To-Best Practice
Comment List
Related Discussions