Page 1 of 2

how to copy 1 external SD to another external SD?

Posted: Sat Jul 13, 2019 9:38 am
by dsyleixa123
hello,
I am using Stretch (GUI Desktop) and 2 USB-to-SD adaptors.
I must backup 1 non-GUI-Jessie SD from 1 SD to another blank SD, both have 32 GB.
(I actually wanted to use the Stretch GUI copy tool because it copies also slightly different storage sizes correctly)

The non-GUI-Jessie has no SD copy tool, so I must boot from GUI-Stretch.
But when I insert the 2 USB adapters then I always can see only the first arbitrarily inserted SD (pops up in a GUI window when inserted),
when plugging in the 2nd one additionally then nothing happens (either if the 1st is the Jessie SD or the blank SD or vice versa):
/media/pi/1608-E992 (blank SD)
/media/pi/boot + partition2 (Jessie SD)

When opening the copy tool from Stretch then only 2 SD sources are listed (internal Stretch boot SD and 1 external, not overall 3 as expected), and only 1 target is listed (not 2 optionally as expected), all listed by strange /dev/names:
/dev/sda (identical for either Jessie SD or the blank SD, anyway which was inserted as the first one)
/dev/mmcblk0 (Stretch boot SD)

(never a 3rd SD is listed)

So how can I make a 1:1 copy of my Jessie non-GUI build, preferably using the Stretch copy tool?

Re: how to copy 1 external SD to another external SD?

Posted: Sat Jul 13, 2019 10:11 am
by LTolledo
lets do it inside Raspbian Stretch with desktop, its much easier than on a winpc (but can be done, but with more steps)

insert the source microSD (in microSD to USB adapter) to RPi's vacant USB slot
insert the target microSD (in another microSD to USB adapter) to RPi's another vacant USB slot

run the SD Card Copier program
on Copy from Device select the source microSD
on Copy to Device select the target microSD
(make sure you selected the correct one, double and triple check if you have to)

once confirmed correct, click on start

I do microSD copy to microSD copy on a winpc, as I also want a backup image in the winpc (so I can transfer to a backup HDD later on)
read the source microSD using win32diskimager
then use Etcher to copy the saved image to the blank microSD

Re: how to copy 1 external SD to another external SD?

Posted: Sat Jul 13, 2019 10:18 am
by dsyleixa123
LTolledo wrote:
Sat Jul 13, 2019 10:11 am
lets do it inside Raspbian Stretch with desktop, its much easier than on a winpc

insert the source microSD (in microSD to USB adapter) to RPi's vacant USB slot
insert the target microSD (in another microSD to USB adapter) to RPi's another vacant USB slot

run the SD Card Copier program
on Copy from Device select the source microSD
on Copy to Device select the target microSD
(make sure you selected the correct one, double and triple check if you have to)

once confirmed correct, click on start


as stated that's not possible because I cannot see 2 different external SDs (to copy from...to), always just 1 external.
(Finally I do not want to copy the intemal SD contents).
So how can I make the obscured 2nd external SD visible?

Re: how to copy 1 external SD to another external SD?

Posted: Sat Jul 13, 2019 10:39 am
by LTolledo
try ejecting and re-inserting again

in my setup
1. inserted the source microSD
2. confirmed inserted as a pop-up window appeared, closed it
3. insert the target microSD
4. again it was confirmed inserted a a pop window again appeared, closed it

ran SD Card copier and confirmed the 2 microSD cards were present.

and am using no-name single-slot microSD card readers (from a dollar store) for this test.

Re: how to copy 1 external SD to another external SD?

Posted: Sat Jul 13, 2019 10:43 am
by dsyleixa123
LTolledo wrote:
Sat Jul 13, 2019 10:39 am
try ejecting and re-inserting again

in my setup
1. inserted the source microSD
2. confirmed inserted as a pop-up window appeared, closed it
3. insert the target microSD
4. again it was confirmed inserted a a pop window again appeared, closed it

ran SD Card copier and confirmed the 2 microSD cards were present.

and am using no-name single slot microSD card readers (from a dollar store) for this test.
I did all that about ejecting and re-ejecting, but always just 1 external SD is visible, not the other one (as stated, just the 1 which I inserted first arbitrarily in either adapter to either USB slot).

