View: 11766|Reply: 17

how to make SD card copy under Ubuntu

[Copy link]

2

threads

5

posts

36

credits

Novice

Rank: 1

credits
36
Published in 2016-2-16 14:53:53 | Show all floors |Read mode
Hello all,

I am newbee on those nice orange pi card as well as with linux system ( run windows for long time and do some prog too under Win and Android...)
I install the ubuntu vivid mate then Apache + PHP + MySql + PhpMyAdmin and all my files on www.
Now I just finished one SD card that boot and run very well on both card I got (Orange PI 2 and Orange PI 2 mini)

I would like now duplicate this "Master" SD card for the other OPI and also get a safe copy in case of crash.

I try to duplicate and create image with win32 imager but I use a 64 GO sd card for this first install and this take day to get back the image in this way
and I would like also  now to reduce the SD to maybe only 8GO.

I saw there was command to write this in EMMC and then get it back but unforntunately  there is no memory on those board, need plus version :-(

As I have a SD to USB adapter so can boot on the original and then copy to SD/USB

Can someone give me complete procedure to achive this backup/ restore  ?

Sky

3

threads

60

posts

258

credits

Intermediate member

Rank: 3Rank: 3

credits
258
Published in 2016-2-16 16:43:46 | Show all floors
Edited by zgoda at 2016-2-16 16:45

In terminal:

  1. sudo dd if=<src-device-or-file> of=<tgt-device-or-file>
Copy code


Where "device" is block device, not partition - eg /dev/sdb. This may be file. You may try with different block sizes (bs parameter) to speedup copying, like bs=4M. Sudo is required to access device, may be omitted if command is ran by root or when both if and of parameters are regular files.

2

threads

5

posts

36

credits

Novice

Rank: 1

credits
36
 Author| Published in 2016-2-16 20:43:06 | Show all floors
Hi Zogda,

Thanks for this quick answer but as I write I am real newbee under linux
the information you give is general and probably enough for many people but I even don't know know to name device source and target
can you give more info about this ?
What is boot name SD card (source° and what should be target name ?

Rgds

Sky

7

threads

81

posts

317

credits

Intermediate member

Rank: 3Rank: 3

credits
317
Published in 2016-2-16 20:46:38 | Show all floors
@skywalker

Congrats on creating a running system for your OPIs. In order to copy/backup/resize your master-SDs you could use a Live-Linux system (running from USB stick or CD) on your PC.
This will give you all the tools necessary and also provide some introduction into the world of Linux which will be beneficial for your OPI adventures..

- In order to shrink the images, use gparted ( a graphical partition toolbox for linux )..
- Backup/restore is done per @zgoda instructions.

Good luck

2

threads

5

posts

36

credits

Novice

Rank: 1

credits
36
 Author| Published in 2016-2-17 11:07:20 | Show all floors
@rodolfo

Thanks for those information
I found on other website the terminal command
sudo fdisk-L //to find the disk name
and then launch
sudo dd if=/dev/mmcblk0p1 of=/dev/sdb1 conv=notrunc,noerror  // to copy boot partition
then
sudo dd if=/dev/mmcblk0p2 of=/dev/sdb2 conv=notrunc,noerror  // to copy file system partition

but my 64GO SD card is copying for all night and still not finished yet....

I just receive 8GO SD, so I need to transfert the files partion on smaller target (large enough)
Can I use gparted for this ?
other command line to suggest to me ?

Rgds

Sky

2

threads

144

posts

1100

credits

Gold member

Rank: 6Rank: 6

credits
1100
Published in 2016-2-17 15:08:06 | Show all floors
skywalker, Gparted isn't a tool to transfer partitions around, it's a tool to modify partition sizes, types, to delete and create new ones. You could first reduce the size of the second partition on your 64GB card to as small as possible, then use dd to make a backup of the card to a file ("dd if=/dev/yourcardwhatever of=backup.img bs=1M count=8192" would only copy 8GB, since you can't fit more on the 8GB card anyways), then resize the partition back to as large as possible with Gparted, then swap to the 8GB card and use dd to write the backup on it, then use Gparted again to resize the partition to as large as fits on the card.

2

threads

5

posts

36

credits

Novice

Rank: 1

credits
36
 Author| Published in 2016-2-18 23:21:23 | Show all floors
Hello all,

thanks for your message but for beginner like me it is still little complicated
For the help of all beginner like I am I give you one soluce I just found : https://github.com/billw2/rpi-clone

I try it copying exactly same 8GO SD card => the clone  is good except that I loose the wired connection
and cannot reactivate it (don't find how to...°
then when shut down there is lots of error message....

Is this so difficult to clone a SD card ?

Sky

2

threads

144

posts

1100

credits

Gold member

Rank: 6Rank: 6

credits
1100
Published in 2016-2-18 23:48:05 | Show all floors
I already instructed you to how to do it.

7

threads

81

posts

317

credits

Intermediate member

Rank: 3Rank: 3

credits
317
Published in 2016-2-24 23:42:13 | Show all floors
@skywalker

I just realized you were probably trying to directly "hotclone" the running system (the one on the 64G SDcard).
A safe way of cloning your SDcard consists of :

1) a complete image of the SDcard to some external storage ( takes forever, but backup is your truest friend )
2) Shrink the oversized partition on your original SDcard with gparted to a size well below 8G
3) Copy the first 8G from the original (resized) 64G SDcard to the smaller 8G SDcard

Obviously this is done on another running Linux system. If you want to use your Windows box, download a Linux Live-CD.

Good luck
Published in 2024-2-24 21:33:11 | Show all floors
After study many of the web sites for your website now, we genuinely much like your way of blogging. I bookmarked it to my bookmark website list and will also be checking back soon. Pls consider my internet site too and inform me what you think.        jun88
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list