How to preserve soft link creation times in copy/move? - Unix

This is a discussion on How to preserve soft link creation times in copy/move? - Unix ; Greetings Wise Guys, (that is meant as compliment) We wish to migrate a filesystem from one machine (hardware RAID5 ) to another, whilst preserving everything including soft-link creation times. That is, it'd be nice. The tool we'd most likely for ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: How to preserve soft link creation times in copy/move?

  1. How to preserve soft link creation times in copy/move?


    Greetings Wise Guys, (that is meant as compliment)

    We wish to migrate a filesystem from one machine (hardware RAID5 ) to
    another, whilst preserving everything including soft-link creation times.
    That is, it'd be nice.
    The tool we'd most likely for this is rsync (we don't have any commercial
    backup tools here) or tar or some simple thing.

    Preserving everything else seems easy, but it seems impossible to copy,
    move or otherwise backup & restore soft links with their original
    timestamp.
    They always get timestamped with the right-now create time.
    touch -t doesn't seem to work (not that we'd want to hunt down
    every soft link on the new copy & do that).

    We don't want to write directory structure-modifying code to do this, we
    just want - if possible - to use rcync, tar or some such tool to copy
    stuff including soft links with their original timestamp.

    Some experimenting with tar/rsync options all fail... Google searches
    don't seem to find this answer either.

    Suggestions welcome.



  2. Re: How to preserve soft link creation times in copy/move?

    Winnie Lacesso wrote:
    >
    > We wish to migrate a filesystem from one machine (hardware RAID5 ) to
    > another, whilst preserving everything including soft-link creation times.
    > That is, it'd be nice.
    > The tool we'd most likely for this is rsync (we don't have any commercial
    > backup tools here) or tar or some simple thing.


    You are asking filesystem level tools to do something that
    resides at the inode level. In general that won't work no
    matter how much effort you put into it.

    Use a tool that works at the inode or block level - Either
    a version of dump that works that way (UFS) or do the
    migration using LVM mirroring.


  3. Re: How to preserve soft link creation times in copy/move?

    Winnie Lacesso wrote:
    > We wish to migrate a filesystem from one machine (hardware RAID5 ) to
    > another, whilst preserving everything including soft-link creation times.


    There is no "creation" time on standard UNIX filesystems, but there
    is the ctime - the inode change time, perhaps that's what you're
    referring to.

    Probably the simplest approach:
    Have the source filesystem unmounted, or mounted read-only
    Have target filesystem device of same or larger size and not mounted
    Use dd(1) to copy the data (read from source device file, write to
    target device file).
    That will create an identical filesystem for you (if the target device
    is larger, one can generally grow the filesystem to that size, if
    desired).
    Take care to change any items that should NOT be identical (e.g.
    filesystem UUID identifiers, or similar items).
    For distinct systems, the data can be piped over ssh(1), or transfered
    via other means (e.g. tape).

    Some flavors of dump/restor commands might also possibly work, but
    that was already touched upon in another post.


  4. Re: How to preserve soft link creation times in copy/move?

    >>>>> "Winnie" == Winnie Lacesso writes:

    Winnie> We wish to migrate a filesystem from one machine (hardware RAID5 ) to
    Winnie> another, whilst preserving everything including soft-link creation times.

    Since Unix has neither "soft links" nor "creation time", what is it you're
    actually trying to preserve?

    --
    Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095

    Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
    See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

    *** Posted via a free Usenet account from http://www.teranews.com ***

  5. Re: How to preserve soft link creation times in copy/move?

    In article <86wtc50xi1.fsf@blue.stonehenge.com>,
    merlyn@stonehenge.com (Randal L. Schwartz) wrote:

    > >>>>> "Winnie" == Winnie Lacesso writes:

    >
    > Winnie> We wish to migrate a filesystem from one machine (hardware RAID5 ) to
    > Winnie> another, whilst preserving everything including soft-link creation
    > times.
    >
    > Since Unix has neither "soft links" nor "creation time", what is it you're
    > actually trying to preserve?


    "Soft link" has been a synonym for "symbolic link" for as long as I can
    remember. And for all intents and purposes, the mtime of a symlink is
    the creation time, since there's no way to modify a symlink in place.

    --
    Barry Margolin, barmar@alum.mit.edu
    Arlington, MA
    *** PLEASE post questions in newsgroups, not directly to me ***
    *** PLEASE don't copy me on replies, I'll read them in the group ***

  6. Re: How to preserve soft link creation times in copy/move?

    Randal L. Schwartz wrote:
    >>>>>> "Winnie" == Winnie Lacesso writes:

    >
    > Winnie> We wish to migrate a filesystem from one machine (hardware RAID5 ) to
    > Winnie> another, whilst preserving everything including soft-link creation times.
    >
    > Since Unix has neither "soft links" nor "creation time", what is it you're
    > actually trying to preserve?


    I'm guessing what they're trying to achieve can be described like this:

    They want to be able to do this:

    touch a
    ln -s a b

    Then they want to be able to "migrate the filesystem", i.e. copy the files
    to another filesystem, and still see the same output from "ls -l b". It's
    a little distressing if you make a supposedly-exact copy of something and
    then "ls" shows that they're not really the same.

    - Logan

+ Reply to Thread