0

I have installed Ubuntu OS and installed all the softwares and tools from my college Internet connection. Now, I am going back to my home where it might not always be easy to reinstall all the softwares and utilities once the system breaks down for some reason.

Is there a way to backup the entire live OS system on a pen drive etc. so that if in case my system crashes, I can just insert the pen drive and restore the system (means to be able to install the OS as well as the softwares that I currently have during the time of backup) without having to connect to the Internet and use software updater? The reason is that when Ubuntu is installed for the first time, updates of about 500 MB are installed and it is then that it becomes usable. Now i want to ignore this initial 500MB update in case I have to reinstall Ubuntu OS on my machine.

I also want the softwares that I am having at the time of backup to be there for me once I have reinstalled my OS without having to download them again.

1

You can use squashfs to make a squashed version of your filesystem.

First check if squashfs-tools is installed or not. I don't know the exact name of the package. So look up google to install it on your Ubuntu.

After you install it, run-

  1. sudo mount /dev/xxx /mnt (Replace xxx with the proper partition name. This must be the partition where your OS is installed
  2. cd ~
  3. sudo mksquashfs /mnt root.sfs -comp xz
  4. You should now have a file called root.sfs in your home folder. Back it up.

To reinstall this,

  1. Insert a live CD in your target PC, mount the USB or whatever is used to copy the squashed file.
  2. cd to the directory containing root.sfs
  3. sudo unsquashfs root.sfs
  4. You'll now have a directory called squashfs-root. Copy its contents to the desired partition where you want to install the system.
  5. As the last step, chroot into the newly installed system, run update-initramfs and install GRUB and update-grub
  6. reboot.
| improve this answer | |
0

The easiest way to do this is with two USB drives. or a CD-ROM and a USB drive.

One can be quite small to hold a bootable Clonezilla system (needs only a few hundred MB). The smallest USB thumb drive you can buy will be more than enough. Or burn it to a CD-ROM (but CDs are more fragile and booting & running from CD is slower than USB).

The second needs to be large enough to store compressed copies of your partition table and each filesystem partition on the disk. This could be a large thumb drive (e.g. 64GB or 128GB), or maybe an external HDD or SSD.

The basic procedure is to boot the Clonezilla USB/CD-ROM, plug in your second drive, and follow the menus to tell clonezilla to backup your system to the second drive.

To restore, boot the Clonezilla USB/CD-ROM, plugin in your second drive and follow the menus to tell clonezilla to restore the backup to your internal hard disk. This will restore an exact clone of your system as it was when you performed the backup.

Run the backup regularly to keep it up-to-date, e.g. whenever you install or upgrade packages, or make significant changes to the configuration files. If the OS and packages don't change, then just do regular backups of your data files (e.g. your home directory, /etc, and /usr/local) using tar or rsync (or something - even cp) to a third USB drive.

| improve this answer | |

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.