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?
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
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.
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.
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.