6

I have a 2 1.5TB drives containing numerous video, audio, documents etc that I would like to essentially mirror to 2 other drives for backup. I would like to do this using rsync (as it seems the most appropriate thing to use).

What command should I use to do so? Is there anything to be aware of when rsyncing NTFS partitioned drives/files?

EDIT: To clarify I am running NTFS formatted drives in Kubuntu 10.04 machine. I am rsync'ing the drives from here.

radman
  • 1,671
  • 3
  • 16
  • 17

5 Answers5

7

To rsync between Linux ext4/xfs and windows ntfs mounts

OR

To rsync between two ntfs mounts :

If the intent is to back-up the contents to ntfs mount using rsync and only transfer delta to ntfs partition, don't use rsync with archive (-a) option.

rsync archive is equivalent to -rlptgoD and doesn't work with ntfs partition effectively.

Instead, try:

rsync -rvh --size-only --progress /path/to/ext4/ /path/to/ntfs/

rsync -rvh --size-only --progress /path/to/ntfs1/ /path/to/ntfs2/

Example:

[ram@thinkred1cartoon ~]$ df -PhT
Filesystem                       Type      Size  Used Avail Use% Mounted on
/dev/mapper/rhel-home            xfs       192G  175G   17G  92% /home
/dev/sdb2                        fuseblk   671G  564G  107G  85% /run/media/raman/Windows7_OS
/dev/sda2                        fuseblk   1.6T  513G  1.1T  32% /run/media/raman/Seagate

rsync -rvh --size-only --progress /home/ /run/media/raman/Windows7_OS/

rsync -rvh --size-only --progress /run/media/raman/Seagate/ /run/media/raman/Windows7_OS/

Where:

-r = recursive

--size-only = skip files that matches in size

-v = verbose          (optional)
-h = human readable   (optional)
--progress = progress (optional)

Here are some more rsync hacks

Raman Kathpalia
  • 201
  • 2
  • 6
  • I used this but then found my timestamps weren't correct, so I reran it with `-t` to maintain timestamps. I also reran it with `--inplace` to attempt to avoid recopying all the data. It did seem to run much faster than the initial sync. – TheClassic Mar 30 '20 at 15:21
  • @raman-kathpalia How do you preserve permissions, timestamps, group and ownership between two NTFS partitions with `rsync` ? – SebMa Sep 24 '20 at 15:57
  • @SebMa With rsync, you can't AFAIK. Not at the time of writing this comment at least. – Raman Kathpalia Dec 30 '20 at 14:41
  • @TheClassic `-t` produces tons of errors of the form "failed to set times on..." – Michael Oct 21 '22 at 16:24
  • I think rsync with NTFS is not useful, because it cannot copy attributes, including file created date. I don't want a backup with lost all attributes. – Kamil Dec 03 '22 at 23:24
  • @Kamil rsync does not preserve the attributes when NTFS is involved. Do you know which utility offers that feature while copying from Linux Filesystem to NTFS and vice-versa? I'm still on the hunt. – Raman Kathpalia Dec 09 '22 at 22:23
  • @RamanKathpalia Yea, I just realized that. Regarding the utility that offers such feature - `tar` or `gzip` can do that, but thats not real attribute translation between diffrent filesystems. Just a box that holds them properly. – Kamil Dec 09 '22 at 23:11
6

With rsync on unix, use --archive, and don't forget the --sparse and --hard-links options. I don't know if NTFS or the NTFS driver you use (ntfs-3g or kernel) supports sparse files and/or hardlinks, but it's good practice when using rsync for backups.

Also remember that --archive doesn't do --acls and --xattrs, but with NTFS, that doesn't matter.

I don't know how different rsync behaves on a Windows system, though.

Halfgaar
  • 8,084
  • 6
  • 45
  • 86
4

If the NTFS partitions are mounted on a *NIX device, rsync is good. If you runing Windos, take a look at ROBOCOPY.EXE (included in free downloadable Resource Kit Tools, if your edition of Windows does not already have it).

rsync -a source dest

is the basic comand, but you better read carefuly the documentation and make some tests before using it as a backup strategy

lrosa
  • 1,687
  • 14
  • 15
1

http://www.microsoft.com/downloads/details.aspx?familyid=c26efa36-98e0-4ee9-a7c5-98d0592d8c52&displaylang=en - Microsoft SyncToy 2.1 is a free application that synchronizes files and folders between locations.

evg345
  • 384
  • 1
  • 4
  • 1
    SyncToy is a good tool for Windows, but the questioner is running Kubuntu. SyncToy might run in Wine on Linux; old test results https://appdb.winehq.org/objectManager.php?sClass=version&iId=19768 aren't promising, but Wine improves all the time. – skierpage Jul 03 '15 at 21:32
0

I know I am probably late to the party, but I was having this issue, but fixed it with using new options on my fstab configuration file, and after a reboot it worked flawlessly!

This is what my /etc/fstab looks like (notice noatime and big_writes):

UUID="3AEEB210EEB1C503"  /mnt/PiDrive ntfs-3g rw,auto,users,permissions,noatime,async,big_writes uid=1000,gid=1000,umask=0000 0 0
UUID="149022ED9022D550" /mnt/PiDriveBU ntfs-3g rw,auto,users,permissions,noatime,async,big_writes uid=1000,gid=1000,umask=0000 0 0

And the resync command I was using:

 sudo rsync -rvh --size-only --progress  --exclude="*.part"  /mnt/PiDrive/Hyperspin/ /mnt/PiDriveBU/Hyperspin/

I went from 20-50kb/s to 20-30mb/s!

Patrick Mevzek
  • 9,921
  • 7
  • 32
  • 43