Clone Micro SD card fails

  • Hi guys,


    i have an odroid HC1 and am pretty happy with that guy. I just bought a faster micro sd card since i used an pretty slow old one before. The clone process is really not working out for me somehow. I used dd on mac to clone (work great) and win32diskimager in windows which failed due to not recognizing the sd card. Writing the image to the new card went through without any error output. Some how the sd card just does not want to bott in my Odoid. I also have backup files avaiable from the backup plugin in OMV. Also tried to write them with Etcher but dont understand why there are 2 images (boot and system i guess). Ether returns an error trying to write the system img because of the missing boot files.


    Has anyone an idea what i am doing wrong? I would be greatful for any help and assisstance you can give me. Thanks in advance.


    Best regards,
    Tom

  • I can say for sure its not a bad card. Even flashed the fresh image of omv and it worked right away. Now trying on Mac:

    Code
    /dev/disk4 (external, physical):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:     FDisk_partition_scheme                        *31.9 GB    disk4
       1:                      Linux                         67.1 MB    disk4s1
       2:                      Linux                         31.8 GB    disk4s2



    then I do the following:


    Code
    sudo dd if=/dev/disk4 of=HC1.img bs=512 count=10000
    10000+0 records in
    10000+0 records out
    5120000 bytes transferred in 0.851668 secs (6011731 bytes/sec)
    Code
    sudo dd if=/dev/disk4 of=HC1.img bs=512
    dd: /dev/disk4: Device not configured
    49144+0 records in
    49144+0 records out
    25161728 bytes transferred in 6.686856 secs (3762864 bytes/sec)


    That is weird the image is just a few mb big... I was able to backup before. Those above seem to be errors.

    • Offizieller Beitrag

    The first dd is OK. But it only reads the very start of the SD card. The low level nitty-gritty binary stuff like MBR, partition table and so on. Then you ALSO need to read the /boot and the / partition as well, as I do in my script using partclone. Those lines are not optional.


    The second dd is just wrong. I assume that you meant it to be a write to the SD card? But it isn't. It is another read, only with bad parameters. You need to swap the input and the output and so on. And write /boot and / from stored images as well.


    It might be possible to do it all using one very big dd, to include the start, /boot and root fs. I use partclone because it is smart enough to only clone used parts of a partition. In comparison dd is braindead and reads everything, including unused space.

  • Code
    dd if=/dev/mmcblk0 of=./images/MBR.img bs=512 count=10000
    partclone.ext4  -c -s /dev/mmcblk0p1 -o ./images/mmcblk0p1.pcl
    partclone.btrfs -c -s /dev/mmcblk0p2 -o ./images/mmcblk0p2.pcl

    Okay so when my micro sd card is disk4 as listed above the second and third command should be the following right? On Mac partclone is missing... figuring out right now...

    Code
    dd if=/dev/disk4 of=./images/MBR.img bs=512 count=10000
    partclone.ext4  -c -s /dev/disk4s1 -o ./images/mmcblk0p1.pcl
    partclone.btrfs -c -s /dev/disk4s2 -o ./images/mmcblk0p2.pcl
  • Okay that doesn’t work at all. Maybe the old Microsd card is now dead. At least I can’t read a whole image from that due to unknown reasons. And i can’t boot back into omv when trying. Luckily I have backups available. Is there a way to use the dd images from the backup plugin and write them onto the fresh sd card. Best would be if possible in Windows...


    Im greatful for any help on this.

    • Offizieller Beitrag

    Best would be if possible in Windows...

    There's an SD-card cloning process in this -> guide, starting on page 76, that works in Windows. (Page 75 may be worth a read.) But this process goes from card, to image file, to another card, to create a clone. Using a DD image as the source won't work.

    • Offizieller Beitrag

    I could be mistaken, but at least for me, I name my images imagename.dmg, not imagename.img. (That may be a Mac vs. Windows thing. I don't know since I am Windows illiterate.) That could be at least one of your problems.
    It takes a good while to complete, especially if you are using a 32Gig Micro SD card. Go outside and mow the grass or something. Here is how I clone my SD cards on a Mac:


    To Clone:


    To find the disk # of your SD card:
    diskutil list
    then
    sudo dd if=/dev/disk# of=/your/file/location/imagename.dmg


    To make a copy of the image you made:


    again:
    diskutil list
    then
    diskutil unmountDisk /dev/disk#
    and then
    sudo dd if=/your/file/location/imagename.dmg of=/dev/disk#
    When finished, eject with the command
    sudo diskutil eject /dev/disk#


    I then shut down OMV and insert the new card to make sure it works.
    I hope this solves your woes.

    System Backup Typo alert: Under the Linux section the command should be sudo umount /dev/sda1 NOT sudo unmount /dev/sda1

    Backup Data Disk to Backup Disk on Same Machine: In a Scheduled Job:rsync -av --delete /srv/dev-disk-by-uuid-f8814ed9-9a5c-4e1c-8830-426968c20ea3/ /srv/dev-disk-by-uuid-e67439d5-00a3-4942-bd5f-b84ab86aa850/ Don't forget trailing slashes, and BE CAREFUL. (HT: Getting Started with OMV5)

    Equipment - Thinkserver TS140, NanoPi M4 (v.1), Odroid XU4 (Using DietPi): PiHole

  • Okay guys. Thanks a lot for your help so far. I was not able to clone the card. Dont know why so i started with a fresh image. Is there a way to acces the backup dd file to acces the file system? Ive got a couple of docker settings and folders lying there. I would like to copy them over to the fresh installation. What would be the best way to get that working?

  • when I did a backup through the plugin isn’t that already presplitted? Or do I still have to mount specific endpoint?


    So i tried on ubuntu the following command retuning an error:

    Code
    sudo mount -t btrfs backup-omv-11-Aug-2019_00-00-01.dd /mnt
    Password: 
    mount: wrong fs type, bad option, bad superblock on /dev/loop0,
           missing codepage or helper program, or other error
    
    
           In some cases useful info is found in syslog - try
           dmesg | tail or so.




    But the filesystem is btrfs or not?


    Okay i keep working:

    Code
    sudo parted backup-omv-11-Aug-2019_00-00-01.dd unit s print
    Model:  (file)
    Disk /backup-omv-11-Aug-2019_00-00-01.dd: 62191616s
    Sector size (logical/physical): 512B/512B
    Partition Table: loop
    Disk Flags: 
    
    
    Number  Start  End        Size       File system  Flags
     1      0s     62191615s  62191616s  btrfs


    As suggested by your link then: You need to take the logical sector size and multiply that by the Start of the partition you'd like to mount.



    Code
    sudo mount -o loop,offset=512 backup-omv-11-Aug-2019_00-00-01.dd /mnt
    mount: /dev/loop0: can't read superblock
    Code
    sudo mount -t btrfs -o loop,offset=512 backup-omv-11-Aug-2019_00-00-01.dd /mnt
    mount: wrong fs type, bad option, bad superblock on /dev/loop0,
           missing codepage or helper program, or other error
    
    
           In some cases useful info is found in syslog - try
           dmesg | tail or so.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!