Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

It is recommended to perform a daily / periodic backup of Bahmni data and store it offsite to avoid complete loss of data during a natural disaster, etc. 

Steps to be Performed

Note:

  1. These steps were tested on a CentOS v6.7 machine.
  2. This could cause IO load on the machine, so please perform this on the Slave Machine, or when the EMR is not under load.

Known issue with above encryption step

There is a known issue in Linux Kernel with the above encryption step because of which system needs to be shutdown after copying backup to the external harddrive, then only harddrive gets detached.
https://bugzilla.redhat.com/show_bug.cgi?id=809188 

  1. Encrypt USB/External drive using steps mentioned in https://miguelmenendez.pro/en/articles/encrypt-usb-storage-device-linux-unified-key-setup-luks.html. Note down the password in a secret location. And don't keep a password that is shared / re-used / easy-to-guess. This is a ONE TIME activity for the drive. Encrypting the USB has the advantage that even if you lost it, you will feel a little better that it will be very difficult for someone to get to the data.
  2. Mount the hard drive at /media/USB.
  3. Create directories in the USB (use the mkdir command): 

    # Folder struture
    emr_backup
       |____ database
       |____ patient_images
       |____ document_images
       |____ uploaded-files
       |____ uploaded_results
       |____ pacs_images
           |____archive
    
    
    
    
  4. Unlock it with the command ‘cryptsetup luksOpen LUKS0001’ with passphrase/password.

  5. Mount the hard drive using command ‘mount /dev/mapper/LUKS0001 /media/USB'

  6. Copy the backups as per the below steps (NOTE:rsync is a command line program for doing delta updates / copy. Read more about it here): 

    # Take database backup using the DB backup scripts for MySQL and PostGreSQL DBs
    
    
    cd ~/bahmni-environment/scripts
    ./backup-mysql.sh password
    ./backup-psql.sh
    cp /backup/<two newly created files> /media/USB/emr_backup/database/
    
    
    # Backup image files - patient images, document images, pacs images, uploaded_results, uploaded-files (depending on what features of Bahmni you are using) 
    
    
    rsync -rh --progress -i --itemize-changes --update /home/bahmni/patient_images /media/USB/emr_backup/patient_images/../
    rsync -rh --progress -i --itemize-changes --update /home/bahmni/document_images /media/USB/emr_backup/document_images/../
    rsync -rh --progress -i --itemize-changes --update /home/bahmni/uploaded-files /media/USB/emr_backup/uploaded-files/../
    rsync -rh --progress -i --itemize-changes --update /home/bahmni/uploaded_results /media/USB/emr_backup/uploaded_results/../
    rsync -rh --progress -i --itemize-changes --update /var/lib/bahmni/dcm4chee-2.18.1-psql/server/default/archive /media/USB/emr_backup/pacs_images/archive/../
  7. Umount the disk using ‘umount /media/USB'.

  8. Lock the drive again with ‘cryptsetup luksClose LUKS0001'.

  9. Disconnect the hard drive and keep it in a safe, secure and remote place from the production environment.




Related Links
  • No labels