I would like to learn on how I can make a copy of system to be moved to another machine. My laptop started to fail at few things, most likely hardware issue, and I must send it to manufacturer's technical service. Before I do so, I'd like to make a copy of what I have in case they format/replace my disk or just send me a new piece of equipment. I will hold the backup on two external drives (just to make sure).

What I would like to "save":

  • my home directory obviously (without .cache dir and one other)
  • all installed packages and applications (compilers, parsers, utility apps, libraries, etc.)
  • configuration for several things like local web server, PHP-FPM
  • drivers, drivers, drivers, because last time I tried to make a fresh install, I had to use Ethernet cable because there was no drivers for my wireless card

I have few applications that were installed using .deb package, but these I can lose (NetBeans and QtFramework with QtCreator), the rest of them I'd like to keep.

I think it would be much easier to include whole /etc directory to deal with configurations, rather than selecting them one by one. Are there any other directories that may contain stuff like configs, settings?

Is there any reliable tool I could use for that? It may be command-line tool, I don't mind, as long as it allows me to specify what I want to include, exclude and that would generate a single file, most probably compressed - so simply copying won't work.

If it helps you, my home director y is about 42GB, but I only need about 25-30% of that to be backed up.


Just thought I would also mention it in the question itself. It is fair to assume I will not move to another hardware configuration. This is only for the case where configuration is exactly the same. I'm not sure if that changes anything.


Alright, I figured out the way to backup my applications list using this "tutorial": https://gist.github.com/brpaz/6d5bbcb5231cae2132ff

Now I'm only looking for some nice GUI application that would let me to backup my home directory excluding few subdirectories. I would much more prefer if it created a compressed file instead of just copying files, but if there's nothing out there, I will take anything really :) Deja dup does not work for me (it does not exclude directories I want to exclude, no matter what I do). I want to emphasize the need to exclude certain directories (either by selecting them or using a pattern), because 70% of my home directory can be recreated other way (e.g. local git repositories).

  • 1
    I usually backed up the whole etc to have config backup. You may need sometimes to backup also some directories from var (/var/www/html/, var/named/chroot/etc/, ...). I would backup home directory with tar. You can use exclude options to name the directories , which you want to exclude from backup.
    – nobody
    Jun 28 '17 at 13:05

get clonezilla and make a drive backup image, or even clone the drive itself


  • This would be one option, but what about excluding directories? Also I use separate partitions for home, var and root. I think I should have been more specific. I don't really want to store apps and libs and drivers on in my backup, I'd rather use some app/script that could generate the list of installed stuff and once I decide to restore my backups, I'd like to be able to use that list to automatically install everything. Of course in addition to copying the files I need (part of home dir)
    – pzaj
    Jun 28 '17 at 8:49
  • clonezilla can do partition backup/clone also. copy apt's package list (I forget the directory). but another thread said if you put the list in a new install then apt will install everything that you had.
    – ravery
    Jun 28 '17 at 8:54
  • I think if you could tell me where I can find all files associated with apt (that would let me install them on fresh system) it would be a good start. I did check out clonezilla, but I think this is not something I neccessarily need. I would still need to clone two partitions (/etc dir is on one, /home is on another) and I only need about 30% of my /home directory (I have a lot of builds I don't need, huge local git repos I don't need).
    – pzaj
    Jun 28 '17 at 9:18

You can use cat for creating full disk image.

Run from usb flash, do not mount your current hard drive, turn on you external drive and run from root something about it:

cat /dev/sda > /media/extHDD/path/to/image.img

where /dev/sda is your current hard drive.

To apply a backup, simply run afterwards:

cat /media/extHDD/path/to/image.img > /dev/sda
  • Thank you, but this answer does ignore the fact I only want some of the data (part of home directory + all directories that may contain any configs outside my home directory). My /var directory is twice as big as my home dir for example, but I don't need most of these things. Also instead of copying all apps and things installed with apt / dpkg, I think there should be a way to "list" all that, store in file and "restore" once I need it?
    – pzaj
    Jun 28 '17 at 8:57
  • You can use some more specific clone/backup tools for this, however I don't believe that they could do exactly what you want. You'll definitely need to write a complex script for that, but it could take a lot of time and it probably can't be used again. I think it would be quicker and simpler just backup only you home dir and reinstall ubuntu or backup the whole disk drive.
    – igronus
    Jun 28 '17 at 10:01
  • I see, well, for now I managed to create squashfs files for /etc, /opt /var and /usr/local. Now I'm checking out deja dup to see if it works. The reason I would like to avoid making a copy of my /home dir is that 70% of that data includes git repositories, Qt and large binary files (a lot of C++ builds) that I do not really need in my backup. I tried excluding few dirs in deja dup, unfortunately as far as I can tell, they're scanned anyway. Let's see how it works out though.
    – pzaj
    Jun 28 '17 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.