Re: how to copy 1 external SD to another external SD?

Posted: Sat Jul 13, 2019 10:55 am
by LTolledo
strange predicament you have indeed. :shock:

have you checked on which microSD card reader the GUI pop-up is not appearing?

Re: how to copy 1 external SD to another external SD?

Posted: Sat Jul 13, 2019 5:50 pm
by dsyleixa123
please read closely:
the one which I arbitrarily plug fist does appear the other one then doesn't.
so if I 1st plug the empty SD, then the empty one appears and the Jessie card don't -
and if I 1st plug theJessie SD then the empty one doesn't afterwards any more.

Re: how to copy 1 external SD to another external SD?

Posted: Sun Jul 14, 2019 12:05 am
by LTolledo
hmm quite odd indeed

am sorry am not able to replicate the same in my setup

and I was trying to do a not-so-ideal configuration to see if I can replicate it, but to no avail :(
my connection was as follows (repeated twice for 2 microSD card connections)

[RPi USB port] ---- [cheapo USB extension cable 0.5m] ---- [cheapo single slot microSD card reader] ---- [microSD]

maybe others can shed light into the matter....

edit: clarifying my actual connections during the test, might be irrelevant, just posting to be clear
[USB port top left] --- [Inateck SATA to USB3.0 adapter cable] --- [Crucial SSD] {boot drive}

[USB port bottom left] --- [cheapo USB extension cable 0.5m] ---- [cheapo single slot microSD card reader] ---- [microSD] {source}

[USB port top right] --- [USB A to USB D cable 0.5m] --- [KVM switch]

[USB port bottom right] --- [cheapo USB extension cable 0.5m] ---- [cheapo single slot microSD card reader] ---- [microSD] {target}

Re: how to copy 1 external SD to another external SD?

Posted: Sun Jul 14, 2019 9:52 am
by dsyleixa123
so what shall I do now to make both external SD cards visible simultaneuosly?
(JTM: I freshly formatted the empty SD by SD Formatter Tool on my Windows PC => FAT32, 29.8GB available, 1 partition, I labelled it "VOID")

for either SD and either USB-SD-adapter (same brands) and either RPi USB slot :
Only the respectively (arbitrarily, randomly) first inserted SD is visible, the 2nd is always invisible then
- no additional popup window when plugged in,
- no additional entry in /media/pi/
- no additional entry in systray to remove a USB device
- no additional entry in sysmenu SD copytool as a target or a source SD

Re: how to copy 1 external SD to another external SD?

Posted: Sun Jul 14, 2019 6:13 pm
by fbe
I can confirm that I have a card reader with a slot for µSD cards and a slot for SD cards. Both slots are shown as the same device (/dev/sda). I can see only the card that is recognised first from both slots. Other slots on the same card reader (for MS, XD, CF cards) have different device names (/dev/sdb to /dev/sdd). A card in the CF slot is visible at the same time.

Have you got a second SD card reader? May it would work better with the SD cards in two different readers.

Re: how to copy 1 external SD to another external SD?

Posted: Sun Jul 14, 2019 10:15 pm
by dsyleixa123
yes, I have
2 different µSD cards
in 2 different µSD-to-SD adaptors
in 2 different USB card readers
in 2 different RPi USB ports. 8-)
And additionally of course 3rd, the Stretch boot µSD in the RPi µSD slot.

Re: how to copy 1 external SD to another external SD?

Posted: Mon Jul 15, 2019 4:24 pm
by dsyleixa123
no ideas anyone?

Re: how to copy 1 external SD to another external SD?

Posted: Mon Jul 15, 2019 11:27 pm
by swampdog
The command line will help you diagnose.

Code: Select all

$ sudo apt-get install lsscsi usbutils parted
You can now "lsscsi" and "lsusb". Note I've only got one of these usb/sdcard dongles and I'm doing this under Linux Mint (no rpi to hand) but the principle is the same.

What happens when you plug one in? ...

Code: Select all

$ sudo tail -n 30 -f /var/log/syslog

