0
berobispo

procedure for cloning of sd card

Recommended Posts

Armbianmonitor:

Hi!

 

short question: Best way to create a bootable clone of sd card? I did some reading and found ">>create image on windows >> shrink image via gparted" doesn't work for me since I dont have a second computer running linux (will the linux subsystem on windows 10 help?).

 

In the past, I used the rpi-clone on a raspberry, but reading in this forum has taught me that hotcloning an armbian sd card via script is not necessarily safe.

 

Computers availabel to me are: 1) odroid hc2 running armbian 2) acer laptop running windows 10

Share this post


Link to post
Share on other sites

Update: I tried to clone the SD card doing the following, inspiration from this thread: 

1) download armbian image, burn to another SD card (#2)

2) run armbian from this SD card #2 (works)

3) insert former boot SD card (#1) and backup SD card (#3) in SD card reader

4) dd if=/dev/#1 of=/dev/#3 bs=1M count=4 (to copy partition scheme and bootloader)

5) mount #1 /mnt/origin, mount #3 /mnt/clone

6) rsync -avSz /mnt/origin /mnt/clone (seems to work)

7) check /etc/fstab on #3, adjust UUID of /

8) try to boot from #3 --> doesn't work :-(

 

I don't want to (can't) use dd because the SD card #3 is only 16 GB, whereas the #1 SD card is 32 GB, and my armbian installation takes only 4,1 GB. And I understand Igor's opinion that it's much more useful to save /home/* and /etc/* and a list of installed packages, but I want to have a working clone handy for instant use in case the #1 SD card fails, mostly because I am planning on installing pihole and I am worried about increased wear on the SD card.

 

Can someone tell me why the approach aboce doesn't work? Does it have to do with /etc/fstab? Partitions? Thanks in advance!

 

EDIT: both #1 and #3 are high quality (SanDisk Ultra A1)

Share this post


Link to post
Share on other sites

Figured it out, using pishrink, finally! It takes a while because 28 GB of empty space are being copied in the beginning, but anyhow ;-)

This is my procedure:

 

1) boot from "plain" armbian (#2, see above)

2) insert original SD card (#1, 32 GB) in reader

3) dd if=/dev/sd#1 of=/path/to/image.img

4) pishrink.sh /path/to/image.img

5)dd if=/path/to/image.img of=/dev/sd#3, #3 being the backup SD card, 16 GB

 

note: "#1", e.g. is "/dev/sda", not "/dev/sda1", since you need to do a block level copy of the device, not only the disk.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
0