Wednesday, December 11, 2019

Pre upgrade backup for Ubuntu/Linux?


Well. I'd like to upgrade my parent's box from 8.10 (intrepid) to 10.04 LTS (lucid).


Doing this from the package manager should work, but I want to get a backup of the system if things go haywire or something stops working on this laptop. (After all, I did have serious gfx-driver problems after my last upgrade.)


The ubuntu thread on this is rather vague and googling gets me lost in the details, which I currently do net much care for.


This box has 2 other partitions (apart from swap), one with Windows (came pre-installed, I'll not remove it) and one a FAT32 partition to swap data btw. Ubuntu and Windows (IO prefer to mount the NTFS boot part. r/o)


My specific question(s) now are:



  • Will backing up 8.10 with tar and restoring this tar file on the upgraded 10.04 work in principle?

  • Will I have to do anything about grub when restoring?

  • Which toplevel directories do I need to exclude from tar? (ls / below)


    bin dev initrd.img lost+found opt sbin tmp vmlinuz
    boot etc initrd.img.old media proc srv usr vmlinuz.old
    cdrom home lib mnt root sys var


  • What about the symlinks? (initrd.img, vmlinuz)


  • When restoring with tar, will it delete any files 10.04 has added to the harddisk?


Note that I'd also be fine using dd to make a full disc image -- but I assume I would then need to boot from the live CD to restore?


Answer



The safest solution would be to use dd from live cd. You will need to backup MBR and Ubuntu partition.


To backup MBR (first 512 bytes of the disk where GRUB is installed) run:


dd if=/dev/sda of=/backup_dir/mbr_backup bs=512 count=1

To backup your Ubuntu partition (assuming it is /dev/sda3):


dd if=/dev/sda3 of=/backup_dir/ubuntu_backup

Don't write the backup to FAT32 partition because it would truncate the backup to around 4GB. External drive with ext3 or ntfs partition would be preferred.


To restore grub run:


dd if=/backup_dir/mbr_backup of=/dev/sda

To restore ubuntu:


dd if=/backup_dir/mubuntu_backup of=/dev/sda3

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...