[snip]
Jul 15 23:17:38 sdu kernel: [44185.117611] usb 3-1: new high-speed USB device number 3 using ehci-pci
Jul 15 23:17:38 sdu kernel: [44185.276857] usb 3-1: New USB device found, idVendor=05e3, idProduct=0738
Jul 15 23:17:38 sdu kernel: [44185.276861] usb 3-1: New USB device strings: Mfr=3, Product=4, SerialNumber=5
Jul 15 23:17:38 sdu kernel: [44185.276863] usb 3-1: Product: USB Reader
Jul 15 23:17:38 sdu kernel: [44185.276865] usb 3-1: Manufacturer: Genesys
Jul 15 23:17:38 sdu kernel: [44185.276866] usb 3-1: SerialNumber: 000000000936
Jul 15 23:17:38 sdu kernel: [44185.277404] usb-storage 3-1:1.0: USB Mass Storage device detected
Jul 15 23:17:38 sdu kernel: [44185.277809] scsi host7: usb-storage 3-1:1.0
Jul 15 23:17:39 sdu mtp-probe: checking bus 3, device 3: "/sys/devices/pci0000:00/0000:00:16.2/usb3/3-1"
Jul 15 23:17:39 sdu mtp-probe: bus: 3, device: 3 was not an MTP device
Jul 15 23:17:39 sdu kernel: [44185.579255] usbcore: registered new interface driver uas
Jul 15 23:17:40 sdu kernel: [44186.310534] scsi 7:0:0:0: Direct-Access     Generic  STORAGE DEVICE   0566 PQ: 0 ANSI: 6
Jul 15 23:17:40 sdu kernel: [44186.310965] sd 7:0:0:0: Attached scsi generic sg4 type 0
Jul 15 23:17:40 sdu kernel: [44186.449251] sd 7:0:0:0: [sdd] 7725056 512-byte logical blocks: (3.96 GB/3.68 GiB)
Jul 15 23:17:40 sdu kernel: [44186.450235] sd 7:0:0:0: [sdd] Write Protect is off
Jul 15 23:17:40 sdu kernel: [44186.450237] sd 7:0:0:0: [sdd] Mode Sense: 21 00 00 00
Jul 15 23:17:40 sdu kernel: [44186.451294] sd 7:0:0:0: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Jul 15 23:17:40 sdu kernel: [44186.460119]  sdd: sdd1 sdd2
Jul 15 23:17:40 sdu kernel: [44186.463492] sd 7:0:0:0: [sdd] Attached SCSI removable disk
[snip]
No problem above.

Using something from the idVendor/idProduct above single out the usb device..

Code: Select all

$ lsusb | grep 0738
Bus 003 Device 003: ID 05e3:0738 Genesys Logic, Inc.
Has it appeared as a disk?

Code: Select all

$ lsscsi | grep sdd
[7:0:0:0]    disk    Generic  STORAGE DEVICE   0566  /dev/sdd
Yes.

Is it mounted?

Code: Select all

$ mount | grep sdd
In my case, no because (reasons) so mount it manually. Either by using the info from the "tail" or parted..

Code: Select all

$ sudo parted /dev/sdd print

Model: Generic STORAGE DEVICE (scsi)
Disk /dev/sdd: 3955MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      4194kB  48.0MB  43.8MB  primary  fat32        lba
 2      50.3MB  3955MB  3905MB  primary  ext4
Make some manual mountpoints, readonly (-r) in my case because I don't want the filesystem altered.

Code: Select all

$ sudo mkdir -p /mnt/dev/sdd/p{1..4}

$ sudo mount -r /dev/sdd1 /mnt/dev/sdd/p1
mount: /dev/sdd1: can't read superblock
^^oh..

Code: Select all

$ sudo mount -r /dev/sdd2 /mnt/dev/sdd/p2
^^..bugger.

^^^the above sdcard is dead. Looking at /var/log/syslog, this kind of fault..

Code: Select all

Jul 15 23:54:38 sdu kernel: [46405.275000] FAT-fs (sdd1): error, fat_get_cluster: invalid cluster chain (i_pos 1)
Jul 15 23:51:53 sdu kernel: [46239.748814] Buffer I/O error on dev sdd2, logical block 143, lost async page write
Use a pair of terminals from the GUI. Drag one full height and run "sudo tail -f /var/log/syslog" in it. You'll see events as/when they occur. Use the other terminal to diagnose the issue. For instance: if I'd taken my own advice there and left "tail -f" running I'd have seen the card was dead immediately. Instead I went and did "mount -r -t vfat /dev/sdd1 /mnt/dev/sdd/p1" and stared stupidly at it when that failed also.

