0

This question is asked many times but I haven't got the right answer.

What I want is to create a partition where I backup my current Ubuntu partition that appears in the GRUB menu. If one day my Ubuntu won't to start I lunch the backup partition and voila my system is restored.

Currently I use CloneZilla but the problem is I must have always on me a usb key that contains CloneZilla.

EDIT:

df -h
/dev/sda5           55G     39G   14G  74% /
none               4,0K       0  4,0K   0% /sys/fs/cgroup
udev               997M    4,0K  997M   1% /dev
tmpfs              202M    1,2M  200M   1% /run
none               5,0M       0  5,0M   0% /run/lock
none              1006M    8,0K 1006M   1% /run/shm
none               100M     36K  100M   1% /run/user
parted -l
nothing
4
  • Please print here df -h and parted -l.
    – c0rp
    Jan 22, 2014 at 13:04
  • here pastebin.com/ZwcqgD2y
    – Hunsu
    Jan 22, 2014 at 13:09
  • I think that you don't know the right word: 'snapshot'. If you search with that you will find answers. Take a look here: askubuntu.com/q/295426/62483
    – Lucio
    Jan 22, 2014 at 13:26
  • If no one write you answer in a few hours I will do it. Sorry can't do it write now
    – c0rp
    Jan 22, 2014 at 13:51

3 Answers 3

1

Just for note. There is many good methods that provide backing up your system, some of them also provide incremental backups.

Answering exactly what you want step by step

As I can see from your df -h output, you do not distribute your /boot, /usr, /var and other folder to a different partitions. So

1. First of all you should create your Live CD or bootable USB stick with Ubuntu. Here is guide for Live CD and for USB stick.

2. Now boot Ubuntu from CD or USB, you should see a menu with "Try Ubuntu without any change to your computer" at the top. In loaded Ubuntu open gnome-terminal (Ctrl + Alt + T), and run sudo gparted. Create new 55Gb ext4 partition using this tutorial. Remember this new partition name, it should something like /dev/sda6.

3. Now you should mount your new successfully created partition (Lets say /dev/sda6) and your previous partition /dev/sda5. And copy all your files and folders hierarchy. Open gnome-terminal and do this line by line:

sudo mkdir /media/old_partition
sudo mkdir /media/new_partition
sudo mount /dev/sda5 /media/old_partition
sudo mount /dev/sda6 /media/new_partition
sudo cp -ax /media/old_partition /media/new_partition

This last command can work very long. Do not interrupt it. It should output nothing at the end if everything is ok.

Little quote from this guide.

cp -ax / /new-disk

This is the simplest method, but will only work if your original Linux system is on a single disk partition. The -a option preserves the original system as much as possible. The -x option limits cp to a single file system; this is necessary to avoid copying the /new-disk and /proc directories.

4. Now you need to update fstab in your new backup partition.

Find UUID of /dev/sda6 (new partition):

sudo blkid /dev/sda6

Find UUID of /dev/sda5 (old partition):

sudo blkid /dev/sda6

Then edit /media/new_partition/etc/fstab:

sudo gedit /media/new_partition/etc/fstab

And substitute UUID of /dev/sda5 to UUID of /dev/sda6. Be carefully, substitute only UUID.

5. Now adding new entry to grub menu. Open /media/old_partition/etc/grub.d/40_custom using gedit and add this at the end of the file:

menuentry "Boot backup Ubuntu" {
    set root=UUID=XXXX-YYYY
        linux /vmlinuz root=UUID=XXXX-YYYY ro quiet splash
            initrd /initrd.img
    }

Where XXXX-YYYY is UUID of new partition (/dev/sda6).

6. Unmount everything and reboot. Before do this close everything what you have opened (gparted, gnome-terminal, gedit, others).

sudo umount /dev/sda5
sudo umount /dev/sda6
sudo reboot

Remove your LIVE bootable device.

Now you should see new entry in your grub boot menu.

Notice that this method do not backing up other than / mount points, such as /home, /var, /usr others, if they distributed between partitions. In such situation you should do steps 2-4 for each partition.

0

I cannot explain here step by step, but you should be able to finish with this explanation!

Firstly, create a partition, that is big enough.
Then, copy your ubuntu installation to this partition, remaining the file attributes.
Create the entry in grub, by copying and adjusting the partition id.
I guess now you only have to edit fstab on the new partition.

So easy ;)

0

You even don't need a separate partition, you can move your whole system to a subfolder then add a a grub menuentry to boot into it. I just posted how to do it in different thread, check out my answer named kenn here Installing Multiple Linux Distros in a single partition

Not the answer you're looking for? Browse other questions tagged .