LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 11-02-2022, 06:21 AM   #1
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 899

Rep: Reputation: 70
Question Transplanting a system between SD cards


Hi all,

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.

TIA,

CC
 
Old 11-02-2022, 06:49 AM   #2
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,519

Rep: Reputation: Disabled
Use the built in card copier program.
 
Old 11-02-2022, 06:55 AM   #3
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 899

Original Poster
Rep: Reputation: 70
Quote:
Originally Posted by fatmac View Post
Use the built in card copier program.
That's actually not a bad idea! Someone really ought to write one.
I'd prefer a command-line solution, however.
 
Old 11-02-2022, 07:15 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,039

Rep: Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347
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.
 
Old 11-02-2022, 07:27 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,152

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
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.
 
Old 11-02-2022, 07:42 AM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,019

Rep: Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630
I'm not familiar with the Pi or its ability to back up. Is that from bios command?
 
Old 11-02-2022, 08:58 AM   #7
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 899

Original Poster
Rep: Reputation: 70
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.
 
Old 11-02-2022, 01:15 PM   #8
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,519

Rep: Reputation: Disabled
Check this out if you need to do it from the command line.

https://forums.raspberrypi.com/viewt...+line#p2041609
 
1 members found this post helpful.
Old 11-02-2022, 02:44 PM   #9
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 899

Original Poster
Rep: Reputation: 70
Quote:
Originally Posted by pan64 View Post
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?
 
Old 11-03-2022, 01:06 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,039

Rep: Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347
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.
 
Old 11-04-2022, 03:33 PM   #11
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 899

Original Poster
Rep: Reputation: 70
Quote:
Originally Posted by pan64 View Post
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?
 
Old 11-05-2022, 02:52 AM   #12
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,039

Rep: Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347
Quote:
Originally Posted by Completely Clueless View Post
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.
 
Old 11-05-2022, 10:17 AM   #13
elgrandeperro
Member
 
Registered: Apr 2021
Posts: 415
Blog Entries: 2

Rep: Reputation: Disabled
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.

I'd try the bigger one see what happens.
 
Old 11-15-2022, 11:51 AM   #14
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 899

Original Poster
Rep: Reputation: 70
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.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Networking help (connectivity between two lan cards on the same system) babbutycoonq Linux - Networking 3 08-16-2011 01:14 PM
transplanting my HDD user1 Linux - Newbie 1 03-21-2004 03:22 PM
formatting multimedia cards, flash cards bigearsbilly Linux - Hardware 0 03-10-2004 08:52 AM
Best cards for pcmcia cards for RH linux 7.2 clk777 Linux - Networking 1 01-12-2003 03:47 PM
Ethernet Cards and Sound Cards SchizoIV Linux - Newbie 2 07-05-2002 09:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration