Clone Micro SD card fails

    • OMV 4.x
    • Update
    • 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:

      Source Code

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



      then I do the following:

      Source Code

      1. sudo dd if=/dev/disk4 of=HC1.img bs=512 count=10000
      2. 10000+0 records in
      3. 10000+0 records out
      4. 5120000 bytes transferred in 0.851668 secs (6011731 bytes/sec)

      Source Code

      1. sudo dd if=/dev/disk4 of=HC1.img bs=512
      2. dd: /dev/disk4: Device not configured
      3. 49144+0 records in
      4. 49144+0 records out
      5. 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.
    • 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.
      OMV 4: 7 x Odroid HC2 + 1 x HC1 + 2 x RPi4
    • Source Code

      1. dd if=/dev/mmcblk0 of=./images/MBR.img bs=512 count=10000
      2. partclone.ext4 -c -s /dev/mmcblk0p1 -o ./images/mmcblk0p1.pcl
      3. 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...

      Source Code

      1. dd if=/dev/disk4 of=./images/MBR.img bs=512 count=10000
      2. partclone.ext4 -c -s /dev/disk4s1 -o ./images/mmcblk0p1.pcl
      3. 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.
    • Thomas126 wrote:

      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.

      The post was edited 1 time, last by crashtest ().

    • 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.
      Retired. I love to garden and mess with computers. The more I mess with both the less I know about either.
      OMV 4.1.23-1 on a pair of Odroid hc2's w/ 4TB WD Blue. Running Nextcloud, Plex, & Heimdall - and a Raspberry Pi 3 running Pi-hole.
      Testing OMV 5.0.5 5.0.6 5.0.10-1 beta on an Odroid H2, HP dx2400, and Nanopi M4.
    • 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:

      Source Code

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




      But the filesystem is btrfs or not?

      Okay i keep working:

      Source Code

      1. sudo parted backup-omv-11-Aug-2019_00-00-01.dd unit s print
      2. Model: (file)
      3. Disk /backup-omv-11-Aug-2019_00-00-01.dd: 62191616s
      4. Sector size (logical/physical): 512B/512B
      5. Partition Table: loop
      6. Disk Flags:
      7. Number Start End Size File system Flags
      8. 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.


      Source Code

      1. sudo mount -o loop,offset=512 backup-omv-11-Aug-2019_00-00-01.dd /mnt
      2. mount: /dev/loop0: can't read superblock

      Source Code

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

      The post was edited 3 times, last by Thomas126 ().