2

I want to re-install my Ubuntu install for various reasons. Before doing this, I would like to back up my Ubuntu partition, in case something goes wrong (highly unlikely). I have backed up entire disks before, but not single partitions. My partition layout:

sda 8:0 0 232,9G 0 disk
├─sda1 8:1 0 35G 0 part     (Windows 8.1)
├─sda2 8:2 0 194G 0 part /  (Ubuntu 14.04)
└─sda3 8:3 0 4G 0 part      (SWAP)

Can I just boot up a portable Linux drive using a USB Key, and use "dd" to copy "sda2" to my external hard drive?

And since it is the second partition, do I have to do anything with the MBR, if I wish to restore the backup partition?

  • Welcome to Ask Ubuntu! Great question by the way. I'm guessing you want to keep all the data and settings and programs, not just data? Even so, you could consider Crash Plan - it will back up all files (you can select entire file system) and works great for me. It even keeps permissions if you backup to ext4. – Tim Jun 28 '15 at 13:51
  • Have you read the help topic of the official guide of Ubuntu. It may be useful and sufficient for their work. Take a look: help.ubuntu.com/lts/ubuntu-help/backup-why.html – André Marinho Jun 28 '15 at 17:00
1

You can back up your personal files to an external disk with normal file-copying commands (cp in a Terminal or drag-and-drop with whatever file manager you like). That's normally adequate, unless you do heavy customization of system-wide settings (in /etc). In a worst-case scenario, you'd re-install Ubuntu and then copy your personal files back.

Clonezilla is a popular backup tool if you want to back up an entire partition or an entire set of partitions. You'll then be able to restore the whole partition much like you could with a dd backup, but a Clonezilla backup will chew up less disk space and will proceed more quickly, since it won't back up unused sectors from the disk, which a dd backup will.

As to the MBR, I wouldn't bother. GRUB relies on code in the MBR, but also code elsewhere, so if something goes badly wrong, you might need to use Boot Repair or restore the boot loader manually even if you have an MBR backup. This is likely to be safer, too, since all sorts of things can go wrong if you start mucking with the MBR using dd and don't know what you're doing. Furthermore, as Three Diag says, you may have an EFI-based installation, in which case you'd want to back up the EFI System Partition (ESP). Aside from the MBR's role holding a protective "partition" in the GPT system, the MBR is unimportant in EFI-mode booting. (That said, I suspect you've got a BIOS-mode installation, given the lack of an ESP in the data you've shown -- but I could be wrong about this.)

1

I am not really sure what you mean by "just bootup a portable linux drive".

If what you want is: hard-copy your sda2 into a usb and then eventually boot from it, it is probably possible.

What you can surely do is:

  • dd your sda2 to a key (be careful with the dd command and see here)
  • If you want to restore: dd it back to an appropriate sized partition
  • Boot up from a live usb key and run the boot-repair utility (this tells your GRUB to give you an option to load the system you cloned back)

I believe this should work even if you omit step 1 (e.g. you can instruct your grub to boot the system that is in the usb-key) but I never tried myself.

Also, maybe lookup something like "Install ubuntu from a USB key" (also see a possibly related thread).

A final word of warning: notice that you have a dual boot with win 8.1, therefore you might have a UEFI installation of UBUNTU, and have a ESP partition that holds all of your boot files (also for windows). To check if this is the case look if there is /sys/firmware/efi directory as suggested by other users. Keep this in mind when working with partitions and with boot-repair.

  • 1
    Windows 8 can boot in BIOS mode, and often does if it was self-installed (or even re-installed). The partition list doesn't include an ESP, which is required for EFI-mode booting, so I suspect this is a BIOS-mode installation, but I can't be 100% positive of that. If it's in EFI mode, there will be a /sys/firmware/efi directory in Linux, so look for that to be positive. – Rod Smith Jun 28 '15 at 16:41
  • Added this to the answer. @RodSmith Doesn't sda 8:0 suggests that other partition which are not shown might be present? For OP: you might want to post the result of lsblk next time or a screenshot of gparted to get more relevant help. – Three Diag Jun 28 '15 at 17:09
  • I don't see anything in the output that suggests other partitions are necessarily present; however, if the output was edited (or a line or two accidentally omitted from the output), they might be. As you suggest, a screenshot of GParted or the output of parted would be more helpful in evaluating partition layout. – Rod Smith Jun 28 '15 at 17:36

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.