billw2 / rpi-clone

A shell script to clone a booted disk.
BSD 3-Clause "New" or "Revised" License
2.56k stars 333 forks source link

rpi-clone to img file #6

Open dmezzogori opened 10 years ago

dmezzogori commented 10 years ago

Is it possible to use rip-clone to write not to an sd-card but to a img file (perhaps created with dd)? If so, how to?

ozett commented 9 years ago

hi. also a feature-request: maybe you change your scprit to rsync backups over the net/lan to a central rasperry-backupserver? i find your script juseful. thanx a lot..

hominhquan commented 9 years ago

For exporting to img, dd can do the stuff :

(sudo) dd if=<your_sd_disk> of=/path/to/your/img bs=1M
llimz commented 7 years ago

+1 for this feature request.

gamade commented 7 years ago

+1

I worked on a litte script and I used loopback devices. It would be very nice, because you can deal with image files with all advantages... and if you need a "real" clone you dd the file to a sd-card.

jtmoderate876 commented 6 years ago

+1 for ability to write to an image file while ignoring open/temp files and also truncating to a small file.

DiscoFever78 commented 3 years ago

+1 for image file support.

rfv-370 commented 3 years ago

+1 for image file support!

saaibo commented 1 year ago

Is it possible to use rip-clone to write not to an sd-card but to a img file (perhaps created with dd)? If so, how to?

Hi all,

I believe this could be possible with small changes to rpi-clone, but I do not have enough knowledge, I'd probably mung it.

What I've done so far:

Here's the output:

 Initializing
  Imaging past partition 1 start.
  => dd if=/dev/mmcblk0 of=/dev/loop0 bs=1M count=8 ...
  Resizing destination disk last partition ...
    Resize success.
  Changing destination Disk ID ...Re-reading the partition table failed.: Invalid argument

  => mkfs -t vfat -F 32  /dev/loop01 ...
  => mkfs -t ext4  /dev/loop02 ...

Syncing file systems (can take a long time)
Syncing mounted partitions:
  Mounting /dev/loop02 on /mnt/clone
mount: special device /dev/loop02 does not exist
    Mount failure of /dev/loop02 on /mnt/clone.
Aborting!

Script's trying to operate on partitions /dev/loop0[12], while loopback calls them this way (a "p" between device's name and partition no.):

Device       Boot  Start      End  Sectors  Size Id Type
/dev/loop0p1        8192   532479   524288  256M  c W95 FAT32 (LBA)
/dev/loop0p2      532480 25199999 24667520 11.8G 83 Linux

I can guess two solutions: having loopback not to insert that letter, or make rpi-clone loopback aware. Is any viable?

TIA, cheers!