0

Could you please help me on how to take ubuntu 16.04 whole backup into external hard disk? As I want to install another operating system in my laptop and if the other operating system not required,then I want to Restore ubuntu 16.04.

Please provide step by step procedure as I am new to ubuntu.

3

I will do my best to answer.

Step 1: Make sure your external disk is at least as big as your internal one. You need to be able to fit everything onto your backup disk.

Step 2: Figure out which disks to use. For this, you should run the command:

sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

Which should output something like:

NAME   FSTYPE   SIZE MOUNTPOINT LABEL
sda           111.8G            
├─sda1 swap     121M [SWAP]     
└─sda2 ext4   111.7G /          
sdb             2.7T            
└─sdb1 ext4     2.7T            

You want whichever one has a partition mounted as /. Also figure out which one is your external disk using this output. BE VERY CAREFUL, YOU DO NOT WANT TO GET THIS WRONG. If your main disk (The one with Ubuntu installed on it) is /dev/sda and your external disk is /dev/sdb, then you should do the next step exactly.

Step 3: Run dd to copy everything over. Depending on the size of your disk, this may take a VERY long time, so be patient. This is the command:

sudo dd if=/dev/sda of=/dev/sdb status=progress

If your disks were different than the ones in the example, then just replace /dev/sda with your main disk and replace /dev/sdb with your external disk. and use status=progress for display the progress.

I hope I was able to help you!

1

This is what I use for a full backup:

#!/bin/bash

# NAME: full-backup
# PATH: $HOME/bin
# DESC: Full system backup - must call with SUDO

# DATE: July 16, 2017. Modified July 26, 2017.

apt autoclean   # reduces size of /var/cache/apt/archives

cd /tmp     # tar must be created in directory not backed up.

time tar -cvpzf backup.tar.gz \
--exclude=/backup.tar.gz \
--exclude=/proc \
--exclude=/tmp \
--exclude=/mnt \
--exclude=/dev \
--exclude=/sys \
--exclude=/media \
--exclude=/usr/src/linux-headers* \
--exclude=/home/rick/.cache \
--exclude=/var/log \
--exclude=/var/run/ \
--exclude=/run \
--exclude=/var/cache/apt/archives /

I've never used the backup to restore files and hope I will never have to.

Put the script into /usr/local/bin/full-backup and mark it executable using chmod a+x /usr/local/bin/full-backup. The backup will be a compressed file but still requires about 6 GB on my system

When you call full-backup script the backup archive will be created in the /tmp directory. Then you will need to copy it to a USB flash drive.

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.