linux - How can I backup the entire file system on a backup image file?

07
2014-07
  • AndreaNobili

    I am pretty new to Linux.

    I am configuring my RaspBerry that use RaspBian (that is a minimalistic Debian distribution).

    Before changing some settings I want to have a backup of my entire system in the current state.

    What can I do to save the entire system on a backup file (or something like it). I want create an immage of the SD card that contains my actual system (so it have to contains the 2 used partitions and the file system). I want to do this in such a way that if I do some error I can restore my system.

    To write RaspBian on the SD card I used the Linux dd command, can I do the same operation in the opposite direction (copy the actual state of my SD card on a backup file)?

  • Answers
  • Icydog

    Yes, you can. Put your SD card in another machine and don't mount it, then do

    dd if=/dev/sdX of=/path/to/some/file.img
    

    (where sdX is your card device)

    Just flip the parameters around if you want to restore.


  • Related Question

    windows - How can I backup entire installations of a program, instead of just manually backing up individual files?
  • NoCatharsis

    It seems pretty straightforward to backup individual files, such as pictures, saved games, or settings files - just copy them straight over to your 2nd HDD or to an online service like DropBox. However, is there any way to backup entire installations of a program?

    For instance, my Firefox directory has a lot of personal customizations and add-ons. I don't want to go through each item and decide to back it up or let it go. So my next option is to copy out the entire directory for backup.

    But, if I copy the entire directory back onto the HD after a format, it is not an integrated installation and this seems like it could be troublesome. I would assume Windows cannot detect the directory for uninstallation, or would not let you choose Firefox as your default browser, right? I'm no pro, but this sounds like a bad idea.

    So my question is whether there is a good way to preserve all necessary files, while also preserving the full installation process of an application. This is not specific to Firefox - I would like to know how to do this for any application.

    Thank you.


  • Related Answers
  • Insomnic

    In the case of Firefox, you are close in your description. Once you install Firefox, you can transplant your profiles directory and then Firefox will be back the way it was when you backed up that directory (you'll want to transplant the contents of the directory not the directory itself since that name is randomly generated and linked in the registry).

    Microsoft Office also has a "Save My Settings" wizard that creates a file you can use to export/import your customized Office settings.

    You can also use the "File and Settings Transfer Wizard" in Windows to transfer some of the OS and program settings.

    In general though, there isn't a way to backup your program settings. Too many things are in too many locations to allow that kind of restoration at a program level. What you can do is image your drive.

    To do this you setup your computer exactly how you want it and then you run an imaging program (such as Clonezilla for freeware option) to take a snapshot of your system. If you need to restore your system or set it up on another location you can just restore that image. This would keep all of your programs and OS settings in place. As your program needs change, you can also create new image backups.

    This seems like the most viable option for what you seem to need but the options above for specific program setups are an option. You'll want to decide what works best for you.

  • quack quixote

    This is tricky as an installation isn't all in one place.

    First, there's the program files that actually run the program - which you've already identified.

    Second, there will also be data under your User Settings folder too. Most programs will store per-user settings here.

    Third, there's the registry entries that hook up the various activities like uninstalling, file associations and so on. These can be done in a per-user registry hive or a system-wide registry hive.

    To back this up you'd need to search the registry and find all the necessary keys and values and export them to a .reg file. Then to "reinstall" you could run that .reg file (after copying the files and folders back) and you should have a working version of the software.

    HOWEVER: Finding all the registry entries for a given program isn't easy as they are scattered about in different locations, so I wouldn't advise it. Simpler would be backing up either the entire registry or just the per-user registry hive for a given user.

    The simplest solution is to keep good backups of any User folders. A once-in-a-while backup of the program folders might be helpful, but most of that will get reinstalled if you reinstall the program.

  • outsideblasts

    In the specific case of Firefox, the FEBE (Firefox Environment Backup Extension) addon will store all the important stuff, including extensions, themes, bookmarks, about:config adaptions...

    Not the full answer you want, but it might help some people.

  • Dennis Williamson

    Generally, you might want to use a dedicated backup application for the task and not just copy the files.

    This way you have many more benefits (schedules, incremental backups, ...).

    Regarding your specific question, I don't know if there is a generic answer for "any application".

    It might be easiest to backup your Application Settings directories (local and default) and then - in the case of losing your installation - just re-install the applications and then restore the backup.

    This should give you what you want.