Results 1 to 4 of 4

Thread: Mounting a second hard drive for documents, pictures, and music

  1. #1
    Join Date
    Dec 2013
    Beans
    5

    Mounting a second hard drive for documents, pictures, and music

    My primary hard drive is a solid state 120 GiB with the following partitions: 1 MiB Bios Boot, 20 GiB root, 32 GiB SWAP, 68 GiB /home. I have a second hard drive that is 2 TiB that is mounted to /mnt/data currently. However, I would like the documents, pictures, music, and videos links in my file folder to be directed to that drive. Do I need to remount the drive as a /user/~ or is there a way to point those folders to this drive?

  2. #2
    Join Date
    Apr 2011
    Location
    Maryland
    Beans
    1,461
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: Mounting a second hard drive for documents, pictures, and music

    What I usually do is to create the directories on my mounted media, and then for convenience make symbolic links from those directories to /home. So, in my example, I have an external drive mounted to /media/data. The permissions should be set to my username so that I can access the data. In that directory, I create a directory like 'MyPix' and make a symbolic link to that directory in /home:

    Code:
    $ sudo chown drmrgd:drmgd /media/data
    
    $ mkdir /media/data/MyPix
    
    $ ln -s /media/data/MyPix $HOME/MyPix
    Now I can just directly store pictures on that external drive, and when I want to access the directory, I can quickly get there from /home as though the directory resides in /home. Is that what you're looking to do?

  3. #3
    Join Date
    Jun 2009
    Location
    Chicago Suburbs
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Mounting a second hard drive for documents, pictures, and music

    I do the same as drmrgd, except I use /mnt/data.
    The only possible difference is the /media mounts will show in Nautilus, /mnt will not and you have to drill down to get to them directly. But all the folders are linked so I have no reason to see the mount in Nautilus.

    If there are no duplicate names or you rename or backup & delete the existing folders with same names.

    #from home so default location of link is in /home/$USER
    # cannot have duplicate entries, so move current to temporary location, repeat for each folder you want to move.
    mv Music oldMusic
    # Music is then also the folder in the partition mounted as /mnt/data
    ln -s /mnt/data/Music
    #Or link all folders with one command:
    for i in `echo /mnt/data/*`;do ln -s $i; done

    the 'echo /mnt/data/*' just needs to be the path to your data folders. You can check just by running it
    echo /mnt/data/*
    For info on UEFI boot install & repair:
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to close thread when/if answered completely.







  4. #4
    Join Date
    Dec 2009
    Beans
    5,375

    Re: Mounting a second hard drive for documents, pictures, and music

    I have an irrational dislike for symbolic links so if you are looking for an alternative use bind.

    Let's say you have a folder in the second partition labeled Music. To temporarily bind that directory to your Music directory you can run the following command:
    Code:
    sudo mount --bind /mnt/data/Music /home/morbius/Music
    Change morbius to your own user name.

    /home/morbius/Music now displays the contents of /mnt/data/Music. To restore things to where they were unmount it:
    Code:
    sudo umount /home/morbius/Music.
    To have this happen at every boot you can do it the easy way: Place that line without sudo in /etc/rc.local - above the "exit 0" line:
    Code:
    mount --bind /mnt/data/Music /home/morbius/Music
    exit 0
    Or you can do it my way

    I set up my own Upstart job:
    Code:
    gksu gedit /etc/init/home-bind.conf
    With this content:
    Code:
    # Remount partitions with bind
    #
    description "Bind Data Partition Subdirectories to My Home Directory"
    
    start on stopped mountall
    
    script
    mount --bind /mnt/data/Music /home/morbius/Music
    mount --bind /mnt/data/Downloads /home/morbius/Downloads
    mount --bind /mnt/data/Movies /home/morbius/Movies
    end script
    Then I run the following command to execute it and make sure it works:
    Code:
    sudo initctl start home-bind
    This method insures that the bind only happens after the /mnt/data partition is mounted first.

    Symbolic links are easier to set up I just never liked them.
    Last edited by Morbius1; December 10th, 2013 at 04:26 PM.

Tags for this Thread

Bookmarks

Posting Permissions

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