Link Question - Ubuntu

This is a discussion on Link Question - Ubuntu ; I would like to make a link to my file: ~/ddrive/"My Documents"/misc/notes.txt The ddrive is on hda, my home directory is on hdb. I get the message 'invalid cross device link' so I'm assuming links don't work between drives. Is ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: Link Question

  1. Link Question

    I would like to make a link to my file:
    ~/ddrive/"My Documents"/misc/notes.txt
    The ddrive is on hda, my home directory is on hdb.

    I get the message 'invalid cross device link' so I'm assuming links don't
    work between drives. Is this so and if it is, is there a workaround.

    I think I'm giving the command correctly, ok when I tested with local
    files. Reading up on this on the web, it said that moving the link moved
    the target. This doesn't make sense, am I reading it wrong.
    Dave Cohen

  2. Re: Link Question

    Dave Cohen wrote:
    > I would like to make a link to my file:
    > ~/ddrive/"My Documents"/misc/notes.txt
    > The ddrive is on hda, my home directory is on hdb.
    >
    > I get the message 'invalid cross device link' so I'm assuming links don't
    > work between drives. Is this so and if it is, is there a workaround.
    >
    > I think I'm giving the command correctly, ok when I tested with local
    > files. Reading up on this on the web, it said that moving the link moved
    > the target. This doesn't make sense, am I reading it wrong.
    > Dave Cohen


    You cannot make a HARD link across file systems (disk partitions, or
    disks) but you can make a SOFT link. Of course, if you try to use the
    soft link and the file system it references is offline, you will
    generate a "broken link" error.

    use the command: ln -s /source-file/ /link-name/

  3. Re: Link Question

    On Sun, 11 Nov 2007 04:05:07 +0000, Dave Cohen wrote:

    > I would like to make a link to my file:
    > ~/ddrive/"My Documents"/misc/notes.txt
    > The ddrive is on hda, my home directory is on hdb.
    >
    > I get the message 'invalid cross device link' so I'm assuming links don't
    > work between drives. Is this so and if it is, is there a workaround.


    That's exactly what symbolic links are for - 'ln -s'.

    >
    > I think I'm giving the command correctly, ok when I tested with local
    > files. Reading up on this on the web, it said that moving the link moved
    > the target. This doesn't make sense, am I reading it wrong.
    > Dave Cohen


    A hard link is simply another name for the file. Either 'name' is
    perfectly valid, so moving it moves it.


  4. Re: Link Question

    Dave Cohen wrote:
    > I would like to make a link to my file:
    > ~/ddrive/"My Documents"/misc/notes.txt
    > The ddrive is on hda, my home directory is on hdb.
    >
    > I get the message 'invalid cross device link' so I'm assuming links don't
    > work between drives. Is this so and if it is, is there a workaround.
    >
    > I think I'm giving the command correctly, ok when I tested with local
    > files. Reading up on this on the web, it said that moving the link moved
    > the target. This doesn't make sense, am I reading it wrong.
    > Dave Cohen


    link from hda5 (ext3) to hda6 (fat32) works fine here:
    ln -s /media/hda6/archives arch
    link in home dir.
    --

    Xubunt6

    "Xubuntu 6 - (bubbling around, sometimes ...)."
    Less gui, less icons, more speed ... (^-^)

  5. Re: Link Question

    On Sun, 11 Nov 2007 04:15:57 +0000, Usenet Reader wrote:

    > Dave Cohen wrote:
    >> I would like to make a link to my file:
    >> ~/ddrive/"My Documents"/misc/notes.txt
    >> The ddrive is on hda, my home directory is on hdb.
    >>
    >> I get the message 'invalid cross device link' so I'm assuming links don't
    >> work between drives. Is this so and if it is, is there a workaround.
    >>
    >> I think I'm giving the command correctly, ok when I tested with local
    >> files. Reading up on this on the web, it said that moving the link moved
    >> the target. This doesn't make sense, am I reading it wrong.
    >> Dave Cohen

    >
    > You cannot make a HARD link across file systems (disk partitions, or
    > disks) but you can make a SOFT link. Of course, if you try to use the
    > soft link and the file system it references is offline, you will
    > generate a "broken link" error.
    >
    > use the command: ln -s /source-file/ /link-name/


    Thanks, read about symbolic but misunderstood. Works fine.
    Dave Cohen

  6. Re: Link Question

    Dave Cohen wrote:
    > On Sun, 11 Nov 2007 04:15:57 +0000, Usenet Reader wrote:
    >
    >> Dave Cohen wrote:
    >>> I would like to make a link to my file:
    >>> ~/ddrive/"My Documents"/misc/notes.txt
    >>> The ddrive is on hda, my home directory is on hdb.
    >>>
    >>> I get the message 'invalid cross device link' so I'm assuming links don't
    >>> work between drives. Is this so and if it is, is there a workaround.
    >>>
    >>> I think I'm giving the command correctly, ok when I tested with local
    >>> files. Reading up on this on the web, it said that moving the link moved
    >>> the target. This doesn't make sense, am I reading it wrong.
    >>> Dave Cohen

    >> You cannot make a HARD link across file systems (disk partitions, or
    >> disks) but you can make a SOFT link. Of course, if you try to use the
    >> soft link and the file system it references is offline, you will
    >> generate a "broken link" error.
    >>
    >> use the command: ln -s /source-file/ /link-name/

    >
    > Thanks, read about symbolic but misunderstood. Works fine.


    Just a short technical explanation:
    The Linux model of a directory entry is simply two items: a name and a
    number. The number actually identifies the file on the same device as
    the directory, so you might say that Linux just has files numbered and a
    directory is a convenient way to refer to files by name and not by
    number. You can have several names for the same file (called "hard
    links"), simply by having several directory entries (on the same device
    as the file) with different names but identical numbers. So each file
    has at least one hard link. A count which belongs to the file tells the
    kernel how many hard links to that file exist. If the last hard link is
    removed, the count reaches 0 and the file is removed permanently.
    Inode numbers are not unique, however, as each device has them starting
    at 1 and counting upwards, so it isn't possible to have a directory
    entry on one device refer to an inode on another device. That will
    produce the "cross device link" error message.

    Symbolic links are something entirely different. They are actually text
    files containing a single string and this string will then be used to
    continue looking for the file, so you can have symbolic links to
    directories and symbolic links to files. Unlike hard links, the
    directory entry a softlink refers to must not necessarily exist, so you
    can have "stale" or "broken" links, as Dave pointed out, or you can have
    symbolic links to something that never existed and may never exist, e.g.
    a name of a person (just "ln -s lock This_is_my_name"). That's a cheap
    way to create an identifyable lock.

    I just thought I'd point that out,

    Josef
    --
    Mails please to josef dot moellers
    and I'm on gmx dot de.

+ Reply to Thread