DietPI migration from 32GB to 128GB SD card Topic is solved

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
surrevival
Posts: 3
Joined: Wed Jan 13, 2021 12:53 am

DietPI migration from 32GB to 128GB SD card

Post by surrevival »

hi all,

I've got my P4 running on DietPI 32GB SD card and would like to upgrade the SD card to 128GB. I've bee trying to find some instructions online on how to migrate the OS onto new card but nothing seem to be working. As this is 128GB card looks like I can forget about installing DietPI throubh balenaEtcher as apparently it won't format the card properly (mentioning that as I was also trying to install fresh DietPI on this card with no joy).

I also took an image of my 32GB card with Win32diskImager and restored it onto 128GB but it didn't work either (was able to see FAT32 boot partiotion on the new SD card but it did not boot up)

Question: Does anyone successfully upgraded SD card from <=32GB onto larger one and can share some tips how to do it?
User avatar
WarHawk
Posts: 679
Joined: Thu Jul 20, 2017 8:55 am

Re: DietPI migration from 32GB to 128GB SD card

Post by WarHawk »

I wonder if you had two of those sd card adapters if you could boot into clonezilla and use it to ghost from the 32GB to 128GB so it would copy over the boot info and once copied over boot into another livecd distro with a gui interface and use gparted to expand the partition to fill the new drive

That is how I moved over dietpi from that 2GB SATA SOC (where it almost filled it completely up but it installed it) to a 128GB M2 drive on the M340C thin client I have. It should work just fine with two USB -> SD card adapters as well
A. Used clonezilla live .iso on a USB drive that has ventoy installed on it
B. Cloned the 2gb SOC to the 128gb M2 drive
C. Booted ubuntu live cd to get gui desktop, then used gparted to expand the partition to fill the entire drive
D. Tell BIOS to use the new M2 drive (for you it would just be the new SD card inserted)

Code: Select all

warhawk@M-340C:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.8G     0  3.8G   0% /dev
tmpfs           782M   81M  701M  11% /run
/dev/sda1       118G  2.5G  110G   3% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           3.9G     0  3.9G   0% /tmp
tmpfs            50M  640K   50M   2% /var/log
/dev/sdb1        15G  1.9G   13G  14% /mnt/722c121a-917e-4039-9f09-6bfa3e571047
I need to do the same to the 15GB external to a new USB3.0 for the data backup...however it might change the mount point since it will be a new device


The reason you need a livecd linux flavor to boot into is that it will not use/mount the OS SD card allowing it to be copied in it's entirety

Clonezilla will also allow you to create a ghost image file if needed
User avatar
Joulinar
Posts: 3703
Joined: Sat Nov 16, 2019 12:49 am

Re: DietPI migration from 32GB to 128GB SD card

Post by Joulinar »

Hi,

did you had a look to following community guide? viewtopic.php?f=15&t=8190

It should work similar with a larger SD card. Indeed if you are able to connect both SD card to same computer, you could use GParted to clone the small one into the larger one.

But there might be other obstacle if you are not able to flash that new large SD card with a new image
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
surrevival
Posts: 3
Joined: Wed Jan 13, 2021 12:53 am

Re: DietPI migration from 32GB to 128GB SD card

Post by surrevival »

@Joulinar yes, I've looked into this one just yesterday but I think I''ll first try @WarHawk suggestion as thats something I was actually considering, I have a feeling this might work alright :)

Thanks!
User avatar
Joulinar
Posts: 3703
Joined: Sat Nov 16, 2019 12:49 am

Re: DietPI migration from 32GB to 128GB SD card

Post by Joulinar »

try GParted. usually one of the best tool for such operation.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 2613
Joined: Sat Nov 18, 2017 6:21 pm

Re: DietPI migration from 32GB to 128GB SD card

Post by MichaIng »

Easiest (not fastest) is to attach both SD cards to another Linux system and use dd:

Code: Select all

dd if=/dev/mmcblk0 of=/dev/mmcblk1 bs=1M status=progress
Replace the SD card device numbers with the actual ones, of course, "0" being the 32 MiB SD card and "1" the 128 MiB one.

The same can be done from the running DietPi system, but you need to mount the file systems in read-only mode first:

Code: Select all

dietpi-services stop
umount /boot
mount -o remount,ro /
The last step might fail with "device is busy", if there are still files write-opened. Check with:

Code: Select all

lsof / | mawk '$4~/[0-9]+[uw]/'
but sometimes there is nothing shown and umount still fails, in which case waiting a bit or killing some more non-required processes via htop might help. However, best to do from an external system ;).

After done when booting the new SD card, expand partition and file system on a next reboot via:

Code: Select all

systemctl enable dietpi-fs_partition_resize
User avatar
WarHawk
Posts: 679
Joined: Thu Jul 20, 2017 8:55 am

Re: DietPI migration from 32GB to 128GB SD card

Post by WarHawk »

MichaIng wrote: Wed Jan 13, 2021 3:24 pm Easiest (not fastest) is to attach both SD cards to another Linux system and use dd:

Code: Select all

dd if=/dev/mmcblk0 of=/dev/mmcblk1 bs=1M status=progress
Replace the SD card device numbers with the actual ones, of course, "0" being the 32 MiB SD card and "1" the 128 MiB one.

The same can be done from the running DietPi system, but you need to mount the file systems in read-only mode first:

Code: Select all

dietpi-services stop
umount /boot
mount -o remount,ro /
The last step might fail with "device is busy", if there are still files write-opened. Check with:

Code: Select all

lsof / | mawk '$4~/[0-9]+[uw]/'
but sometimes there is nothing shown and umount still fails, in which case waiting a bit or killing some more non-required processes via htop might help. However, best to do from an external system ;).

After done when booting the new SD card, expand partition and file system on a next reboot via:

Code: Select all

systemctl enable dietpi-fs_partition_resize
Yeah I wasn't sure if the

Code: Select all

systemctl enable dietpi-fs_partition_resize
would work...but MichaIng said it would so just cloning the small to large sd then expanding will fill the device

Nice!
surrevival
Posts: 3
Joined: Wed Jan 13, 2021 12:53 am

Re: DietPI migration from 32GB to 128GB SD card

Post by surrevival »

Hi,

i did manage to clone the cards with disk-to-disk Clonezilla live CD. Although I did not have another SD card slot I've cloned it from 32GB microSD (using build in laptop slot) onto 120GB external hard drive (USB), then from there onto 128GB microSD card.
Then using Ubuntu liveCD and gparted, expanded the ext4 partition and its all now dancing and singing.
Thanks all for your help, really appreciate it!
User avatar
MichaIng
Site Admin
Posts: 2613
Joined: Sat Nov 18, 2017 6:21 pm

Re: DietPI migration from 32GB to 128GB SD card

Post by MichaIng »

Great to hear that all worked well :)!
User avatar
WarHawk
Posts: 679
Joined: Thu Jul 20, 2017 8:55 am

Re: DietPI migration from 32GB to 128GB SD card

Post by WarHawk »

surrevival wrote: Fri Jan 15, 2021 8:20 pm Hi,

i did manage to clone the cards with disk-to-disk Clonezilla live CD. Although I did not have another SD card slot I've cloned it from 32GB microSD (using build in laptop slot) onto 120GB external hard drive (USB), then from there onto 128GB microSD card.
Then using Ubuntu liveCD and gparted, expanded the ext4 partition and its all now dancing and singing.
Thanks all for your help, really appreciate it!
Awesome!!!!
Post Reply