1

Does what I describe below sound good?

  • I am thinking about using rsync to backup files under a directory of my Lubuntu laptop to an external hard drive.

  • I also plan to use the rsync option --link-dest to specify a previous backup on the drive so that it will create hardlinks in the new backup to unchanged files in the previous backup.

  • After finishing creating the new backup, I would like to rm -r the entire previous backup. Am I right that because unchanged files in the previous backup are hardlinked to the new backup, they are not removed and still can be accessed from the new backup?

If yes, my only concern is that my external hard drive has a file system of ntfs type. Is what I described above applicable to ntfs? Does ntfs also have the concept of hard links?

Thanks.

1 Answer 1

1

Yes, NTFS supports hard links:

Hard Links

A hard link is the file system representation of a file by which more than one path references a single file in the same volume. To create a hard link, use the CreateHardLink function. Any changes to that file are instantly visible to applications that access it through the hard links that reference it. However, the directory entry size and attribute information is updated only for the link through which the change was made. Note that the attributes on the file are reflected in every hard link to that file, and changes to that file's attributes propagate to all the hard links. For example if you reset the READONLY attribute on a hard link to delete that particular hard link, and there are multiple hard links to the actual file, then you will need to reset the READONLY bit on the file from one of the remaining hard links to bring the file and all remaining hard links back to the READONLY state.

For example, in a system where C: and D: are local drives and Z: is a network drive mapped to \\fred\share, the following references are permitted as a hard link:

  • C:\dira\ethel.txt linked to C:\dirb\dirc\lucy.txt
  • D:\dir1\tinker.txt to D:\dir2\dirx\bell.txt
  • C:\diry\bob.bak linked to C:\dir2\mina.txt

The following are not:

  • C:\dira linked to C:\dirb
  • C:\dira\ethel.txt linked to D:\dirb\lucy.txt
  • C:\dira\ethel.txt linked to Z:\dirb\lucy.txt
6
  • Thanks. Does my plan of using rsync with --link-dest referring to the previous backup to create a new backup, and then removing the previous backup, work?
    – Tim
    Jun 7, 2018 at 18:20
  • I don't believe that you can use --link-dest to a different filesystem; my understanding is that it will only work if you are rsyncing from one location to another on the same filesystem. You can't have a hardlink between two filesystems.
    – DopeGhoti
    Jun 7, 2018 at 18:26
  • the external hard drive where I plan to create a new backup also holds previous backup. So not possible to hardlink from previous backup to the new backup?
    – Tim
    Jun 7, 2018 at 18:36
  • If you are rsyncing from the backup filesysm to the backup filesystem, it should work presuming that the NTFS driver your Linux box is running understands NTFS hardlinks.
    – DopeGhoti
    Jun 7, 2018 at 19:47
  • 2
    @Tim Did you try the --link-dest option in the end? Did it work?
    – The Quark
    Jun 17, 2019 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.