5

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.

5

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

1

Use GParted to create the new partition. Mount the new partition and the original casper-rw partition with something like:

sudo mkdir /mnt/casperx
sudo mount /dev/sdax /mnt/casperx

Then use then copy all the files from the original casper-rw partition to the new partition using nautilus or terminal:

cp -r /mnt/original/* /mnt/casperx

Once you have all the files transferred, verify all you files are there and you could delete the original FAT partition and resize the new ext4 partition using resizefs as show here: http://www.pendrivelinux.com/how-to-create-a-larger-casper-rw-loop-file/.

1

Before transfering your casper-rw file, consider checking your unmounted casper-rw filesystem using another Linux live system:

$ sudo losetup /dev/loop0 /datas/casper-rw
$ sudo tune2fs -l /dev/loop0 | grep stat
Filesystem state:         not clean
$ sudo fsck /dev/loop0 
fsck from util-linux 2.25.1
e2fsck 1.42.10 (18-May-2014)
casper-rw was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
casper-rw: 94821/262144 files (0.2% non-contiguous), 829517/1048575 blocks
$ sudo tune2fs -l /dev/loop0 | grep stat
Filesystem state:         clean
$ sudo losetup -d /dev/loop0

Now, you can clone your casper-rw file to your chosen partition using the dd command.

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.