I have a bootable 32 GB Ubuntu USB stick with persistent storage.
The 32 GB USB stick is getting full, so I want to clone it into a 64 GB USB stick and increase both the casper-rw and the usbdata partition.
How can I do it without losing any data?
Here is how I cloned the 32 GB USB stick into the 64 GB USB stick. First, I issued the following command:
lsblk
Second, I used the DD command:
sudo dd if=/dev/sdb of=/dev/sde status=progress
Third, I powered-off the computer, removed the 32 GB stick and powered on the computer. The system booted correctly from the new USB stick and it seems that all the files are there.
Forth, I loaded the GParted utility and here is the snapshot:
Now back to my original question: How do I proceed in order to increase the casper-rw and usbdata partitions using the free/unallocated space without losing any data?
Clone with mkusb
You can clone from a drive to another drive with
mkusb
. Start via the graphical interface or withwhere x is the device letter or the source in the cloning operation. The target will be selected in a safe way via menus.
dd
gdisk
.)After the cloning you can edit the partitions with
gparted
. If you touch only thecasper-rw
partition and theusbdata
partition (amd if an MSDOS partition table the extended partition), booting will not be affected.Edit: How to edit the partitions to fill the drive.
gparted
.gparted
and check that there are no lock symbols on/dev/sdb1
and/dev/sdb5
./dev/sdb1
to the tail end (to the right)/dev/sdb1
to the left until the size is what you wantIf you cloned with
dd
you need to repair the backup partition table at the tail end of the drive withgdisk
or maybe use gpt-fix.Edit:
gdisk
command options cut fromgpt-fix
where
"$1"
should be replaced by the target device/dev/sdx
, if run directly (not within the shellscript).These command letters are explained in
The crucial commands are
in the expert's menu
and in the the recovery & transformation menu
The other commands are verifying, moving between menus and writing.
Links added by the OP, @BlueSkies:
Unable to unmount a partition with GParted - is this a problem?
GParted cannot finish step 1
GParted showing now
After cloning with mkusb, copying partitions from the original USB stick and booting from the new-larger stick, I'm unable to access the usbdata.
Please advice. Thanks!
Advice: Please post the output of the following command lines (when booted from the new-larger stick),
where you enter the actual mountpoints to see
usbdata
andcasper-rw
.This will help me understand what is the problem, so that I can suggest what to do next.
Please edit your original question to enter these output texts instead of here in my answer. Indent each line 4 characters in order to render the output as code. You can mark (high-light) the text and click on the
{}
icon at the head of the editing window to make those indentations quickly.Outputs of the four above-mentioned commands:
The command
sudo lsblk -f
gives the following resultsThe other one (
sudo lsblk -m
) outputs the following info:The last two commands and results:
You could try ddrescue or gddrescue.
Just open ubuntu and install gparted, umount all partitions that you want to clone. Select partition from usb A in Gparted and copy >> paste to another usb B.