Can cp (copy) use hard linking to save space like rsync snapshots? - Setup

This is a discussion on Can cp (copy) use hard linking to save space like rsync snapshots? - Setup ; I find file myself copy whole directories for safety sake and it takes up a lot of space. Can the copy command use hard linking to create pointers to the original files like rsync does with rsnapshot etc? /voipfc...

+ Reply to Thread
Results 1 to 9 of 9

Thread: Can cp (copy) use hard linking to save space like rsync snapshots?

  1. Can cp (copy) use hard linking to save space like rsync snapshots?


    I find file myself copy whole directories for safety sake and it takes
    up a lot of space. Can the copy command use hard linking to create
    pointers to the original files like rsync does with rsnapshot etc?

    /voipfc


  2. Re: Can cp (copy) use hard linking to save space like rsync snapshots?

    On 25 May 2007 04:58:40 -0700, voipfc wrote:

    >
    >I find file myself copy whole directories for safety sake and it takes
    >up a lot of space. Can the copy command use hard linking to create
    >pointers to the original files like rsync does with rsnapshot etc?


    Yes it can, but you don't get a redundant set of files that way

    cp -al src dest

    Grant.

  3. Re: Can cp (copy) use hard linking to save space like rsync snapshots?

    voipfc writes:


    >I find file myself copy whole directories for safety sake and it takes
    >up a lot of space. Can the copy command use hard linking to create
    >pointers to the original files like rsync does with rsnapshot etc?


    >/voipfc


    Sure but it would be idiotic. If something damages the original file it
    also damages the new file since they are the same file. The only thing the
    backup will protect you from is rm of the file.

    NOt a very good backup.


  4. Re: Can cp (copy) use hard linking to save space like rsync snapshots?

    On 25 May, 23:39, Unruh wrote:
    > voipfc writes:
    > >I find file myself copy whole directories for safety sake and it takes
    > >up a lot of space. Can the copy command use hard linking to create
    > >pointers to the original files like rsync does with rsnapshot etc?
    > >/voipfc

    >
    > Sure but it would be idiotic. If something damages the original file it
    > also damages the new file since they are the same file. The only thing the
    > backup will protect you from is rm of the file.
    >
    > NOt a very good backup.


    What I have to consider then is initially to make a full copy of the
    working directory, then make the snapshots by using that copy as the
    reference.
    In making a new snapshot the working directory would be compared the
    files against the first copy and using that as the basis for the
    hardlinking and only changed files would be copied the new directory.
    It looks to me like I am in rsnapshot territory but what I need is
    something that would use named directories, some kind of tagging,
    rather than daily, hourly, weekly etc tags used by rsnapshot.

    Is there some utility that does that?



  5. Re: Can cp (copy) use hard linking to save space like rsync snapshots?

    On 30 May 2007 07:25:37 -0700, voipfc wrote:

    >What I have to consider then is initially to make a full copy of the
    >working directory, then make the snapshots by using that copy as the
    >reference.


    Perhaps the bash script http://bugsplatter.mine.nu/misc/backup-manager
    will stimulate some ideas?

    Grant.

  6. Re: Can cp (copy) use hard linking to save space like rsync snapshots?

    Grant writes:

    >On 30 May 2007 07:25:37 -0700, voipfc wrote:


    >>What I have to consider then is initially to make a full copy of the
    >>working directory, then make the snapshots by using that copy as the
    >>reference.


    Hard links work only on the same partition. The do NOT work across
    partitions.
    And you do not use cp, you use ln
    ln file1 file2 makes file2 a hard link to file1
    But again, that leaves only one copy of the file, not two. It is NOT a
    backup.




    >Perhaps the bash script http://bugsplatter.mine.nu/misc/backup-manager
    >will stimulate some ideas?


    >Grant.


  7. Re: Can cp (copy) use hard linking to save space like rsync snapshots?

    On 1 Jun, 20:33, Unruh wrote:
    > Grant writes:
    > >On 30 May 2007 07:25:37 -0700,voipfc wrote:
    > >>What I have to consider then is initially to make a full copy of the
    > >>working directory, then make the snapshots by using that copy as the
    > >>reference.

    >
    > Hard links work only on the same partition. The do NOT work across
    > partitions.
    > And you do not use cp, you use ln
    > ln file1 file2 makes file2 a hard link to file1
    > But again, that leaves only one copy of the file, not two. It is NOT a
    > backup.
    >
    > >Perhaps the bash scripthttp://bugsplatter.mine.nu/misc/backup-manager
    > >will stimulate some ideas?
    > >Grant.


    What I have in mind is something is 4 tuple.
    a) working directory
    b) initial snapshot - local or remote, could be a previous tag
    c) target directory - local or remote
    d) tag_name (akin to date based names used by rsnapshot etc, but using
    better text descriptions.)

    The command simply copies the working directory to the target/tag_name
    directory, creating hard links to the original copy or previous copies
    if they exist. I'd prefer the original copy as the initial snapshot.

    It is something like rsnapshot but one that you can specify the
    initial copy and use a name instead of set automatically to the date.

    Are there any scripts like that? I suspect that a modification of
    rsnapshot or something similar can do that.


  8. Re: Can cp (copy) use hard linking to save space like rsync snapshots?

    Unruh writes:

    > Grant writes:
    >
    >> On 30 May 2007 07:25:37 -0700, voipfc wrote:

    >
    >>> What I have to consider then is initially to make a full copy of the
    >>> working directory, then make the snapshots by using that copy as the
    >>> reference.

    >
    > Hard links work only on the same partition. The do NOT work across
    > partitions.
    > And you do not use cp, you use ln
    > ln file1 file2 makes file2 a hard link to file1


    man cp

    If the OP wants to copy an entire tree, but wants to use hard links
    instead of actually copy the files, then use the -l switch for cp.
    (comes handy with the -a switch).

    > But again, that leaves only one copy of the file, not two. It is NOT a
    > backup.


    Yes, this is very important. The data still resides only on one
    place. If it is clobbered in the "copy", then the original is
    also clobbered.

    Vilmos

  9. Re: Can cp (copy) use hard linking to save space like rsync snapshots?

    On 11 Jun, 17:17, Vilmos Soti wrote:
    > Unruh writes:
    > > Grant writes:

    >
    > >> On 30 May 2007 07:25:37 -0700,voipfc wrote:

    >
    > >>> What I have to consider then is initially to make a full copy of the
    > >>> working directory, then make the snapshots by using that copy as the
    > >>> reference.

    >
    > > Hard links work only on the same partition. The do NOT work across
    > > partitions.
    > > And you do not use cp, you use ln
    > > ln file1 file2 makes file2 a hard link to file1

    >
    > man cp
    >
    > If the OP wants to copy an entire tree, but wants to use hard links
    > instead of actually copy the files, then use the -l switch for cp.
    > (comes handy with the -a switch).
    >
    > > But again, that leaves only one copy of the file, not two. It is NOT a
    > > backup.

    >
    > Yes, this is very important. The data still resides only on one
    > place. If it is clobbered in the "copy", then the original is
    > also clobbered.
    >
    > Vilmos


    The first copy of the working directory is not meant to use hard
    links, the copies should be full copies of the original files.

    It is the subsequent backups of the working directory that will be
    compared against the first copy and either hard links are made to them
    or copies made if they have changed.

    What I am looking for is something like rsnapshot that will allow me
    to create tagged versions without rotation that will overwrite
    previous copies versions, rather than dated versions that rotations
    will overwrite


+ Reply to Thread