Total Pageviews

4506

How do I create a compressed backup image of a Red Hat Enterprise Linux machine to an external drive using dd?

Environment
  • Red Hat Enterprise Linux 4
  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
Issue
  • How do I create a compressed backup image of a Red Hat Enterprise Linux machine to an external drive using dd?
  • Is it possible to create an image of installed system and use it to boot the system?

Solution

To create a compressed disk image with "dd" :
  • Boot into rescue mode with the installation media
  • Create a mount point for your external drive:
# mkdir /mnt/external
  • Mount your external drive:
# mount /dev/sdb1 /mnt/external
  • Create the compressed disk image:
# dd if=/dev/sda | gzip -9 > /mnt/external/filename.img.gz
  • To recover this in future, run the following command :
# zcat /mnt/external/filename.img.gz | dd of=/dev/sda
Note: Do not use dd to backup block devices that are currently in use. Doing so will likely cause inconsistency on the filesystem(s).

Create an image of installed system
  • To create an image of installed system, get USB of exact same size.
  • Recreate the initrd with USB support
# vi /etc/dracut.conf
        add_drivers+="ehci-hcd uhci-hcd xhci-hcd usb-storage scsi-mod sd-mod sd hid-microsoft hid-generic usbhid"     
# dracut -f -v
  • Force a file check on boot
#  touch /forcefsck
  • Create image using dd command:
#  dd if=/dev/sda  of=/dev/<usb device> bs=8192
  • Add any subsequent partitions to the usb drive in 4gb chunks.
  • Insert usb and boot machine.

No comments:

Post a Comment

ORA-00845: MEMORY_TARGET not supported on this system

 The shared memory file system should have enough space to accommodate the MEMORY_TARGET and MEMORY_MAX_TARGET values. To verify: SQL> sh...