Trying to move Documents Folder via Symbolic Link Problem

Discussion in 'OS X' started by sng08, Sep 16, 2010.

  1. macrumors member

    Joined:
    Aug 30, 2010
    #1
    Hi all,

    I've just recently received my new iMac 27" i7 and have the SSD + HDD option, where the SSD contains OS + Applications and the HDD contains data. I read that moving the whole Home folder was not a good idea, therefore, I wanted to just move my Documents, Pictures and Download folder to the second internal HDD. I read an article/tutorial how to do this and this is what I followed (using Terminals):

    Code:
    cp -Rp ~/Documents /Volumes/Macintosh Data HD
    chmod -R -N ~/Documents
    rm -rf ~/Documents
    ln -s /Volumes/Macintosh Data HD/Documents ~/Documents
    
    However, when I try and type the symbolic link I get the error:
    Code:
    "ln: Documents: No such file or directory"
    Because of this, the Documents folder on the Dock appears with a big question mark as it cannot locate the new Documents folder.

    Any ideas how I can get the link working or if not try and restore the original documents folder and just move the entire Home folder over to the Hard Disk data drive?

    Many thanks in advance!

    (note: I don't have any documents in the folders as of yet so I haven't lost any important info!)
     
  2. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #2
    Those spaces in "Macintosh Data HD" seem like a very bad idea. In Terminal, enter

    Code:
    cd /Volumes; ls -la
    (lowercase L after the ; and after the hyphen)

    Post the output.
     
  3. thread starter macrumors member

    Joined:
    Aug 30, 2010
    #3
    Hi, thanks for the quick reply. Below is the output:

    Code:
    cd /Volumes; ls -la
    
    total 8
    drwxrwxrwt@  6 root     admin   204 17 Sep 01:23 .
    drwxrwxr-t  30 root     admin  1088 15 Sep 16:54 ..
    drwxr-xr-x   1 SimonNg  staff  4096 16 Sep 12:21 BOOTCAMP
    drwxrwxr-x   9 SimonNg  staff   374 17 Sep 00:26 Macintosh Data HD
    lrwxr-xr-x   1 root     admin     1 17 Sep 01:23 Macintosh HD -> /
    drwxr-xr-x   1 SimonNg  staff  4096 16 Sep 14:45 Windows Data HD
    
     
  4. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #4
    In Terminal,

    Code:
    cd /Volumes/Macintosh*Data*HD; ls -la
     
  5. thread starter macrumors member

    Joined:
    Aug 30, 2010
    #5
    Result:

    Code:
    cd /Volumes/Macintosh*Data*HD; ls -la
    total 16
    drwxrwxr-x  9 SimonNg  staff   374 17 Sep 00:26 .
    drwxrwxrwt@ 6 root     admin   204 17 Sep 01:23 ..
    -rw-r--r--@ 1 SimonNg  staff  6148 17 Sep 00:46 .DS_Store
    drwx------  3 root     staff   102 16 Sep 12:35 .Spotlight-V100
    d-wx-wx-wt  3 root     staff   102 17 Sep 01:24 .Trashes
    drwx------  5 root     staff   170 17 Sep 01:17 .fseventsd
    drwxr-xr-x@ 3 SimonNg  staff   102 17 Sep 00:31 Documents
    drwxr-xr-x@ 3 SimonNg  staff   102 16 Sep 22:38 Downloads
    drwxr-xr-x@ 3 SimonNg  staff   102 16 Sep 22:41 Pictures
    
     
  6. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #6
    OK, there's a directory named Documents where you copied it to.

    In Terminal, enter

    Code:
    cd ~; ls -la
     
  7. thread starter macrumors member

    Joined:
    Aug 30, 2010
    #7
    Result:

    Code:
    cd ~; ls -la
    total 24
    drwxr-xr-x+ 14 SimonNg  staff   476 17 Sep 01:24 .
    drwxr-xr-x   5 root     admin   170 15 Sep 15:29 ..
    -rw-------   1 SimonNg  staff     3 15 Sep 15:29 .CFUserTextEncoding
    -rw-r--r--@  1 SimonNg  staff  6148 17 Sep 00:32 .DS_Store
    drwx------   2 SimonNg  staff    68 17 Sep 01:24 .Trash
    -rw-------   1 SimonNg  staff  2140 17 Sep 01:55 .bash_history
    drwx------+  3 SimonNg  staff   102 15 Sep 15:29 Desktop
    drwx------+  5 SimonNg  staff   170 16 Sep 22:17 Downloads
    drwx------+ 30 SimonNg  staff  1020 15 Sep 17:15 Library
    drwx------+  3 SimonNg  staff   102 15 Sep 15:29 Movies
    drwx------+  4 SimonNg  staff   136 16 Sep 20:59 Music
    drwx------@  6 SimonNg  staff   204 16 Sep 22:41 Pictures
    drwxr-xr-x+  5 SimonNg  staff   170 15 Sep 15:29 Public
    drwxr-xr-x+  5 SimonNg  staff   170 15 Sep 15:29 Sites
    
     
  8. macrumors 6502a

    Angelo95210

    Joined:
    Jan 7, 2009
    Location:
    Paris, France
    #8
    I just moved my entire home folder and I find it to be the perfect solution. There is no worries with this, it's even a recommended practice for linux users. Only precaution is to let one user on the main partition in case of failure.
     
  9. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #9
    OK, the original Documents folder is indeed removed and the name is available. In Terminal, let's try again:

    Code:
    ln -s /Volumes/Macintosh*Data*HD/Documents  ~/Documents
     
  10. thread starter macrumors member

    Joined:
    Aug 30, 2010
    #10
    Hi LPZ. I think it worked! The big black question mark on the documents folder has disappeared and it links to the second HD. Excellent. Thank you so much for your help!

    So to move the folder, the symbolic link requires the * to denote a space?
    Also, is it worth moving that folder back to the home and just move the entire HOME folder over or just individually move folders that I require over to the second internal hard drive?
     
  11. thread starter macrumors member

    Joined:
    Aug 30, 2010
    #11
    Sorry to be a pain, but to clarify the terminal code for moving the folder should be:

    Code:
    cp -Rp ~/Documents /Volumes/Macintosh*Data*HD
    chmod -R -N ~/Documents
    rm -rf ~/Documents
    ln -s /Volumes/Macintosh*Data*HD/Documents ~/Documents
     
  12. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #12
    Glad it worked. The * will match any string of characters, so in particular it matches a single space character. My strong advice is to avoid names that contain space characters. Use something like MacintoshDataHD or Macintosh_Data_HD and problems like this are avoided.

    Instead of using the * in the Terminal commands, you should be able to use the space characters, provided you precede each with a \

    So the following should work:

    Code:
    cp -Rp ~/Documents /Volumes/Macintosh\ Data\ HD
    chmod -R -N ~/Documents
    rm -rf ~/Documents
    ln -s /Volumes/Macintosh\ Data\ HD/Documents ~/Documents
    Not sure which option is better, if either.
     
  13. macrumors 6502

    Joined:
    Jun 22, 2006
    #13
    Actually, '*' is used as a wild card character in most shells to replace any number of characters. The correct way would be to tell bash shell that there is a literal space between the words by escaping the space. Otherwise bash reads it as another argument to the preceding command.

    string1\ string2
    ..denotes that string1 and string2 are actually one string containing the space character. Analogue, you can escape any special character if need (i.e. \* = literal * and not the wildcard mentioned above)
     
  14. thread starter macrumors member

    Joined:
    Aug 30, 2010
    #14
    Thank you so much for your help guys. I'm slowly starting to understand the whole symbolic link idea in terminal...(I think!)

    I've managed to move the necessary folders over to the second internal HD and I believe are all operational.

    Although one last query if I may: Within my Home directory I still see the Documents/Downloads/Pictures folders except with a small arrow on the bottom left corner which leads to the actual folder on the second HDD (thus creating a symbolic link). Although I thought with the "rm -rf ~/Documents" command I deleted the folder? I shouldn't really be concerned as it's a link to the actual folder rather than a folder which holds data? Thanks.
     
  15. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #15
    Code:
    rm -rf ~/Documents
    removed the original Documents directory from your Home directory.
    Code:
    ln -s /Volumes/Macintosh*Data*HD/Documents ~/Documents
    created a symbolic link named Documents in your Home directory; this symbolic link item is displayed by OS X as a folder with a small arrow in the corner. There is no Documents directory/folder in your Home folder. You can verify this by entering

    Code:
    cd ~; ls -l
    in Terminal. A line that begins with a "d" is a directory; a line that begins with a "-" is a file; a line that begins with an "l" is a link, as in this snippet:

    Code:
    drwxr-xr-x   2 root   staff    68B Dec 10  2008 libxslt-plugins
    -rwxr-xr-x   1 root   staff   240K Dec 10  2008 libxslt.1.1.22.dylib
    lrwxr-xr-x   1 root   wheel    20B Feb  8  2009 libxslt.1.dylib -> libxslt.1.1.22.dylib
    There's nothing for you to be concerned about.
     
  16. macrumors newbie

    Joined:
    Apr 23, 2011
    #16
    Undo symbolic link??

    So this method worked for me. I just partitioned my HD and linked folders over.

    HOWEVER, i liked my desktop to the partitioned HD and causes problems, saying "operation can't be completed"

    SO, what do i have to do to undo the symbolic link i created??


    Thanks in advance
     
  17. macrumors 68040

    plinden

    Joined:
    Apr 8, 2004
    #17
    Code:
    unlink <sym link>
    where <sym link> is the name of the link, not the file being linked to.
     
  18. greenland, Apr 23, 2011
    Last edited: Apr 23, 2011

    macrumors newbie

    Joined:
    Apr 23, 2011
    #18
    I don't understand. I'm getting this response:
    -bash: syntax error near unexpected token `newline'

    This is what i typed in to create the link

    cp -Rp ~/desktop /Volumes/Files
    chmod -R -N ~/desktop
    rm -rf ~/desktop
    ln -s /Volumes/Files/desktop ~/desktop
     
  19. plinden, Apr 23, 2011
    Last edited: Apr 23, 2011

    macrumors 68040

    plinden

    Joined:
    Apr 8, 2004
    #19
    You must have made a typo - what did you type in the unlink?

    The Desktop folder starts with 'D' not 'd' - presumably that's a typo too?

    Edit: by the way, when you get rid of the link, logging out and back in again should rebuild your Desktop folder and you can bring the files back. As mentioned earlier in this thread, you'd be better to move your whole home directory.
     
  20. macrumors newbie

    Joined:
    Apr 23, 2011
    #20
    Yes, that was a typo - should be a capital D
    I just deleted both symbolic links (after moving everything to a temp folder). Logged back in and copied the old desk top items back.

    I guess i could create symbolic links of individual folders on my desktop to the other driver, a pain yes, but that's the only other option i see (other than as you suggested - moving Home dir)

    thanks for your help
     
  21. macrumors member

    sambuev

    Joined:
    May 28, 2011
    Location:
    TO,ON,CA
    #21
    Hello guys, I have MacBookPro 17,2001 with 128 SSD (from Apple) and another second hard drive on Optibay - 750GB.

    Please can you show me, how can I move my
    1. Documents
    2. Downloads
    3. Music
    4. Movies
    5. Pictures
    6. Sites

    to another hard drive.

    [​IMG]

    Can you give me a Terminal commands?
    Thank you!
     
  22. macrumors newbie

    Joined:
    Jun 29, 2010
    #22
    error after symlink?

    Hello,

    Being a newbie at Terminal, I have no idea what I'm doing. Thought everything went well but when clicking on symlink, I get

    "The operation can’t be completed because the original item for “Documents” can’t be found." error.

    Any help is appreciated!
     

Share This Page