How does the mv command work with external drives? On the same drive I assume it would change something like a FAT table to repoint to the location of files.

Question

When going to a different drive (maybe even partition) does the mv command first copy, then remove the old files - in order to prevent data loss if an exception occured ?
macOS's mv is based on the BSD source code. You can find the source code to the mv command online. Using https://github.com/freebsd/freebsd/blob/master/bin/mv/mv.c as a reference, you can see that they do indeed first try to rename the file and then if it is crossing filesystems, it does a cp followed by a rm.

    /*
     * If rename fails because we're trying to cross devices, and
     * it's a regular file, do the copy internally; otherwise, use
     * cp and rm.
     */
    if (lstat(from, &amp;sb)) {
        warn("%s", from);
        return (1);
    }
    return (S_ISREG(sb.st_mode) ?
        fastcopy(from, to, &amp;sb) : copy(from, to));
}