1

I want to use the following command:

sudo dd if=/dev/mmcblk0 of=/mnt/myBackup.img bs=1M

What if the USB drive was formatted to vfat?

1

Yes, you can create a backup with that command.

The filesystem doesn't matter as long as it supports file of the required size.

The maximum file length with VFAT is 4GiB. If your SD card is larger than 4GiB, you can still create a backup to a VFAT file system, but you have to split it into multiple files.

sudo dd if=/dev/mmcblk0 bs=1M | split -b 2G /mnt/myBackup.img

You can modify the file names created by split, for details see the man page.

| improve this answer | |
  • So EXT4 would work even if the boot partition is VFAT? – Lana.nl Oct 27 '19 at 19:42
  • The dd command doesn't care about the content or the file system. You only need enough space on the target file system, and if necessary you split the files. So you can backup everything to an EXT4 file system. – RalfFriedl Oct 27 '19 at 19:47
1

You can use any filesystem, including vfat, that is able to store a file, as described by @RalfFriedl in his answer. But if you use the simple dd command you have noted you will not get a consistent backup of your running system. Executing the command takes time and while this time many dynamic files will change on the disk that will be stored at different times. You do not have a snapshot with all file contents at the same time. If you restore this backup it will not run because the dynamic system files does not fit together.

You have to take additional effort to avoid this inconsistencies. The simplest is to boot your system with read only disk access just only for the backup. You can also use rsync as answered to Can a Raspberry Pi be used to create a backup of itself? or you can take snapshots with LVM that you can backup using the simple dd command you have noted.

| improve this answer | |
  • If you restore this backup it will not run because the dynamic system files does not fit together. I've successfully booted plenty of backups using an image created while the host was running. – Botspot Oct 27 '19 at 22:27
  • @Botspot Good luck! You should never ignore all warnings on the web about doing this. – Ingo Oct 28 '19 at 9:22
0

You could do this, BUT I wouldn't. It will produce a large backup, and running dd on a live image is not a good idea.

You can't use vfat but could use any format which allows large files and is supported by Pi (e.g. exFAT) although ext4 is recommended. The split technique suggested by RalfFriedl would work

I would suggest you look at How to shrink the image of my working Raspbian SD Card which is the technique I use; it produces compact backups which can be efficiently updated (although I do this on a network drive)

You may want to look at the answer Periodic backup of Rpi3 Stretch SD card which examines the merits of different backup strategies.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.