Page 1 of 2

[SOLVED] Trying to make a sd card clone without taking the sd card out of the GBZ

Posted: Fri Dec 01, 2017 12:26 pm
by Mario.Semiglia
Hallo people,

because my GBZ does not have a microsd adapter, each time that I want to mess arround with my system I need to open the GBZ in order to take the microsd card out to be able to make a backup...
by doing so the screw holes are getting screwd :lol: which is actually not funy :? so I tried to do it by inserting a micro sd adapter in one of my Usb ports to make a backup via ssh using Putty login in as "root".

Inside the CLI i tiped in

Code: Select all

git clone https://github.com/billw2/rpi-clone.git
then

Code: Select all

cd rpi-clone

Code: Select all

sudo cp rpi-clone /usr/local/sbin
then

Code: Select all

ls -la /dev/disk/by-id
the devices shown were like this

Code: Select all

root@retropie:~# ls -la /dev/disk/by-id
lrwxrwxrwx 1 root root   9 Dec  1 18:36 usb-Generic_Mini_SD_Reader_00000000000006-0:1 -> ../../sdb
lrwxrwxrwx 1 root root  10 Dec  1 18:36 usb-Generic_Mini_SD_Reader_00000000000006-0:1-part1 -> ../../sdb1
lrwxrwxrwx 1 root root   9 Dec  1 18:36 usb-Generic_USB_SD_Reader_00000000000006-0:0 -> ../../sda

Code: Select all

root@retropie:~# sudo rpi-clone sdb -v

Booted disk: mmcblk0 15.9GB                Destination disk: sdb 32.0GB
---------------------------------------------------------------------------
Part      Size    FS     Label           Part   Size    FS     Label
1 /boot   59.4MB  fat16  --              1      59.4MB  fat16  --
2 root    15.9GB  ext4   retropie        2      31.9GB  ext4   retropie
---------------------------------------------------------------------------
== SYNC mmcblk0 file systems to sdb ==
/boot                 (21.0MB used)  : SYNC to sdb1 (59.4MB size)
/                     (4.2GB used)   : SYNC to sdb2 (31.9GB size)
---------------------------------------------------------------------------
Run setup script       : no
Verbose mode           : yes
-----------------------:

Ok to proceed with the clone?  (yes/no): y

Syncing file systems (can take a long time)
Syncing mounted partitions:
  Mounting /dev/sdb2 on /mnt/clone
mount: wrong fs type, bad option, bad superblock on /dev/sdb2,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
    Mount failure of /dev/sdb2 on /mnt/clone.
Aborting!
after that i tried the command dmesg to see what it says and Ive got this

Code: Select all

[    4.922393] sd 0:0:0:1: [sdb] 62521344 512-byte logical blocks: (32.0 GB/29.8 GiB)
[    4.923025] sd 0:0:0:1: [sdb] Write Protect is off
[    4.923062] sd 0:0:0:1: [sdb] Mode Sense: 03 00 00 00
[    4.923692] sd 0:0:0:1: [sdb] No Caching mode page found
[    4.923726] sd 0:0:0:1: [sdb] Assuming drive cache: write through
[    4.943726]  sdb: sdb1
[    4.948295] sd 0:0:0:1: [sdb] Attached SCSI removable disk
[    5.341646] systemd-udevd[133]: starting version 215
[    6.755443] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    6.759228] sd 0:0:0:1: Attached scsi generic sg1 type 0
I really do not know what to do and I would really apreciate any help.
Thanks in advance

Re: Trying to make a sd card clone without taking the sd card out of the GBZ

Posted: Fri Dec 01, 2017 2:03 pm
by YaYa
Full post here, not from me
https://raspberrypi.stackexchange.com/q ... ard-reader

In your case, device seems to be sdb

1) Make sure their is a card in your card reader and then plug it into the Raspberry Pi. If using a powered HUB then the Raspberry Pi will not reboot
2) Then run "dmesg | tail" and look for /dev/sdX where X is a, b, or c (for example, the below uses 'a').
3) Now as long as the plugged-in card is the same size (or larger) than what is in the Raspberry Pi SD card slot, you can run "dd if=/dev/mmcblk0 of=/dev/sda bs=1b"
NOTE: /dev/mmcblk0 refers to the whole SD card and not any one partition
NOTE: /dev/sda refers to the whole SD card in the external reader and not any one partition
4) This will take anywhere from 10 min to an hour depending on the size of the SD card you have. When it's done you should as a minimum run "fsck /dev/sda2" since you copied a running "live" filesystem.
Not only is this a backup of your whole SD card (W95 "/boot", and Linux ext4 "/"), it can also be used to boot the system.

