Ubuntu – How to transfer a casper-rw file to a partition


I am using a 16GB live USB with persistence so I can work from several computers.

This was working great for me until my persistence file on the USB Flash Drive got filled. As FAT32 is limited to <4GB file size, I would like to use a much larger (ext2/ext3/ext4) partition for casper-rw instead of just enlarging the file. The drive has over 8GB free space.

I know how to use Gparted to make that partition, and where my casper-rw file is.

My issue is, how do I transfer the contents of the existing casper-rw file to the new partition?

I don't want to lose all of the settings and installed programs I've added. I just want more space (unlimited by FAT32) for persistence.

Best Answer

There are 2 ways of copying casper-rw contents.

Use dd command

sudo dd if=/path/to/casper-rw of=/dev/<partition>

Then resize new partition with Gparted or resize2fs

Use cp command

sudo mkdir /mnt/casper-rw /mnt/target
sudo mount -o loop /path/to/casper-rw /mnt/casper-rw
sudo mount /dev/sdbX /mnt/target
cp -r /mnt/casper-rw/* /mnt/target

Thus /dev/sdbX does not need to be resized

Related Question