4

I'm currently running Ubuntu as a Live USB on a PC which also has Windows installed. However, I've discovered that updating or messing around with the kernel doesn't seem to do great things with the Live version and so after seeing it didn't boot anymore ended-up having to reformat the USB and then start again. Obviously I save all files on a different drive, but I realized that it would be a good idea in future to have a backup of the settings and installed programs and other Ubuntu-specific things to save the hassle in case it happens again.

It occurred to me that instead of using a program to backup only a certain part, considering that the persistence is only 4GB, I could just go into Windows and backup the contents of the entire USB to another drive, say, on a weekly basis, and then if I found it became corrupted or didn't boot for some reason, (assuming it was an issue with the data rather than the MBR) I could go back into Windows and copy the entire contents of the backup to overwrite the data on the USB drive, thereby having what would hopefully be an uncorrupted, but relatively up-to-date fresh version of Ubuntu again, without having to go through the process of reinstalling programs, changing settings, etc.

My question is ... would this very primitive method work? I'm wondering whether there are other aspects of the Live USB system itself which would detect that everything had been replaced. I can't think of anything specifically that might become a problem, but I just want to make sure because obviously otherwise it's not going to be a very useful form of backup! Any assurance or advice would be very appreciated, and please don't laugh at my distinctly string-and-paper approach to technology!

4 Answers4

2

You need not copy the entire contents of the USB drive. Just copy the casper-rw file to the computer as a backup.

casper-rw is the name of the file where the Live USB stores persistent information.

The next time you need to create a USB drive with the same settings and applications, create a live USB using uNetbootin or any other program and copy your backed up copy of casper-rw to it.

  • OP doesn't mention using persistent but definitely appears clear that they are. If it were just settings to backup (no installed programs not already in the iso), doing it from within the live ubuntu (like a regular $HOME backup) would be even smaller than casper-rw, on XFCE it's basically 2 or 3 megs to backup, not a whole gig plus of casper-rw, definitely not 4GB of usb. But zip/gz/xz/7z the casper-rw file and it could get a LOT smaller – Xen2050 Dec 08 '14 at 10:43
  • Sorry to be unclear! Yes, I have persistence and I have some programs that I use. Not that many since I just use Ubuntu for work, but enough. Size isn't an issue for the backup, so 4GB is okay, but my question was really just to check that such a simplistic form of "rolling back" as overwriting files on the USB with older ones that were backed up somewhere else wouldn't break it somehow or stop it from booting. It sounds like in fact all I need to do is keep the casper-rw file itself and that will have all settings, programs, and everything else, so if that's the case that's great. Thanks! – kanrakuuuu Dec 08 '14 at 12:40
0

You can also use the gnome-disks utility, select the drive and on the tree dot menu select Create Disk Image..." Gnome Disks

0

If you create your persistent live drive with mkusb, and use the dus-persistent method, there are shellscripts to use in order to back up the whole partition for persistence or only the home directory. (The home directory is more robust, can be ported to new versions of the same flavour of Ubuntu, and is also less sensitive to corruption than some other parts of the Ubuntu system.)

The shellscripts backup and restore are modified to manage not only the old label casper-rw but also the new label writable for the partition for persistence.

See the following links,

sudodus
  • 46,324
  • 5
  • 88
  • 152
0

You can not just add casper-rw to a Live, (non persistent), install of Ubuntu and expect persistence.

You can make this method work if you press F6 at boot and add " persistent", (That is -space-persistent), to the menu after "quiet splash --". You need to do this every boot.

Or

You can make a Persistent install using Startup Disk Creator or UNetbootin and replace the casper-rw file with the new one.

Or

Depending on the installer, you can edit, syslinux.cfg or loopback.cfg or txt.cfg in a Live, (non-persistent), install and add " persistent" after "quiet splash --".

C.S.Cameron
  • 19,519
  • Where can I get the casper-rw file on Ubuntu? I can only find a folder – TheRealTengri Apr 16 '20 at 07:18
  • @TheRealThing See Create a casper-rw file: https://askubuntu.com/questions/1183191/handmade-live-usb-multisystem/1184111#1184111 – C.S.Cameron Apr 16 '20 at 10:48
  • Ok. I have two casper-rw folders, one called casper-rw, which is empty, and another called casper-rw1, which is not empty, so will there be any changes in the command? I made it persistent from Windows with Rufus if that means anything – TheRealTengri Apr 16 '20 at 18:07
  • There should only be one casper-rw file, delete or rename casper-rw1. I understand that Persistence only works with Rufus with Ubuntu 19.10. Perhaps try UNetbootin: https://unetbootin.github.io/ mkusb, a Linux app is even better. – C.S.Cameron Apr 17 '20 at 05:08
  • How can I rename it? I did sudo rm -R casper-rw then sudo mv casper-rw1/ casper-rw and it says mv: cannot move 'casper-rw1/' to 'casper-rw/': Device or resource busy – TheRealTengri Apr 17 '20 at 06:35
  • Rename like casper-rw1 to xxxcasper-rw1xxx – C.S.Cameron Apr 17 '20 at 06:46