New to OMV and Linux

  • Looks like you will have to restore an image somewhere if you want to see what's inside it.

    Seems so. Kind of annoying.


    Here's a comparison of partclone (.pcl; mounting issues), dd (.img; size), and dd + gzip (.img.gz; some mounting issue and moderate size):

    Code
    4.9M     MBR.img
     64M     mmcblk0p1.img
     42M     mmcblk0p1.img.gz
     29M     mmcblk0p1.pcl
    7.4G     mmcblk0p2.img
    5.0G     mmcblk0p2.img.gz
    1.4G     mmcblk0p2.pcl


    Partclone does have a significant size advantage. If only I could easily mount it. Comments suggest it may be possible, and I did install the partclone-util tool, but the documentation is sparse and I have not succeeded in mounting a "special image format".

  • Solution to mounting a partclone "special image file": Restore the partclone image to a raw image file, which is then mounted to a loop device.


    Code
    cat mmcblk0p2.pcl | sudo partclone.btrfs -r -W -s - -o raw.img
    sudo mount -o loop raw.img /mnt


    Now I can have my cake and eat it too.

  • Bash: backup_sdcard.sh
    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
    Bash: restore_sdcard.sh
    dd if=./images/MBR.img of=/dev/mmcblk0 bs=512
    sleep 5
    flush
    sleep 5
    partclone.ext4  -r -s ./images/mmcblk0p1.pcl -O /dev/mmcblk0p1
    partclone.btrfs -r -s ./images/mmcblk0p2.pcl -O /dev/mmcblk0p2

    Looks like this will need to be modified for OMV5.


    With no more OMV installation image, I followed the instructions to install Armbian and then use the OMV install script. This results in the entire SD card being one ext4 partition instead of the previous two ext4 and btrfs partitions. I think omitting the last line from each script should work, but I haven't tried it yet.

    • Offizieller Beitrag

    Yes, I agree.


    I did as you did. Installed Armbian and then OMV using the script.


    It seems that you end up with a SD card with one partition that fills the whole card.


    What I did:


    I removed my 32GB Sandisk Ultra A1 SD card with a new OMV5 install for HC2. I put the card into a SD card reader in a Linux PC. It appeared as /dev/sdb.


    I resized the partition /dev/sdb1 to around 8 GB using gparted. The reason is that I have some 16GB cards. I want to be able to restore the SD card copy to those, if needed. It seems partclone doesn't like writing to partitions that are too small. Possibly I could force it, but rather resized the partition so it will work that way. Less than 1.5 GB of the SD card is actually used.


    Then I modified the scripts slightly. And did some testing. Here are the new scripts:

    Bash: backup_sdcard.sh
    # Change sdb/sdb1 to match the device and partition with the rootfs
    
    sudo umount /dev/sdb1
    sudo dd if=/dev/sdb of=./images/MBR.img bs=512 count=4
    sudo partclone.ext4  -c -s /dev/sdb1 -O ./images/sdb1.pcl
    Bash: restore_sdcard.sh
    # Change sdb/sdb1 to match the device and partition with the rootfs
    
    sudo umount /dev/sdb1
    sudo dd if=./images/MBR.img of=/dev/sdb bs=512
    sleep 25
    sudo sync
    sleep 25
    sudo partclone.ext4  -r -s ./images/sdb1.pcl -O /dev/sdb1

    I successfully backed up a 32GB HC2 card and restored a copy to a 16GB card, and booted the HC2 from the 16GB card. So it seems to work OK.

    • Offizieller Beitrag

    ...and here is the same scripts but for a rpi4 with raspbian buster and omv 5. Again I resized the rootfs partition on my 64GB SD card to around 8 GB, so it can be restored, without any problems, to any SD card from 16GB and up.


    Also I added a tiny "backup" feature. If the images folder exists it is renamed using a timestamp, to preserve old clones. Also I am using the sd card reader of my laptop.


Jetzt mitmachen!

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