You'll be pulling and plugging those usb devices a few times to figure out where the problem is. Make sure you unmount everything associated with each usb/lssci device before each reinsertion else you'll create "dead" filesystems - which will prevent you diagnosing the problem at all.

Again with a known good (noobs) sdcard..

Code: Select all

[email protected] ~ $ mount | egrep "/dev/sd[a-z]"

/dev/sdd5 on /media/foo/boot type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
/dev/sdd6 on /media/foo/0eb36e9e-40f5-47f4-a751-4e197c0dd7c8 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)
It's okay to manually unmount "automounted" stuff. As stated above you must do it (unmount) and best way to ensure there's no problem is to do it manually..

Code: Select all

sudo umount /media/foo/boot
sudo umount /media/foo/0eb36e9e-40f5-47f4-a751-4e197c0dd7c8
^^any open file manager windows will close themselves.

[email protected] ~ $ mount | egrep "/dev/sd[a-z]"
^^^the usb/lsscsi devices should be gone (okay to pull usb dongle).

A hint (though not proof) that you may not have unmounted everything will be if, on each insertion, the lsscsi device keeps changing (eg: was /dev/sda and now is /dev/sdb then /dev/sdc etc).

Re: how to copy 1 external SD to another external SD?

Posted: Tue Jul 16, 2019 7:39 am
by dsyleixa123
thanks for your efforts, but I honestly do not understand a single word of all those commands and - moreover - anything of the tons of output listings, it's really killing me.
Finally it's obvious and evident if either SD was individually plugged: either SD is formatted and partitioned correctly
- but it fails when either one is plugged as a 2nd device, then the 2nd device is completely invisible.

Re: how to copy 1 external SD to another external SD?

Posted: Tue Jul 16, 2019 9:27 am
by epoch1970
Well then I suppose the GUI tool you’re using has an option to save an SD as an image on the file system.
Plug your SD, save as file, unplug, plug the other one, restore from file to the SD.
Do not confuse which is which before proceeding...

Re: how to copy 1 external SD to another external SD?

Posted: Tue Jul 16, 2019 11:49 am
by dsyleixa123
epoch1970 wrote:
Tue Jul 16, 2019 9:27 am
Well then I suppose the GUI tool you’re using has an option to save an SD as an image on the file system.
Plug your SD, save as file, unplug, plug the other one, restore from file to the SD.
Do not confuse which is which before proceeding...
AFAICS, when starting the Stretch GUI menu SD copy, there is no option to save as file, just 2 drop-down menus to choose a source and a target SD (CMIIW)

Re: how to copy 1 external SD to another external SD?

Posted: Tue Jul 16, 2019 8:42 pm
by dsyleixa123
is this faulty SD-detection issue a Raspian Stretch OS malfunction?
who can fix that?

Re: how to copy 1 external SD to another external SD?

Posted: Tue Jul 16, 2019 8:54 pm
by epoch1970
Nobody will I'm afraid, Stretch is no longer current. Buster is.

You can make a copy of an SD from the command-line, from a PC or MAC or Linux machine using various programs or the command-line.
If you can't make your initial plan work, I suggest you examine some of these alternatives.

Re: how to copy 1 external SD to another external SD?

Posted: Tue Jul 16, 2019 9:50 pm
by LTolledo
for me, if I cant do the cloning on this RPi3B+, I'll try it on a RPi3B (both running Raspbian Stretch with full Desktop)

if that still fails (very very rarely that it does), I do it on the win10pc, using the Win32DiskImager + BalenaEtcher combo...and get a backup on the win10pc HDD as a bonus!

Re: how to copy 1 external SD to another external SD?

Posted: Wed Jul 17, 2019 5:40 am
by dsyleixa123
LTolledo wrote:
Tue Jul 16, 2019 9:50 pm
for me, if I cant do the cloning on this RPi3B+, I'll try it on a RPi3B (both running Raspbian Stretch with full Desktop)

