However, I have only seen once the solution which seems to me the simplest which can be summed up like this (I have not tried it yet):
dietpi-services stop # better don’t have many services running in the meantime
resize2fs -M /dev/mmcblk0p2 # minimize filesystem
df / # check new size
The guide ends there and I can only guess that if my SD card is 128gb it will be minimized in size and I can just use Win32Imager on my PC to make a small image of it that I can copy to my card 32gb or 64gb with Balena? (How do I scale it back to the maximum available size then?)
Otherwise, as the publications that I found are rather old, I would like to know if simpler or more reliable techniques exist and or even if the new backup tool already present in DietPi would not already do the trick?
For information, I’m on Raspberry Pi 4 with 1gb with a 128gb SD card. I did the “DietPi_RPi-ARMv8-Bullseye” install on July 3 with the most recent version available.
Hi i’m trying the step by step guide of the blog post link but i’m not sure about this part :
" You see that the partition is shrunk to 3.82 GiB. As next, eject the SD card, put it back to your system and boot. There the SD card /dev/mmcblk0 may look like this: "
Did all the steps are made on the dietPI running system?
In other words, do I need a second computer to make parts of those steps? (I’m confused because how can you “eject” the SD card when your system is still running on it)
Chapter 2 is showing the usage of the tool GParted. It can be started as LiveCD on nearly every computer. There you could shrink partitions on a graphical interface. For this the SD card would need to be placed on a desktop computer.
This means it’s like a distro, you can flash this image to a USB drive, stick it into your pi and boot from it and just follow the guide you posted earlier.
No it’s just the Gparted application. There you can’t install anything. And it would need to be a regular computer. I don’t think it’s working on a SBC.
Anyway what exactly you are looking for? Is this a general question on what LiveCD would be a good one? Or any relationship to this question?
The proposed solution, gparted, responds well to my need for my initial question.
Nevertheless, I don’t have any other “linux PC” and the research I did before publishing shows me that it can be practical to have 1 linux pc, in addition to the Raspberry, to do certain manipulations.
So, I was wondering, as far as making a new bootable usb key with only Gparted, if you had a good recommendation of a complete and bootable distro that could contain pretty much all the interesting tools to fix or improve DietPi. (including gParted of course)
So it is indeed linked to the original question, but I push the reasoning further. (Maybe even too far ;))
I used to have an Ubuntu key that allowed me to boot into the GUI and use it like a near-normal OS with the package manager.
In the end, in 2022, which distribution would you advise me to make a bootable key containing the useful tools to help me with DietPi in the future?
I finally only flashed Gparted on a usb key and I was ready to do the steps on my PC, but I was a little afraid of screwing everything up with a steps error so I did a test before using Gparted on my SdCard.
Indeed, I have 2 sdCard of 128go so I made a backup of my main card (the one with my system configured well that I would like to transfer to my 64go card). I used Win32 diskimager to do the backup.
Then I used balenaEtcher to flash my second 128 card, same company, same capacity, same range with the backup I just made
The whole save and copy process went well, but the few tests I did with the “new card” were quite disappointing. It’s super slow and sometimes the system takes 15 to 30 seconds to respond.
Even in direct SSH connection, launching the ls -l command on a directory can take me 30s to 1min. It’s really strange. Then I could work well for 30 second to 1min and then start being slow or unresponsive.
I tried removing the card and inserting it again, same thing. If I put the “original” back it works fine, super fast as before.
I’ll have to do more research on this tonight, did I miss a step? Are the tools I used not adequate?
For the first questions, I’m still testing in the “best condition” going from 128gb to 128gb sdCard so I didn’t edited the partition yet with Gparted at all.
For the command I will try them on my lunch brake and come back to you.
Finally I decided to try the modification with Gparted to reduce the size of the 128gb anyway as in the example of the link of the first publication of Joulinar.
Downsizing seems to have worked well at this level. The partition is really shrunk and the system boots fine and I can see the size reduction.
However, when I’m on my PC to make an image with Win32imager it gives me a 128gb image that it is not possible to put on the 64gb card with belena.
Is it normal? I understand that I’m not doing exactly the same procedure as the given example, but my case I don’t understand when I’m going to succeed in copying that to the 64gb card.
I must be missing something.
To summarize, I now have a 126gb card with my primary partition shrunk to around 18gb which I would like to “clone” to my 64gb card and then run a command there to increase the size to the maximum available on the 64gb card.
I guess this is expected. If I’m not mistaken, Win32imager will create an image of the entire card and not just the used space.
Question: Are you able to connect the 64gb card to your SBC using a USB to SD card connector? Means to boot from the 128gb and connect the 64gb card to USB?
Hi
Sorry to jump in.
I tried using the copy script from the link mentioned above. I am copying from a 16gb SD card to a 32gb SD card. Everything appeared to run as expected until I issued the command to change the system back to read/write:
root@Pimedia:~#sed -i ‘|[[:blank:]]/[[:blank:]]|s|,ro|,rw|’ /etc/fstab and I got this message;
sed: couldn’t open temporary file /etc/sedEuvd65: Read-only file system.
Can someone please suggest what I can do to resolve this?
Thanks