PS: I've also used this to copy my bootable 4 GB SD card to a 16 GB card and after using fdisk to make an ext4 on the remaining 12 GB and mount as /opt1.

Re: Trying to make a sd card clone without taking the sd card out of the GBZ

Posted: Wed Dec 06, 2017 10:20 am
by Mario.Semiglia
Hallo Yaya, thanks for taking the time to read and reply my post!, I've been really bussy in the last time so I didnt (and I steel dont) have the chance to try your solution, I just wanted to say thanks for your reply,... I ll modify the post to [Solved] when i have the chance to invest some time on my GBZ to see if I can make it work... it would be really practical cause I dont have an external micro sd card reader, I've already try making one (the simplest way posible, just a reader and some wires to pp15... and so on) and the pi didn't boot at all, so I'll try with this solution and if I don't manage I'll see if I can get the reader to work again and modify a little the case. I'll head back.
Thanks for your time :!: ;)

Re: Trying to make a sd card clone without taking the sd card out of the GBZ

Posted: Wed Dec 06, 2017 10:52 am
by YaYa
Don’t be sorry, this is a hobby not our life lol ! Let me know if this has solved your issue, might interest other people here ;)

Re: Trying to make a sd card clone without taking the sd card out of the GBZ

Posted: Fri Feb 09, 2018 10:55 am
by Mario.Semiglia
Hallo again!

so I got finilly time to do it :D

I actually do not know if its working or not, I ran the command you told me, the thing is that the sd card that I have on my GBZ its 16Gb!, if a normal 4Gb sd card takes one hour then mine should take 4 :evil:

Code: Select all

pi@retropie:~ $ dmesg | tail
[ 7344.573702] sd 6:0:0:0: [sda] Attached SCSI removable disk
[ 7344.574464] sd 6:0:0:1: [sdb] 62521344 512-byte logical blocks: (32.0 GB/29.8 GiB)
[ 7344.575445] sd 6:0:0:1: [sdb] Write Protect is off
[ 7344.575478] sd 6:0:0:1: [sdb] Mode Sense: 03 00 00 00
[ 7344.576368] sd 6:0:0:1: [sdb] No Caching mode page found
[ 7344.576394] sd 6:0:0:1: [sdb] Assuming drive cache: write through
[ 7344.610553]  sdb: sdb1
[ 7344.619858] sd 6:0:0:1: [sdb] Attached SCSI removable disk
[ 7920.113764]  sdb: sdb1 sdb2
[ 7927.373831] EXT4-fs (sdb2): Unrecognized mount option "uid=1000" or missing value

after this I didnt find the dev/sd a or b, so I tried running the command you told me

Code: Select all

sudo dd if=/dev/mmcblk0 of=/dev/sdb bs=1b
the pi seems to be "thinking" since two hours!! I dont need it at the moment but its kinda annoying. I am working via ssh the conections seems to be working good (since I didnt got any message).

thanks for taking the time of reading this post, any help is welcome!

Re: Trying to make a sd card clone without taking the sd card out of the GBZ

Posted: Fri Feb 09, 2018 12:04 pm
by YaYa
Drink a coffee and wait :lol:

Re: Trying to make a sd card clone without taking the sd card out of the GBZ

Posted: Fri Feb 09, 2018 1:07 pm
by Mario.Semiglia
:( great answer

Re:

Posted: Fri Feb 09, 2018 1:14 pm
by kite
If you changed bs=4096 or something larger it would go a lot quicker.. you are asking it to write 1 block (512 bytes) at a time, that will seriously take a long time ;) bs=1M would copy it as 1mb chunks at a time which would go at a reasonable speed

Re: Trying to make a sd card clone without taking the sd card out of the GBZ

Posted: Fri Feb 09, 2018 1:17 pm
by YaYa
Oh thanks kite for the advice, i thought that as the system was live, this param should be let at 1byte for a perfect sure copy.

Re: Trying to make a sd card clone without taking the sd card out of the GBZ

Posted: Fri Feb 09, 2018 1:32 pm
by Mario.Semiglia
Thanks! Ill go for it and head back