ntfs-g3 / ntfsclone warning: careful about use of parameters in this manner.
Careful when copying or cloning using ntfs-g3 / ntfsclone command when using overwrite. In the below example /dev/sdg4 is NOT the source. It is the TARGET. 🙁
ntfsclone –overwrite /dev/sdg4 /dev/sdm1
Though nothing happened here, these were two test volumes, this is opposite to the way other commands work like cp, scp, rsync: The last entry is the target. The first entry is the source. The paramaters are modifiers on the function of the command during the operation.
In the case of ntfsclone command, the overwrite parameter takes a file as it's target completing the command but causes a reverse situation that can be potentially destructive. Hence, if you're thinking of the standard <COMMAND> <TARGET> <SOURCE> syntax, this command will not work:
ntfsclone /dev/sdg4 /dev/sdm1
It just prints the help page without indicating what's wrong. Though you might expect similar behaviour to other Linux commands. For new Linux users, this might not be a major issue but for seasoned professionals who are used to the tradtitional Linux syntax, this can be a nasty gotcha: The TARGET is not the last parameter.
[root@mbpc-pc ntfs-3g_ntfsprogs-2017.3.23]# ntfsclone –overwrite /dev/sdg4 /dev/sdm1
ntfsclone v2017.3.23 (libntfs-3g)
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 240054763520 bytes (240055 MB)
Current device size: 240054764544 bytes (240055 MB)
Scanning volume …
100.00 percent completed
Accounting clusters …
Space in use : 2346 MB (1.0%)
Cloning NTFS …
100.00 percent completed
Syncing …
[root@mbpc-pc ntfs-3g_ntfsprogs-2017.3.23]#
Though the man page hints at this:
-O, –overwrite FILE
Clone NTFS to FILE, which can be an existing partition or a regular file which will be overwritten if it exists.
someone used to the tradtitional syntax could quickly forget this overwriting their files. Hence why this version of the command will make sense given the function described in the man pages:
ntfsclone /dev/sdm1 –overwrite /dev/sdg4
Cheers,
TK