Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
So I have a Pi running Raspbian from a 4Gb SD card. I would like to 'transplant' this entire, bootable installation onto a fresh 8Gb SD card. What's the best command to achieve this? I would have thought dd but always seem to get that annoying 'not a directory' error (or some other error). Or it goes through the motions but the card remains blank. I wouldn't have thought the new card would need to be formatted, would it? And I've been using the source mounted and destination unmounted, which is correct according to my notes.
you create the partitions and you copy only the content of those partitions.
But probably better to create a fresh install on the new card and copy what you need from the old one.
Been a while since I did anything to/with my pi's, but I used to keep a (dd) image on my (x86_64) laptop. dd'd it back when needed without issue. The image got refreshed whenever I remembered to. Pretty casual arrangement but worked for what I needed.
Note this is not a copy from the running system as the OP seems (to me) to imply they are doing.
For the sake of clarification, in this particular instance, the SD card is running an embedded application. All it does is repeat the same steps every time; never needs updating, is not connected to the net and is permanently write-protected.
you create the partitions and you copy only the content of those partitions.
But probably better to create a fresh install on the new card and copy what you need from the old one.
That seems like the simplest solution (your first sentence) but it does imply that one can't simply do a byte for byte copy-over from one SD card to the other. Is that because they're different sizes and therefore have different geometries? If the two cards were identical, therefore, this issue would not arise?
yes, in case of identical cards you can definitely use dd. In this (your) case because of different sizes and other parameters the direct copy (dd) does not do what you wish.
yes, in case of identical cards you can definitely use dd. In this (your) case because of different sizes and other parameters the direct copy (dd) does not do what you wish.
Okay. Just for the avoidance of any doubt here...
Say I have two identical cards; same size and same manufacturer. I can use dd to do the job with no problems.
Now say the second card (the target) is identical in size to the source one - as in the first example - but this time from a different manufacturer. Could that possibly cause issues?
Now say the second card (the target) is identical in size to the source one - as in the first example - but this time from a different manufacturer. Could that possibly cause issues?
I guess that may happen, but I'm not really sure about that. From my side I would definitely try it.
I dd from disk to disk all the time. If target is bigger, it will work but just waste the space. Depending on the filesystem, you might be able to change the partition or grow it or partition and add it as a new filesystem.
If the target is the same but different manufacturer, the only issue would be the atomic block size of the disk drive. This should not be a different on SD cards.
Sorry for the slight delay there. Here's the key takeaway that did the trick:
"You create the partitions and you copy only the content of those partitions." - Pan64
The target was a different (larger) size and from a different manufacturer. I created partitions on the target which were bigger than those on the source disk to allow for more data if needed in the future, then dd'd sdb1---->sdc1 then sdb2------->sdc2 and so on. Worked great. Thanks, Pan64.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.