1

So I have been booting from a live usb with casper-rw, to store programs and whatnot on. After running out of space on the casper-rw file, I decided to install Ubuntu from the live usb stick....So I am currently dual booting Ubuntu and Windows 7

I kind of hoped that this would just grab all of the stuff from the casper-rw file (documents, programs, etc.), but it did not.

So the question is, how do I get all of the stuff from the casper-rw file of the Usb drive, without destroying everything (I would prefer windows stay intact, but have made a backup just in case)

2

Well, to transfer files you can mount the Ubuntu root partition (or /home if it is on a separate partition) and just copy the files you can access on your USB that way.

Let's say you have a directory on your USB called Documents that you want to copy to your installed Ubuntu's home directory. You could do this...

First, from your full installation, find out what your root partition is on your installation by doing

lsblk

Take note of the partition mounted on / (or /home if it's separate)

Now boot the live usb and mount that partition. Replace /dev/sdxY with the correct partition name

sudo mount /dev/sdxY /mnt

Now your home directory is located at /mnt/home/username so you can do (replace with your real username)

sudo mkdir /mnt/home/username/casperdocs
sudo cp -r Documents /mnt/home/username/casperdocs

to copy the Documents directory to ~/casperdocs on your installation

Very important - don't forget to unmount the partition when you are done:

sudo umount /dev/sdxY

now reboot into your installation and you will find the files.

With programs (assuming you mean repository packages) you should install through apt rather than trying to copy their files this way.

0
2

casper-rw is a file with an ext4 filesystem within it. So, you can just mount it and copy the contents from it in your Regular Ubuntu installation.

Assuming you're in a location where casper-rw file resides, you can mount it at /mnt using command

sudo mount ./casper-rw /mnt

Then the whole directory tree of an Ubuntu system will appear in /mnt directory. These are the files newly created on Live system, or modified.

Note for 16.04: However, in 16.04 Ubuntu's Startup disk creator is missing option for using a persistence file like casper-rw. It uses dd instead. In that case, you might be using tools like mkusb. If you're using mkusb, it won't create a file, instead create a separate partition in your USB. It will named as casper-rw. If you access those files without using mount command, from Files.

Here is a list of interesting files you might want to copy:

  1. Your downloaded/created documents will be in /mnt/home. You can copy and paste them one by one in your Ubuntu home /home. But if you want to copy all of them once (which could go wrong sometimes) you can quickly run

    cp -r -p -u /mnt/home/ubuntu/ /home/rubik/ -v
    

    Here,

    • -r is for recursively copying the files from Live system to your home
    • -p is for preserving the permission. I'm assuming that you're the first created user, so your UID is 1000 which will match the UID of the LIVE system user ubuntu.
    • -u is update only. That means, if you already have a file in your new Ubuntu installation which is of same name but new, it will not be replaced by the one from older Live system.

    • Also I'm assuming that your user name is rubik. If it is not, replace it with the actual one.

  2. The downloaded packages are in /mnt/var/cache/apt/archives folder. You can copy them somewhere else and quickly run a sudo dpkg -i *.deb to install all of them again.

  3. Other configuration files will be in /mnt/etc/ directory just like regular Ubuntu installation. If you added PPAs, those PPAs sources will be found in /mnt/etc/apt/sources.list.d directory. You can copy them to your main Ubuntu. Don't forget to copy the associated key from /mnt/etc/apt/trusted.gpg.d.

Hope this will help you regain your files from casper-rw.

2
  • Oh that's the proper answer, nice :) – Zanna Aug 27 '16 at 8:53
  • 1
    Your answer will work too! If OP wants only the files in Home directory. Thanks – Anwar Aug 27 '16 at 9:43

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.