I'm currently trying to understand some code I have found which unmounts a drive but then does operations onto it (which seems quite strange to me).
The situation is as follows: I have a mount named /dev/sda1 which points to a local hard drive.
Then I have the command
unmount /dev/sda*. Next is a command that unzips a file and pipes the result to a ntfsclone:
ntfsclone -r -O /dev/sda1 -
After this there is another
unmount /dev/sda*. followed by a dd with the output file being the same folder again:
dd of=/dev/sda count=1 bs=.....
So in total its:
unmount ntfsclone unmount dd
all going onto /dev/sda1.
What I'm not understanding here is what is really happening there. I get that the ntfsclone is used to create a clone of the image of the hard drive while dd is used to (re)create the boot partition. What I don't get is the possible reason behind the umounts. Which is in essence my question here:
What are the umounts for / what are they doing there / how does it affect the operations there (as they are going onto unmounted devices as far as I understand the operations there)?
Note I only put in the parameters and codeparts I think are necessary to see what the commands do (thus the dd naturally also has a if parameter, ... .