Pinned Backup a live system

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Backup a live system

      I wanted to backup my omv-extras repo machine while it was running. I was able to back it up and restore to a VM with no problems. So, I tried this with an OMV VM and it works as well. I thought I would post this here first before moving it to the forum. I don't think it needs to be a plugin but I thought it might be handy :)

      Backup - (don't mount the backup drive using web interface unless it will be there when you restore)

      Source Code

      1. apt-get clean
      2. mkdir /media/backup
      3. mount /dev/sdX1 /media/backup
      4. rsync -aAXv /* /media/backup/ --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/export,/home/ftp}
      5. dd if=/dev/sda of=/media/backup/grub.dd bs=446 count=1
      6. dd if=/dev/sda of=/media/backup/grub_parts.dd bs=512 count=1
      7. blkid > /media/backup/uuids
      8. umount /media/backup


      Restore (please ask for help in a new thread for restoring - not easy!)

      Source Code

      1. boot SystemRescueCD
      2. assume sda is new drive, sdb is drive to restore from
      3. mount /dev/sdb1 /mnt/backup
      4. if new drive is same size or larger
      5. dd if=/mnt/backup/grub_parts.dd of=/dev/sda bs=512 count=1
      6. else
      7. dd if=/mnt/backup/grub.dd of=/dev/sda bs=446 count=1
      8. fdisk /dev/sda
      9. create main partition and swap partition
      10. mkswap /dev/sdaX
      11. end if
      12. mkfs.ext4 /dev/sda1
      13. cat /mnt/backup/uuids
      14. tune2fs /dev/sda1 -U uuid_from_above
      15. mount /dev/sda1 /mnt/gentoo
      16. rsync -aAXv /mnt/backup/* /mnt/gentoo/ --exclude=/lost+found
      17. nano /mnt/gentoo/etc/udev/rules.d/70-persistent-net.rules
      18. remove entire eth0 line
      19. umount /mnt/gentoo /mnt/backup
      20. reboot
      21. boot Debian Squeeze install cd and select Rescue Mode from Advanced options
      22. Reinstall grub boot loader on /dev/sda or the following command from shell
      23. grub-install /dev/sda
      Display All
      omv 4.0.6 arrakis | 64 bit | 4.12 backports kernel | omvextrasorg 4.1.0
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please don't PM for support... Too many PMs!
    • Re: Backup a live system

      Nice!
      You can combine this with rsnapshot to have more restore points without much more space on the backup-medium wasted. With a cron job we have a automatic backup :)
      at least for the folders like /var, /usr, /etc ...
      "Glowing days. Don't cry because they are over. Smile because they happened." - Confucius

      Server: 1x 32GB SSD (system) - 5x 2TB Data - 1x 2TB Snapraid-Parity - latest OMV 1.x
      No Support through PM
      Tutorials --- Howto install OMV-Extras --- Upgrade/Update-Problems --- If autoshutdown doesn' -work
    • Re: Backup a live system

      I finally managed to backup my system-drive to one of my Data-Drives with rsnapshot. It runs daily, weekly and monthly, so if a file is changed and I want to restore it, I can ;)
      RSnapshot is using hardlinks. The backup from the last 2 days is using ~3,55 GB with 3,5GB used on my system-drive.

      Heres the config (if anyone needs it)

      /etc/rsnapshot.d/systembackup.conf

      C Source Code

      1. #################################################
      2. # rsnapshot.conf - rsnapshot configuration file #
      3. #################################################
      4. # #
      5. # PLEASE BE AWARE OF THE FOLLOWING RULES: #
      6. # #
      7. # This file requires tabs between elements #
      8. # #
      9. # Directories require a trailing slash: #
      10. # right: /home/ #
      11. # wrong: /home #
      12. # #
      13. #################################################
      14. #######################
      15. # CONFIG FILE VERSION #
      16. #######################
      17. config_version 1.2
      18. ###########################
      19. # SNAPSHOT ROOT DIRECTORY #
      20. ###########################
      21. # All snapshots will be stored under this root directory.
      22. #
      23. snapshot_root /media/f607a0b8-0539-495f-b375-1b722f63db69/Backup_auf_alma/rsnapshot-backup/
      24. # If no_create_root is enabled, rsnapshot will not automatically create the
      25. # snapshot_root directory. This is particularly useful if you are backing
      26. # up to removable media, such as a FireWire or USB drive.
      27. #
      28. #no_create_root 1
      29. #################################
      30. # EXTERNAL PROGRAM DEPENDENCIES #
      31. #################################
      32. # LINUX USERS: Be sure to uncomment "cmd_cp". This gives you extra features.
      33. # EVERYONE ELSE: Leave "cmd_cp" commented out for compatibility.
      34. #
      35. # See the README file or the man page for more details.
      36. #
      37. cmd_cp /bin/cp
      38. # uncomment this to use the rm program instead of the built-in perl routine.
      39. #
      40. cmd_rm /bin/rm
      41. # rsync must be enabled for anything to work. This is the only command that
      42. # must be enabled.
      43. #
      44. cmd_rsync /usr/bin/rsync
      45. # Uncomment this to enable remote ssh backups over rsync.
      46. #
      47. #cmd_ssh /usr/bin/ssh
      48. # Comment this out to disable syslog support.
      49. #
      50. cmd_logger /usr/bin/logger
      51. # Uncomment this to specify the path to "du" for disk usage checks.
      52. # If you have an older version of "du", you may also want to check the
      53. # "du_args" parameter below.
      54. #
      55. #cmd_du /usr/bin/du
      56. # Uncomment this to specify the path to rsnapshot-diff.
      57. #
      58. #cmd_rsnapshot_diff /usr/local/bin/rsnapshot-diff
      59. # Specify the path to a script (and any optional arguments) to run right
      60. # before rsnapshot syncs files
      61. #
      62. #cmd_preexec /path/to/preexec/script
      63. # Specify the path to a script (and any optional arguments) to run right
      64. # after rsnapshot syncs files
      65. #
      66. #cmd_postexec /path/to/postexec/script
      67. #########################################
      68. # BACKUP INTERVALS #
      69. # Must be unique and in ascending order #
      70. # i.e. hourly, daily, weekly, etc. #
      71. #########################################
      72. #interval hourly 6
      73. interval daily 7
      74. interval weekly 4
      75. #interval monthly 3
      76. ############################################
      77. # GLOBAL OPTIONS #
      78. # All are optional, with sensible defaults #
      79. ############################################
      80. # Verbose level, 1 through 5.
      81. # 1 Quiet Print fatal errors only
      82. # 2 Default Print errors and warnings only
      83. # 3 Verbose Show equivalent shell commands being executed
      84. # 4 Extra Verbose Show extra verbose information
      85. # 5 Debug mode Everything
      86. #
      87. verbose 2
      88. # Same as "verbose" above, but controls the amount of data sent to the
      89. # logfile, if one is being used. The default is 3.
      90. #
      91. loglevel 3
      92. # If you enable this, data will be written to the file you specify. The
      93. # amount of data written is controlled by the "loglevel" parameter.
      94. #
      95. logfile /var/log/rsnapshot.log
      96. # If enabled, rsnapshot will write a lockfile to prevent two instances
      97. # from running simultaneously (and messing up the snapshot_root).
      98. # If you enable this, make sure the lockfile directory is not world
      99. # writable. Otherwise anyone can prevent the program from running.
      100. #
      101. lockfile /var/run/rsnapshot.pid
      102. # Default rsync args. All rsync commands have at least these options set.
      103. #
      104. #rsync_short_args -a
      105. rsync_short_args -aAX
      106. #rsync_long_args --delete --numeric-ids --relative --delete-excluded
      107. # ssh has no args passed by default, but you can specify some here.
      108. #
      109. #ssh_args -p 22
      110. # Default arguments for the "du" program (for disk space reporting).
      111. # The GNU version of "du" is preferred. See the man page for more details.
      112. # If your version of "du" doesn't support the -h flag, try -k flag instead.
      113. #
      114. #du_args -csh
      115. # If this is enabled, rsync won't span filesystem partitions within a
      116. # backup point. This essentially passes the -x option to rsync.
      117. # The default is 0 (off).
      118. #
      119. #one_fs 0
      120. # The include and exclude parameters, if enabled, simply get passed directly
      121. # to rsync. If you have multiple include/exclude patterns, put each one on a
      122. # separate line. Please look up the --include and --exclude options in the
      123. # rsync man page for more details on how to specify file name patterns.
      124. #
      125. #include ???
      126. #include ???
      127. #exclude ???
      128. exclude /dev/*
      129. exclude /proc/*
      130. exclude /sys/*
      131. exclude /tmp/*
      132. exclude /run/*
      133. exclude /mnt/*
      134. exclude /media/*
      135. exclude /lost+found
      136. exclude /home/ftp/
      137. exclude /export/
      138. # The include_file and exclude_file parameters, if enabled, simply get
      139. # passed directly to rsync. Please look up the --include-from and
      140. # --exclude-from options in the rsync man page for more details.
      141. #
      142. #include_file /path/to/include/file
      143. #exclude_file /path/to/exclude/file
      144. # If your version of rsync supports --link-dest, consider enable this.
      145. # This is the best way to support special files (FIFOs, etc) cross-platform.
      146. # The default is 0 (off).
      147. #
      148. #link_dest 0
      149. # When sync_first is enabled, it changes the default behaviour of rsnapshot.
      150. # Normally, when rsnapshot is called with its lowest interval
      151. # (i.e.: "rsnapshot hourly"), it will sync files AND rotate the lowest
      152. # intervals. With sync_first enabled, "rsnapshot sync" handles the file sync,
      153. # and all interval calls simply rotate files. See the man page for more
      154. # details. The default is 0 (off).
      155. #
      156. #sync_first 0
      157. # If enabled, rsnapshot will move the oldest directory for each interval
      158. # to [interval_name].delete, then it will remove the lockfile and delete
      159. # that directory just before it exits. The default is 0 (off).
      160. #
      161. #use_lazy_deletes 0
      162. # Number of rsync re-tries. If you experience any network problems or
      163. # network card issues that tend to cause ssh to crap-out with
      164. # "Corrupted MAC on input" errors, for example, set this to a non-zero
      165. # value to have the rsync operation re-tried
      166. #
      167. #rsync_numtries 0
      168. ###############################
      169. ### BACKUP POINTS / SCRIPTS ###
      170. ###############################
      171. # LOCALHOST
      172. backup / localhost/
      173. #backup /etc/ localhost/
      174. #backup /usr/local/ localhost/
      175. # RSYNC.SAMBA.ORG
      176. #backup rsync://rsync.samba.org/rsyncftp/ rsync.samba.org/rsyncftp/
      Display All

      and in my /etc/anacrontab

      Source Code

      1. # system Backup
      2. @daily 10 rsnapshot.daily rsnapshot -c /etc/rsnapshot.d/systembackup.conf daily
      3. @weekly 10 rsnapshot.weekly rsnapshot -c /etc/rsnapshot.d/systembackup.conf weekly
      4. @ monthly 10 rsnapshot.monthly rsnapshot -c /etc/rsnapshot.d/systembackup.conf monthly
      "Glowing days. Don't cry because they are over. Smile because they happened." - Confucius

      Server: 1x 32GB SSD (system) - 5x 2TB Data - 1x 2TB Snapraid-Parity - latest OMV 1.x
      No Support through PM
      Tutorials --- Howto install OMV-Extras --- Upgrade/Update-Problems --- If autoshutdown doesn' -work
    • Re: Backup a live system

      You can also use the new plugin "Backup" :)
      "Glowing days. Don't cry because they are over. Smile because they happened." - Confucius

      Server: 1x 32GB SSD (system) - 5x 2TB Data - 1x 2TB Snapraid-Parity - latest OMV 1.x
      No Support through PM
      Tutorials --- Howto install OMV-Extras --- Upgrade/Update-Problems --- If autoshutdown doesn' -work
    • Re: Backup a live system

      I left it in the testing repo because it doesn't have a restore (yet). The commands it uses are very stable (rsync, dd) and shouldn't never hurt a system because they are just copying the files (no writing).
      omv 4.0.6 arrakis | 64 bit | 4.12 backports kernel | omvextrasorg 4.1.0
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please don't PM for support... Too many PMs!
    • Re: Backup a live system

      I wish it helped with restore. Restore difficulty is still the problem with my method/plugin. I would add to your script backing up the mbr and partition table if you want to be able to restore from that backup.
      omv 4.0.6 arrakis | 64 bit | 4.12 backports kernel | omvextrasorg 4.1.0
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please don't PM for support... Too many PMs!
    • Re: Backup a live system

      Just boot clonezilla on your system using a cd or usb stick. It has a step by step menu that is easy to create a backup. It doesn't install anything to your system. Restore is done the same way.
      omv 4.0.6 arrakis | 64 bit | 4.12 backports kernel | omvextrasorg 4.1.0
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please don't PM for support... Too many PMs!
    • Re: Backup a live system

      The newest version of the backup plugin (for kralizec) lets you install clonezilla and boot to it headlessly. I recommend this method over any other.
      omv 4.0.6 arrakis | 64 bit | 4.12 backports kernel | omvextrasorg 4.1.0
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please don't PM for support... Too many PMs!