Find the answer to your Linux question:
Results 1 to 6 of 6
Hi, I have created some links in my home directory. When I copy the folders into my USB I observe that the links are destroyed. I tried the symbolic and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2011
    Posts
    5

    symbolic links


    Hi,

    I have created some links in my home directory. When I
    copy the folders into my USB I observe that the links are
    destroyed. I tried the symbolic and the hard links.

    Is there a way I can keep the links as they are in my home
    directory?

    regards.

  2. #2
    Just Joined! ShadowCat8's Avatar
    Join Date
    Sep 2005
    Location
    San Gabriel Valley, CA
    Posts
    10
    Well,

    I think the issue here is what flags/options are you throwing at 'cp'?

    Are you just using?:
    Code:
     ~ $ cp -R /home/<home dir> /media/usb/
    Or have you been using?:
    Code:
     ~ $ cp -a /home/<home dir> /media/usb/
    Snippets from the man page:
    Quote Originally Posted by man cp
    ...
    -a, --archive
    same as -dR --preserve=all
    ...

    -d same as --no-dereference --preserve=links
    ...

    --preserve[=ATTR_LIST]
    preserve the specified attributes (default: mode,ownership,time-
    stamps), if possible additional attributes: context, links,
    xattr, all
    ...
    HTH. Let us know.

  3. #3
    Just Joined!
    Join Date
    Aug 2011
    Posts
    5
    Hi,

    thanks for your replay.
    I tried what you suggested but it didnt work.
    In my directory called "test" I have
    several files which are linked. What I want is that after I
    transfer the "test" directory in the USB I can still have the
    links. For instance if I type "cd media/USB/test" and made
    modifications to the files in "test" folder (but within the USB)
    I can have the same links as in my hard disk.

    by using cp -a I get:
    cp: cannot create symbolic link `/media/41C7-78EF/test_link/others/pointer': Operation not permitted

    regards.
    Last edited by armando_2011; 09-02-2011 at 07:41 PM.

  4. #4
    Just Joined!
    Join Date
    Apr 2011
    Posts
    19
    I don't know for sure, but I am thinking FAT filesystems do not support sym links, and the USB is probably a FAT filesystem, so the O/S cannot create one.

  5. #5
    Just Joined! ShadowCat8's Avatar
    Join Date
    Sep 2005
    Location
    San Gabriel Valley, CA
    Posts
    10
    Quote Originally Posted by armando_2011
    by using cp -a I get:
    cp: cannot create symbolic link `/media/41C7-78EF/test_link/others/pointer': Operation not permitted
    I think that mstabie might be right on this one. I have tried just creating symlinks from the following mounted filesystems: FAT16 and FAT32. They both give the above error. So, that being said, let's see how we can deal with this... As a note, a locally mounted NTFS filesystem seems to support symlinks.

    Now, if you have to have symlinks from the drive pointing to the system as well as have the USB drive be addressable by both linux and windows boxes, that would require reformatting the USB drive as NTFS. If it doesn't need to be addressed by a Windows OS, then just reformat the USB drive as ext2/ext3 and continue your copying with the '-a' flag.

    As a note, if you want symlinks in windows, there is a way of getting them:

    From the Sysinternals section of Microsoft's TechNet:
    Quote Originally Posted by Mark Russinovich
    ... Directory symbolic links are known as NTFS junctions in Windows. Unfortunately, Windows comes with no tools for creating junctions—you have to purchase the Win2K Resource Kit, which comes with the linkd program for creating junctions. I therefore decided to write my own junction-creating tool: Junction.
    If you want to use Junction, you can get it at technet.microsoft.com/en-us/sysinternals/bb896768 (Sorry. This board won't let me post full URLs yet.)

    HTH. Let us know.

  6. #6
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Good tip on Junction.

    Also, if you go the format-usb-disk-with-ext2/3 route, then there are many ways you can access that filesystem in Windows:



    I've used all three with varying degrees of success.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •