0

The SD Card Copier application allows the Raspbian system running on the SD card to clone itself to a usb storage (mostly another SD card), without the need to shutdown the system and remove the SD card to copy it. I would like to use the SD Card Copier application to clone the system to a virtual hard disk file on a network drive, instead to a usb storage. I can successfully create a 8 GB image file on a network drive and then mount it as a loop device in /mnt/vhd (or /media/pi/vhd) with the following commands

sudo mkdir /mnt/drive/
sudo mount -t cifs -o <options> //networkdrive/raspi/ /mnt/drive/
dd if=/dev/zero of=/mnt/drive/pi.img bs=1G seek=8 count=0
mkfs.ext4 /mnt/drive/pi.img
sudo mount -o loop /mnt/drive/pi.img /mnt/vhd/

However the mount does not appear as a target for SD Card Copier. How could I make the virtual hard drive being a possible target for SD Card Copier ? It seems to me that drives are possible targets if and only if they show up in the ejection panel, so another way to ask the question would be how to make the virtual hard drive showing up in the ejection panel ?

Configuration is Raspbian Stretch on a Pi 3.

  • I doubt this is possible, unless you modify the program. Why do you want to do this if you have an image - use dd or a program like Etcher – Milliways Aug 1 '19 at 4:54
  • You have created an image file with a filesystem (ext4) stored on a network share. Now you want to clone it with SD Card Copier. To what do you want to clone it? What's the destination? A SD Card? – Ingo Aug 1 '19 at 14:24
  • @Ingo I want to clone from SD card to virtual disk without removing the SD card from the Raspi, like the SD Card Copier does. So I can easily backup one or several Raspis without the need of many SD cards. I should remove "clone the system from a virtual disk" in the question, because it is confusing. – hello world Aug 2 '19 at 3:22
  • Yes, please edit your question and add the information you have given in the comment. It is not the right place. Are you sure that SD Card Copier can clone a running system? Usually there has to be taken additional effort to get a consistent image with no modified files during the time the backup is done. – Ingo Aug 2 '19 at 10:57
  • Not that it necessarily will solve your problem, but necessary to solving it: When you mount an entire image file, that effectively makes it a mounted partition, even if it is not formatted in any way. Notice you could NOT do this with the actual SD card (mount the entire card as one partition -- or at least, you could not do it respecting the formatting of the card) because it isn't a partition, it's a device with two partitions in it. You can mount either or both of those, but the card as a whole is not a parallel entity to what you have at /mnt/vhd... – goldilocks Aug 2 '19 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.