If I want to make a backup of everything I have done since the fresh install of Ubuntu, what are the possible options? What all should I backup? I want to get all the settings that I changed, all the packages I installed, etc.
ProgramsA quick way of backing up a list of programs is to run this:
It will back them up in a format that dpkg can read* for after your reinstall, like this:
* You may have to update dpkg's list of available packages or it will just ignore your selections (see this debian bug for more info). You should do this before
Settings and Personal DataBefore you reinstall, you should probably back up the settings from some of your programs, this can easily be done by grabbing folders from /etc and all the content from your user directory (not just the stuff you can see in nautilus!):
After you reinstall, you can restore it with:
So all together as a pseudo-bash script.This assumes there is only one user on the machine (remove
|
|||||||||||||||||||||
|
|
Who is this for: users that have normal regular use of their computer, that have done minimal or no configuration outside their home folder, did not mess up startup scripts and services. A user that wants to have his software restored to how it was when he installed it with all customizations being done and kept in their home folder. Who this will not fit for: servers geeks, power users with software installed by source (restoring the package list might break your system), users that have changed the startup script of some application to fit better their needs. Caution: there is a big chance any modifications outside home will be over written. Backup your current packages and user settingsOnce you are ready with your system and happy with the software installed you can get a list of the installed packages using the command Create a
Save the currently installed packages list
Make a backup of your apt sources file
and a copy of your apt's list of trusted keys
Make a backup of your home folder with the integrated backup tool in Ubuntu, Deja-dup.
When this is done you will have a backup of your packages and configuration files relative to your user. If when necessary you will be able to restore your files from the Restoring your backupStart by restoring the sources file from the backup made
The backed-up keys
Update your sources lists
Restore the packages from the saved
Remove your current configuration from your home creating a backup of the folder in their current state (after all, whats the use of restoring fresh files if there are other there that can affect the configuration?)
After this is done restore the backup created with Deja-dup.
After this is done you will have your packages back to the saved selection, our configuration restored and hopefully a working desktop, all of that without installing a single extra application and using the Ubuntu default tools. The only thing left is to do some clean up and check that everything is working.
Something went wrong, my desktop is goneThere are a few posts in Ask Ubuntu that can guide you in case something when wrong and you need to hard reset your desktop. If something when wrong and you find your self needing to do so, please have a look at these posts: |
||||
|
|
|
Backups take some planning and there are several viable strategies. You will have to decide which method works best for you. Be careful about "best way" , what works best for one person may not be best for another. At the end of the day, the "best method" is one that has been tested and known to work. You need to test your backup strategy BEFORE you need it Using imagesOne way is to simply copy and compress an image of your partitions. You can do this with several tools, anything from dd to partimage to clonezilla The advantage of this strategy is that it is (relatively) easy and very complete. The disadvantage is that the back up images are large. Smaller backupsYou can make smaller backups by only backing up data and settings. There are several tools to do this, everything from dd to tar to rsync. The key here is to know what you need to back up. Advantage - Backups will be smaller. A list of what to back will always need to be reviewed to make sure the list is complete. 1) List of installed packages Package list # Create a text list of an existing installation of all apt-get installed packages # in order to re-install on a newly installed distro
You would then perform a fresh install, and restore your packages. The following commands also update all the packages on your system (so restore and full update all at once).
2) Data. Generally this would be /home . Most user data and customization's are going to be in your users home directory. If you save data in other locations, include that (for example /media/data). 3) system settings . Here is where there is going to be some variation. Personally if I edit ANY system setting, I keep a copy of the original configuration file and my custom file in /root. So if I edit You will also need On a server you may need to include I understand this takes some effort, so, it may be easier to include all of 4) A copy of your disk partition table.
You can use this information to restore your partition table if you replace your hard drive. 5) A copy of your MBR
You would then restore with
6) Other files/directories - Depending on your system and customization you may need to include additional directories. Considerations might include 7) Put all that into an archive
8) rsync As an alternate to tar, you can use rsync. See - https://help.ubuntu.com/community/rsync Network backupsAnother option is to use NFS or Samba to back up data. CronYou can automate backups by writing a backup script and running it (daily / hourly) with cron. Restore1) Using a live CD, restore your partitions using gparted or fdisk from the information in fdisk.bak
Then reboot See also - https://help.ubuntu.com/community/BackupYourSystem/TAR Other StrategiesThere are many additional strategies for backup, some for backing up your home directory only, some graphical. see: https://help.ubuntu.com/community/BackupYourSystem TestingIt is not a backup unless it is tested. This is most important when you are NOT using an image of your root partition. Test restoring your system in a VM, a spare computer, or a spare partition or hard drive. |
|||||
|
Installed Packages Selection using
|
|
APT-Clone is much better than the
dpkg --get-selections solution because: 1. it preserves all repositories information 2. it keeps track of what packages were automatically installed 3. it allows to repack locally installed DEB files. This should be the accepted answer!
– Andrea Lazzarotto
Nov 7 '14 at 16:22
|
||
|
This is great! I'm hoping these work with 16.04, it's exactly what I'm looking for. But I'm wondering, will Apt-Clone also remove packages that aren't in the restored configuration?
– Dorian
Jun 5 '16 at 4:34
|
||
|
|
@XToro, No it it will not remove. (btw, if it was removing packages by default it will damages the upgrade, because most of upgrades have new packages installed and some dropped)
– user.dz
Jun 6 '16 at 7:34
|
||
|
@Sneetsher That's a shame. I would actually like if it removed all packages not on the list and then install the ones listed along with its dependencies. My issue with why I want to use it is to remove unwanted packages after playing around with things like installing new DE's. There's always tons of leftovers after removing the DE.
– Dorian
Jun 6 '16 at 14:29
|
||
|
|
@XToro, I like that, I needed that before but I went around by testing in virtual boxes. You need a modified script from Huckle's answer. It is better to ask new question and mention the issue with this one. If you are unable or don't want for some reasons, I will do it?
– user.dz
Jun 6 '16 at 19:52
|
|
Although this question has been answered for a while, I noticed that nobody mentioned etckeeper. Run For instance, (assuming you configured git as your VCS) back up your
|
|||
|
|
|
To create a backup list of all your installed programs: http://savvyadmin.com/backup-and-restore-package-lists-in-ubuntu/ As for your program settings, most of those are in hidden (start with a |
|||||
|
For those wanting a nice. neat GUI......introducing Aptik. All you need is a backup directory, stored locally or in the cloud. You can install it through the ppa:
Hope this helps out :) |
|||||||||
|
That defeats the purpose of a "format-and-install". If you want to do that, just do an upgrade from your existing Ubuntu installation. Since "installation" in Ubuntu is as simply as going into the Software Center (or Synaptic or As long as your data and program settings are backed up, you should be fine. If you still want a comprehensive list of everything in your system so you know if a package is missing, just go into the terminal and type |
|||
|
|
|
I'll assume it's a new HDD, SSD or new system or you had on an old Ubuntu. Now you want to upgrade to Ubuntu 12.04 (Precise Pangolin)? I'll assume you detest installing them all again or reconfiguring? No need to. Open the terminal by pressing Ctrl + Alt + T, and run the following command:
Then cp the text file to your home directory by:
Next run the backup application from the systems settings in the side bar. Backup Then reverse the backup using restore, pick in the backup program you used, and now \home is back. Lastly, reverse the
Note: Restoring home, gets all settings for your applications. I installed a SSD, and copied all the files, but I still did a backup just in case. PS: This avoids, actually backing up, massive apps' machine code, etc. Make sure your download folder is clean. Not full of machine code or videos, and then burn the |
||||
|
|
|
If storage space isn't a concern, using dd or dc3dd will backup absolutely everything on the target disk or partition you designate. You don't want to try this on a mounted drive, so you'd do this from a bootable USB or DVD (or your install media choosing "Try Ubuntu"):
Where is the disk or partition that you wish to backup and target is the backup filename (often the same) ( Substitute dc3dd for dd if you want a progress report. To access specific files in the backup you can typically mount the resulting .img file as a loop device by:
Or You can restore the entire disk or partition by swapping the if= and of= parameters as in:
Where is the image file that you wish to restore and <target> is the drive or partition you wish to restore it to. PROS: Easy to backup and easy to restore everything. Unlike some other solutions doesn't really rquire much in the way of planning since you are backing up everything you don't have to worry about whether you will need it or not. CONS: Time consuming (computer time, not yours) and not suitable for daily backup (no incremental options) Source: experience; I use this approach to backup client systems prior to beginning work and have never lost a bit of client data. |
||||
|
|
|
I found another solution: Check out APTonCD. It will back up all your applications and put them in an ISO image. |
||||
|
|
|
I find the most simple process is to use two programs: Back-in-time to back up /home and /etc Aptik to back up programs |
|||
|
|
Edit:This answer doesn't work anymore according to user @Izzy I had the same question above !! then I found this website: I will copy what the website says for backing up the programs: "Along with backing up my /home partition, I also use Synaptic Package Manager to periodically make a backup list of all my installed packages (applications and their dependencies). To do this you need to be using an Ubuntu-based distro or one that uses Synaptic. I’m not familiar with doing this in other distros that use a different package manager. But in Bodhi Linux, Linux Mint, or any other Ubuntu/Debian derivative, just open Synaptic; go to File> Save Markings. Make sure to check the little box that says ‘Save full state, not only changes’ and then save that file to wherever you want (preferably wherever you saved your /home backup). Then when you need to reinstall an operating system, after applying all updates, you can open Synaptic, go to File> Read Markings and choose your saved Packages file. As long as you’re connected to the internet it will automatically download and install all the applications and other packages that you had originally installed. This certainly saves a lot of time and trouble so you don’t have to search for and reinstall all your application" cheers |
|||||||||||||
|
|
To backup all your installed packages, with a GUI, you can use the Ubuntu Software Center. Go in Menu (then log-in) and Sync all your packages. When you will need to reinstall, select all packages from a machine and click 'install' from the same menu. From the command line (CLI) you can also use OneConf (oneconf). I didn't check for a year; maybe this now has more options like some settings instead of only packages listing backup. |
|||||
|
protected by Community♦ Jun 2 '14 at 14:18
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?







sudo dpkg -l > installed_software.txt! – iammilind Aug 9 '13 at 6:52dpkg --get-selectionssolutions cover this. – belacqua May 21 '14 at 19:10