6

I've set up a new Linux workstation and would like to create a backup image in order to save time in case something breaks. This is the situation:

  • Workstation: 512 GB SSD, 12 GB used, ext4 file system, may contain bad blocks
  • Backup drive: 64 GB USB flash drive

The backup image should be bootable for added flexibility and, importantly, all programs, configurations, network settings (proxies, VPNs) etc. have to be preserved.

As I understand, a sparse, file-based image is necessary, since the backup drive (and possibly also the replacement drive) is smaller than the source drive.

What backup/cloning tool understands file systems and creates sparse, bootable images?

AFAIK, dd just copies bit by bit and ddrescue can only sparsify blocks of zeros into metadata, but not unused space filled with random data. Some disk cleanup tools offer to fill unused space with zeros, but this usually takes many hours and I'm not sure if this is good practice for collapsing data (especially on an SSD).

I need a reliable, free, and easy solution as I don't have much expertise on file systems, partition structures, boot sectors etc.

5
  • My experience with Live, persistent Linux on flash USB is that it is incredibly slow. Flash media writes at much lower speed than the slowest HDD. This might be feasible using a SSD, though. Start by making a drive as persistent installation media, e.g. debugpoint.com/2019/10/… , then copy over all or install files and software. Commented Jul 8, 2020 at 23:57
  • Live linux USB drives, are very slow. The boot on a live ubuntu USB takes like three minutes, booting it for just fixing a text file on the server can feel you like an eternity. Linux distributions are numerous and intended for many different purposes. There are dedicated linux distributions for recovery which are intended to run inside a USB drive, not to be installed. Booting them are also fast, becuase they run a relatively lightweight core. You can use knoppix, gnoppix or distributions like this for backup and recovery purposes. New USB drives are much slower than even an old PATA HDD.
    – Wasif
    Commented Jul 9, 2020 at 1:22
  • @harrymc: Yes - you don't understand. ;) Again, I strongly suggest to continue this in the chat as we're filling up the section (I'd like to ask a moderator to move this discussion)
    – david
    Commented Jul 13, 2020 at 13:38
  • No problem - I deleted all my comments except the last one, and you may delete all your answers to me. I would just like to understand why this method doesn't work for you.
    – harrymc
    Commented Jul 13, 2020 at 13:49
  • @harrymc: Because I need to create an image and not recreate the entire system manually piece by piece. Can you empathize with the problem now?
    – david
    Commented Jul 13, 2020 at 14:02

1 Answer 1

1

The Linux Live Kit is a probable solution for you.

It is described as:

a set of shell scripts which allows you to create your own Live Linux from an already installed Linux distribution. The Live system you create will be bootable from CD-ROM or USB Flash Drive.

It requires that that the aufs and squashfs kernel modules are supported by your kernel. In some distributions both are included automatically. You may need to install the aufs-dkms package on some Linux distributions.

You would also do best to slim down your Linux installation by as much as possible when the target disk is much smaller than the source.

Sparse files shouldn't be a problem, as they should keep their physical sparse size when copied.

More information is to be found on the Linux Live Kit website.

4
  • There is more info on its GitHub site. The project is still under development and issues are handled.
    – harrymc
    Commented Jul 13, 2020 at 19:37
  • This looks interesting, how does this work? Is this basically a fresh Linux ISO with custom packages or will it also preserve the files, configurations, network settings etc. of the original system (like a snapshot)? Differently put, does it rebuild the system from scratch while adding/omitting packages or does it include everything from the source system and pack it into a bootable ISO? From the description, it sounds like a file-based procedure (which would solve the problem of sparsification)
    – david
    Commented Jul 13, 2020 at 19:39
  • This project is said to be the tool for generating Linux Live USB. Knowing how it works requires hands-on experience, which I don't have, but it seems a good candidate for your problem.
    – harrymc
    Commented Jul 13, 2020 at 19:43
  • Not sure what aufs does, but I read some discussions/tutorials and as far as I understood squashfs is a read-only file system, used to create the read-only live distro ISO (much like a Windows installation CD-ROM). Is it possible to retrieve from such read-only file system the full, functioning workstation system? I.e., once I have the ISO on a USB flash drive, how to get it back onto the replacement hard drive?
    – david
    Commented Jul 18, 2020 at 22:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .