move System to smaller card


joachim

Member
Joined
May 22, 2013
Messages
406
ok this maybe a little OT because it is not for pandora but who knows ..

I got a Linux system on 4GB card         with 16MB boot and the rest rootfs. on rootfs only 700MB is used. How can I move this to a 2GB card ? dd will not work but stops at 2GB. 

Thanks for help.
 
Yes, I'd set up your partitions on the new card and transfer the contents over - not try to transfer the partitions themselves over. You can use various methods to do that - from cp -r through tar -cf|tar -xf through to using cpio passthrough as mentioned above. I'm not actually aware of the difference between the last two, but the latter is newer, and pretty analogous to the tar method, so I assume it's the best.


Actually, I've just looked it up, differences are: cpio handles hard links, has better defaults (e.g. preserve timestamps) and is generally easier to use. You'll want to exclude /dev, /proc, /mnt, /tmp and /media (I'll guess that's where those permission errors in the above thread came from), and that ought to be enough to get a working copy, I think.


Thinking about it, if you've not hacked the OS too much and have half decent wifi, dumping a new 1.60 SZ on the new partition and copying your /home directory over might be the simplest and most reliable solution.


Edit: How do you mean won't boot? Are you autobooting or not? Is it picking up the kernel? Where's it falling over?
 
Last edited by a moderator:
As wb said, I think shrinking the partitions to a little less than 2GB, using dd and then growing them again to the full card size is pretty fast and easy, nothing can really go wrong, I think.
 
Ugh, perhaps I'm a little old fashioned, but modifying preexisting filesystems always seems more fraught than rebuilding a new filesystem from existing data. I've seen too many tools over the years that claim to be able to shrink or grow filesystems that result in massive corruption to trust any tool when I haven't made extensive backups.


I assume the proposal here is to dd it to a new smaller partition though, so at least then if it goes wrong you won't have nixed your original partition.
 
To explain some things : this was no OP Linux but for another embedded system called Gnublin.

I tried gparted to resize but it did'nt work in SZ. Sometimes I must use Slackware and gparted for some functions because Sz will not do. There were 3 patitions on the card with one showing an error but it works. Might be this was a boot partition ?This 3rd I missed on the 2 GB card. Maybe this was the problem. I wrote it completely new, now it works :)
 
Back
Top