From f6b91abe3a3b4d79d4072d30c1c35a3da42fe5d5 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Sun, 18 Mar 2018 20:53:50 +0100 Subject: [PATCH] Add oflag=sync to the dd command line Using only `status=progress conv=fsync` will result in a seemingly very fast copy, much faster than the write speed of the SD card, followed by a long delay as the data is actually written to the SD card. Using `status=progress conv=fsync oflag=sync` will show a slower progress, roughly matching the write speed of the SD card, but once it is done the command will complete immediately. I think the second approach is more intuitive and less likely to cause users to think the copy is hung. --- installation/installing-images/linux.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/installation/installing-images/linux.md b/installation/installing-images/linux.md index 86bfb2ea04..27e51f97f8 100644 --- a/installation/installing-images/linux.md +++ b/installation/installing-images/linux.md @@ -20,7 +20,7 @@ - In a terminal window, write the image to the card with the command below, making sure you replace the input file `if=` argument with the path to your `.img` file, and the `/dev/sdX` in the output file `of=` argument with the correct device name. **This is very important, as you will lose all the data on the hard drive if you provide the wrong device name.** Make sure the device name is the name of the whole SD card as described above, not just a partition. For example: `sdd`, not `sdds1` or `sddp1`; `mmcblk0`, not `mmcblk0p1`. ```bash - dd bs=4M if=2018-03-13-raspbian-stretch.img of=/dev/sdX conv=fsync + dd if=2018-03-13-raspbian-stretch.img of=/dev/sdX bs=4M conv=fsync oflag=sync ``` - Please note that block size set to `4M` will work most of the time. If not, try `1M`, although this will take considerably longer. @@ -33,7 +33,7 @@ In Linux it is possible to combine the unzip and SD copying process into one com The following command unzips the zip file (replace 2018-03-13-raspbian-stretch.zip with the appropriate zip filename), and pipes the output directly to the dd command. This in turn copies it to the SD card, as described in the previous section. ``` -unzip -p 2018-03-13-raspbian-stretch.zip | sudo dd of=/dev/sdX bs=4M conv=fsync +unzip -p 2018-03-13-raspbian-stretch.zip | sudo dd of=/dev/sdX bs=4M conv=fsync oflag=sync ``` ### Checking the image copy progress @@ -42,7 +42,7 @@ unzip -p 2018-03-13-raspbian-stretch.zip | sudo dd of=/dev/sdX bs=4M conv=fsync - To see the progress of the copy operation, you can run the dd command with the status option. ``` - dd bs=4M if=2018-03-13-raspbian-stretch.img of=/dev/sdX status=progress conv=fsync + dd if=2018-03-13-raspbian-stretch.img of=/dev/sdX bs=4M status=progress conv=fsync oflag=sync ``` - If you are using an older version of `dd`, the status option may not be available. You may be able to use the `dcfldd` command instead, which will give a progress report showing how much has been written. Another method is to send a USR1 signal to `dd`, which will let it print status information. Find out the PID of `dd` by using `pgrep -l dd` or `ps a | grep dd`. Then use `kill -USR1 PID` to send the USR1 signal to `dd`.