Complete the code to create a backup of the Raspberry Pi SD card using the dd command.
sudo dd if=/dev/mmcblk0 of=[1] bs=4M status=progress
The dd command copies the entire SD card to the specified image file. Using /backup/pi_backup.img saves the backup in the backup folder.
Complete the command to restore the Raspberry Pi SD card from a backup image.
sudo dd if=[1] of=/dev/mmcblk0 bs=4M status=progress
The input file (if=) should be the backup image file to restore from. /backup/pi_backup.img is the correct backup image path.
Fix the error in the command to compress the backup image using gzip.
gzip [1]The gzip command compresses files. You must specify the backup image file, not a device or directory.
Fill both blanks to create a script that checks if the backup file exists and then copies it to a USB drive.
if [ -[1] /backup/pi_backup.img ]; then cp /backup/pi_backup.img [2]/pi_backup.img fi
-f which checks if it is a regular file but might fail if symbolic links exist.The -e flag checks if the file exists. The USB drive is mounted at /media/usb to copy the backup.
Fill all three blanks to create a Python dictionary comprehension that maps filenames to their sizes only if size is greater than 1000 bytes.
sizes = { [1]: [2] for [3] in files if os.path.getsize([3]) > 1000 }os.path.getsize correctly.This comprehension creates a dictionary where keys are filenames and values are their sizes, filtering only files larger than 1000 bytes.