if that still fails (very very rarely that it does), I do it on the win10pc, using the Win32DiskImager + BalenaEtcher combo...and get a backup on the win10pc HDD as a bonus!
On my Windows PC (Win 7 pro) I can see both SDs in the 2 USB adapters (actually the FAT32 partitions), but my Windows PC cant' see or copy Linux partitions.
I have no other Linux machine apart from my RPi 2, I prefer Windows on my PCs (all Win 7 pro).
My Pi (2) fails in this respect completely using the same SD-USB-adapters - what a mess!
IMO it's definitely a OS malfunction.

How can I copy the Jessie non-GUI SD when having bootet from this Jessie OS SD?

Re: how to copy 1 external SD to another external SD?

Posted: Wed Jul 17, 2019 8:33 am
by epoch1970
dsyleixa123 wrote:
Wed Jul 17, 2019 5:40 am
my Windows PC cant' see or copy Linux partitions.
LTolledo said above he/she uses "Win32DiskImager + BalenaEtcher". Have you tried these on the Win7 PC?

Re: how to copy 1 external SD to another external SD?

Posted: Wed Jul 17, 2019 9:21 am
by RaTTuS
several ways can be done
1) use a boot usb stick to boot windows machine into a linux and copy from that
2) use raspbian to backup from rpi to a windows share on your windows box

other things to try
boot to desktop without anything plugged in
open up a cmd line [or switch to a terminal window alt-f2 for example
type tail -f /var/log/syslog
plug in one device
see what is says
plug in the other
remove the all plug them both in in another order

3) use 2 raspberry, plug one in one machine and one in the other then copy from one to the other across the network

Re: how to copy 1 external SD to another external SD?

Posted: Wed Jul 17, 2019 12:37 pm
by LTolledo
dsyleixa123 wrote:
Wed Jul 17, 2019 5:40 am
LTolledo wrote:
Tue Jul 16, 2019 9:50 pm
for me, if I cant do the cloning on this RPi3B+, I'll try it on a RPi3B (both running Raspbian Stretch with full Desktop)

if that still fails (very very rarely that it does), I do it on the win10pc, using the Win32DiskImager + BalenaEtcher combo...and get a backup on the win10pc HDD as a bonus!
On my Windows PC (Win 7 pro) I can see both SDs in the 2 USB adapters (actually the FAT32 partitions), but my Windows PC cant' see or copy Linux partitions.
I have no other Linux machine apart from my RPi 2, I prefer Windows on my PCs (all Win 7 pro).
My Pi (2) fails in this respect completely using the same SD-USB-adapters - what a mess!
IMO it's definitely a OS malfunction.

How can I copy the Jessie non-GUI SD when having bootet from this Jessie OS SD?
the Win32DiskImager + BalenaEtcher method, I've done that more than 2 dozen times
just plug the source disk (disregard if windoze doesnt read the linux partion, it doesnt, wont matter!)
let Win32DiskImager "read" the source so it can save it to a file in a windows folder that you direct it to (just dont forget to put the .img after the file name, ex: RPi2BJessie07172019.img)
after that, its time to use Etcher to flash the saved image to the target microSD card (this time I'll assume that you already know how to use Etcher)

you'll never know until you actually try this method...
or you still prefer to discuss this much much much further ( anybody for popcorns and drinks? ) and still your dilema is not resolved...

Re: how to copy 1 external SD to another external SD?

Posted: Wed Jul 17, 2019 12:43 pm
by LTolledo
epoch1970 wrote:
Wed Jul 17, 2019 8:33 am
dsyleixa123 wrote:
Wed Jul 17, 2019 5:40 am
my Windows PC cant' see or copy Linux partitions.
LTolledo said above he/she uses "Win32DiskImager + BalenaEtcher". Have you tried these on the Win7 PC?
Thanks for the "promotional plug"....
...am a male type person...FYI :D
(no offense taken tough) ;)

Re: how to copy 1 external SD to another external SD?

Posted: Wed Jul 17, 2019 1:22 pm
by dsyleixa123
epoch1970 wrote:
Wed Jul 17, 2019 8:33 am
dsyleixa123 wrote:
Wed Jul 17, 2019 5:40 am
my Windows PC cant' see or copy Linux partitions.
LTolledo said above he/she uses "Win32DiskImager + BalenaEtcher". Have you tried these on the Win7 PC?
yes, now I downloaded BalenaEtcher. Win32DiskImager was already here.
I'll try it out by my Windows PC and report then, thank you!