Results 1 to 4 of 4

Thread: Disk imaging software that supports encrypted LVM partitions?

  1. #1

    Default Disk imaging software that supports encrypted LVM partitions?

    I can see from /var/log/messages error messages and weird crashes that the disk in my laptop is on the way out. I plan to replace it but to do this I'd rather not have to install everything again.

    My laptop has these partitions:
    Windows Recovery (10GB)
    Windows 7 (NTFS 96.6GB)
    Linux /boot (ext4 100MB)
    Linux LVM (encrypted, 143GB)

    I need software that will allow me to create an image (or images) of all these partitions, save the image(s) to a USB hard drive and restore from those images once I've put the new, blank, hard drive into the laptop.

    Does anyone know of software (either open source or commercial pay-ware) or a technique to do this? I'd prefer not to just dd everything as it will be very slow.

  2. #2
    Join Date
    May 2011
    Location
    Lublin, Poland
    Posts
    224

    Default Re: Disk imaging software that supports encrypted LVM partitions?

    Maybe Clonezilla will do the trick.
    I don't know better app for such work, and it's free...

    You can even try newest "unstable" version based on kernel 3.0

    http://clonezilla.org/
    Desktop: Intel Q8300@3,3Ghz, 4GB RAM, Foxconn P35A, Sapphire HD5670, OpenSUSE x64
    Server: Via C3@1.4Ghz, 768MB RAM, 8GB Microdrive + OpenSuSE x86
    and other boxes running Windoze

  3. #3
    Join Date
    Nov 2011
    Location
    Slovenia
    Posts
    3

    Default Re: Disk imaging software that supports encrypted LVM partitions?

    You dint need to mount LV partition do be able to create image of it. It only needs to be available to system (needs to be visible in lvdisplay command)

    Here are some example instruction I am using for disk imaging than might help you:

    1. Createing LVM snapshot backup of a partition
    a. First create temporary LVM snapshot of a filesystem (you need to have some free space in volume group to be able to create snapshot). Snapshot will use assigned space to write changes made on original fileseystem while snapshot being used - existed. If snapshot space gets full it will be automaticaly dropped (see LVM dosumentation for more details). In this example we use 100M snapshot space for writing diferences on original filesystem during backup).
    lvcreate -L100M -s -n backup-home /dev/VGLINUX/LVHOME
    b. Next check what is the logical volume map of LVM source filesystem
    lvdisplay
    c. Next create compressed copy of a LVM filesystem to a file
    dd if=/dev/VGLINUX/backup-home | gzip -c -9 | dd of=/some_path/home_bak_snapshot.img
    d. Last remove filesystem snapshot
    lvremove /dev/VGLINUX/backup-home

    Recomendation: store backup file to safe location on safe media.


    2. Restoring a LVM partition image

    a. First check that destination filesystem exists on machine and its size is equal or greater than filesystem size in backup image
    df -h /home
    b. Next check what is the logical volume map of LVM destination filesystem
    lvdisplay
    c. Next unmount the destination filesystem (eg. under mountpoint /home)
    umount /home
    d. Next create filesystem restore
    dd if=/some_path/home_bak_snapshot.img | gzip -d | dd of=/dev/VGLINUX/LVHOME
    e. Next resize - expand restored filesystem to ful size defined in LVM definition
    resize2fs -p /dev/VGLINUX/LVHOME
    f. Last mount restored filesystem
    mount -a


    Recomendation: If you are restoreing root filesystem you must boot machine using RESCUE or LIVE CD (which supports LVM, dd backup, and gzip compression).



    REFERENCES

    LINK 1
    BINARY LVM SYNCHRONISATION TO REMOTE BACKUP SERVER:
    linux - Sync LVM snapshots to backup server - Server Fault

    LINK 2
    Taking a Backup Using Snapshots:
    Taking a Backup Using Snapshots

    LINK 3
    DEBIAN
    Back Up (And Restore) LVM Partitions With LVM Snapshots:
    Back Up (And Restore) LVM Partitions With LVM Snapshots | HowtoForge - Linux Howtos and Tutorials

  4. #4
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,505
    Blog Entries
    3

    Default Re: Disk imaging software that supports encrypted LVM partitions?

    The way that I backup my encrypted LVM, is:

    Boot from a live CD.
    Manually "decrypt" with the "cryptsetup" command.
    Manually mount the LVM volumes (except the swap volume). I mount those read only.
    Use "tar zcf" to make a tar backup to an external USB drive.

    For the actual commands that I use, see this blog post and scan down to the heading "Encrypting everything".
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •