Hello,
I initially installed one of my systems on a 32Gb card, because it was the only one I had available at that moment.
Now I need it for another purpose, and I was wondering whether there is any easy way to transfer the system onto a smaller memory card, instead of having to reinstall everything from scratch.
Any suggestions?
Thanks
Move the system to a smaller microSD card
Re: Move the system to a smaller microSD card
You'll need to resize the 2nd partition (shrink).Sciamano wrote:Hello,
I initially installed one of my systems on a 32Gb card, because it was the only one I had available at that moment.
Now I need it for another purpose, and I was wondering whether there is any easy way to transfer the system onto a smaller memory card, instead of having to reinstall everything from scratch.
Any suggestions?
Thanks
- Put SD card into USB reader, then plug into a linux system with desktop.
- Install gparted apt-get install gparted
- then run gparted /dev/sda
- Resize ext4 partition as needed
Then use Odroid win32diskimager (which supports reading only allocated partitions) to read to image file:
http://dn.odroid.com/DiskImager_ODROID/ ... binary.zip
Then write to another card as needed.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Re: Move the system to a smaller microSD card
That sounds easy enough.Fourdee wrote:You'll need to resize the 2nd partition (shrink).
- Put SD card into USB reader, then plug into a linux system with desktop.
- Install gparted apt-get install gparted
- then run gparted /dev/sda
- Resize ext4 partition as needed
Then use Odroid win32diskimager (which supports reading only allocated partitions) to read to image file:
http://dn.odroid.com/DiskImager_ODROID/ ... binary.zip
Then write to another card as needed.
Is there any Linux alternatives to the use of the Odroid DiskImager? I only have Linux at the office, and this would speed up the process (otherwise I'll have to bring the card home for this step.
Thanks a bunch!
Re: Move the system to a smaller microSD card
Yep, you can use DD, but you'll need to define the total read size, else, will read the whole SD card:Sciamano wrote: That sounds easy enough.
Is there any Linux alternatives to the use of the Odroid DiskImager? I only have Linux at the office, and this would speed up the process (otherwise I'll have to bring the card home for this step.
Thanks a bunch!
Code: Select all
dd if=/dev/sda of=mysuperimage.img bs=2GB count=1
Although, you may need to read 4K block size and increase count accordingly (eg: count=128 = 128*4K).
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Re: Move the system to a smaller microSD card
I went with the DiskImager for Odroid way, but I can't seem to be able to make it read the shrinked partition only.
It reads the whole card.
What am I missing? It actually looks like the "normal" Win32DiskImager to me. :shock:
It reads the whole card.
What am I missing? It actually looks like the "normal" Win32DiskImager to me. :shock:
Re: Move the system to a smaller microSD card
Sorry, I possibily gave wrong link, I've uploaded one i'am using:Sciamano wrote:I went with the DiskImager for Odroid way, but I can't seem to be able to make it read the shrinked partition only.
It reads the whole card.
What am I missing? It actually looks like the "normal" Win32DiskImager to me. :shock:
http://dietpi.com/downloads/misc/Win32D ... id-v1.3.7z
Make sure box is ticked, then read image:
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Re: Move the system to a smaller microSD card
Yep, this is the correct one. Thanks!Fourdee wrote:Sorry, I possibily gave wrong link, I've uploaded one i'am using:Sciamano wrote:I went with the DiskImager for Odroid way, but I can't seem to be able to make it read the shrinked partition only.
It reads the whole card.
What am I missing? It actually looks like the "normal" Win32DiskImager to me. :shock:
http://dietpi.com/downloads/misc/Win32D ... id-v1.3.7z
Unfortunately I have not the time to try now, though. Will do tomorrow and update the thread.
EDIT: curiosity won, and I made time to finish the procedure. It seems like it worked, although I will have to wait until tomorrow to test it properly.
I might have the opposite problem now: it looks like I shrinked the image too much and now there's a lot of free space on the card. Will I need to use gparted again to stretch it, or is there a way to do it from inside DietPi (I bet on the second, since this is what it does on first boot, isn't it?)?
Re: Move the system to a smaller microSD card
OK, I can confirm the procedure went fine and that everything is working smoothly.
How can I expand the partition to occupy the whole card now? I guess I could still put the card in my linux desktop and use gparted to do this, but since the pi's usually do this after first run, I guess there is a proper command to achieve this directly in DietPi, isn't it?
How can I expand the partition to occupy the whole card now? I guess I could still put the card in my linux desktop and use gparted to do this, but since the pi's usually do this after first run, I guess there is a proper command to achieve this directly in DietPi, isn't it?
Re: Move the system to a smaller microSD card
DietPi does this very early on in the boot process, else, you'll get no end of issue with filesystem. Ideally, unplug + gparted would be safer, however, heres the code we use:Sciamano wrote:How can I expand the partition to occupy the whole card now? I guess I could still put the card in my linux desktop and use gparted to do this, but since the pi's usually do this after first run, I guess there is a proper command to achieve this directly in DietPi, isn't it?
https://github.com/Fourdee/DietPi/blob/ ... #L102-L114
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Re: Move the system to a smaller microSD card
If it's safer with gparted I'll stick with it.
I thought there was some kind of option to expand the partition to its maximum size, like raspbian (maybe, not sure) does. :geek:
EDIT: I went with the GParted solution, easy peasy
I thought there was some kind of option to expand the partition to its maximum size, like raspbian (maybe, not sure) does. :geek:
EDIT: I went with the GParted solution, easy peasy
