Score:0

How to backup /home partition from one laptop and restore to another

in flag

On my current laptop, I have installed the /home in a separate partition, in the case I need to reinstall the OS, without having to backup and restore files and configurations.

My laptop is having hardware issues and my company bought me another, how can I backup the /home partition on the old laptop and restore to the new one?

ar flag
Have you tried the default backup app in Ubuntu?
ChanganAuto avatar
us flag
Having a separated /home is indeed useful in some scenarios like the one you describe but you should have backups anyway, especially for work.
cc flag
Ensure your user ID and group ID on the second machine match the first, or change them to match after the restore.
cn flag
I don't think you need to consider ```/home``` as a partition rather consider it as a folder. Copy everything into a backup medium and transfer it to new machine's home. I guess it's simple unless I see a complex use case. It looks a very straight forward task to me. Ask further questions if you may have.
Score:2
cn flag
raj

Use the following command to backup your home directory:

cd ~
tar -cvf /media/user/drive/home_backup.tar .

The first command ensures you are in your home directory. The second command backs up everything in this directory to an archive file called home_backup.tar on external drive mounted under /media/user/drive (you must adjust that part to reflect the actual path where your external drive is mounted).

On the new machine, conversely, use the following to restore your home directory:

cd ~
tar -xvf /media/user/drive/home_backup.tar

Try to avoid writing anyhting in the home directory while backup/restore is in progress, otherwise contents of the files that are written may become corrupted, either in the backup copy or in the restored file. (Be aware that some applications, like web browsers, are heavily writing to home directory, so it's best to avoid using any applications during backup/restore).

It is recommended to logout from GUI and login again after restore is completed (you are also restoring GNOME configuration files this way, some of them might get overwritten).

As @ubfan1 noted in the comment, ensure that your user ID and group ID on the new machine is the same as on the old one before attempting restore.

Score:2
cn flag

It is a matter of copying all files in the home directory, including the hidden files, while preserving linux file permissions (at least for the configuration files). Once the copy is made, check the ownership. If the user/group on the new system has a different UID than on the old system, you will need to adjust user and group ownerships.

I would be using rsync for that, but also cp is possible with the appropriate options set to preserve file properties. edit User Raj posted yet a third possibility using tar. An advantage is that this third method does not require that the target drive supports linux file permissions.

If this sounds difficult and exceeds your technical skills, then consider just copying your personal user data. That data is personal and not replacable. Hence it is the most valuable. You can then just reconfigure your new system where needed as you use it.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.