Backup Linux Folder manually with rsync to external NTFS Disk
Mostly external disks are usually formatted with NTFS to be ready to use on Windows. For backups usually rsync is a convenient tool since it can detect same files and shows progress. But if you want to rsync with NTFS on linux there are maybe some pitfalls.
First of all you need to mount your disk after plugging in. You can find your disk with:
fdisk -l | grep NTFS
If you have multiple disks just unplug your disks and replug it and find out the newly appearing disk e.g. /dev/sdb1
.
Mount it with:
mkdir /mnt/ntfs-disk
mount -t ntfs /dev/sdb1 /mnt/ntfs-disk
Open a tmux session, which enables you to move the process in the background also if you disconnect from the server:
tmux
Copy your contents with following rsync command (dry-run with -n
flag possible)
rsync -rvh --info=progress2 --size-only /home/johnny/Videos /mnt/ntfs-disk
This command with copies all files with -r
recursively, shows it human readable with -h
and verbose information with -v
. Additionally --info=progress2
shows the overall progress including overall time left. --size-only
copies only files where the size is not matching e.g. the file was not copied already or was modified (possible overwrite!). The directory Videos
is copied with its contents to /mnt/ntfs-disk
.
Now you can detach your tmux session by typing ctrl+b
and d
. Now you can disconnect you ssh session if you are logged in with one.
If you want to connect again - just look for your tmux session and connect again (my session was 0
):
tmux list-sessions
tmux attach-session -t 0
If you are finished you can rerun the above rsync command again if you want to check - it should abort immediately if no file modification were done in the meantime.
Afterwards you need to unmount your disk:
umount /mnf/ntfs-disk
This following command should not show you a mount point for your disk:
lsblk | head -1 && lsblk | grep sdb
Now you can safely unplug your disk and your are finished.
Congratulations!
Sources:
https://serverfault.com/questions/151986/rsync-command-to-synchronize-two-ntfs-drives/895072#895072
https://linuxconfig.org/how-to-mount-partition-with-ntfs-file-system-and-read-write-access