Results 1 to 9 of 9

Thread: Splitting home directory

  1. #1
    Join Date
    Jul 2011
    Beans
    Hidden!

    Splitting home directory

    Hi, I'm new to ubuntu (installed 3 days ago).

    I have two disks in my notebook - one hdd (big, 320GB) and one ssd (very fast, 120GB). Everything is on ssd now, but I want to know how can I split my home directory to make config folders (like .thunderbird, .mozilla, .purple) to use ssd (for very fast response), and put movies, pictures, downloads and other folders to use hdd (a lot of space). Simply mounting hdd as /home is not a good option, becouse config files would be on hdd also.

    Should I mount (or link) all folders like /home/username/Videos to hdd, or is there a better solution?

  2. #2
    Join Date
    Aug 2006
    Beans
    13,354
    Distro
    Ubuntu Mate 20.04 Focal Fossa

    Re: Splitting home directory

    Move all data folders from the ssd to the hdd, and then create links to them in your home folder. Creating links is easy, just right click a folder and select 'Make link'.

    Edit: If you find that the default directories are recreated on reboot, edit .config/user-dirs.dirs and comment them out.
    Last edited by mikewhatever; July 24th, 2011 at 06:27 PM.

  3. #3
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: Splitting home directory

    Yes, best option is to use a link as you suggest.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  4. #4
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Splitting home directory

    After you copy all your data folders like Music to the partition on your other drive.
    Unmount your temporary mount if it is just temporary.

    NOTE: The mount point can be anywhere. If it's in your /home or /media folders it will show up under "Places". If it's directly off "/" or /mnt it will not. I prefer /mnt so I do not see it other than thru the links.

    sudo mkdir /mnt/data
    sudo chown $USER:$USER /mnt/data
    #sudo chmod 766 /mnt/data
    #OR - The big "X" will also not make files executable unless they were executable to begin with.
    sudo chmod -R a+rwX /mnt/data
    # find your UUID
    sudo blkid
    #Edit fstab with your UUID, use ext3 or ext4 depending on format:
    gksudo gedit /etc/fstab
    UUID=a55e6335-616f-4b10-9923-e963559f2b05 /mnt/data ext3 auto,users,rw,relatime 0 2
    #Verify entry is ok, if no errors it is:
    sudo mount -a
    #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

    You can delete oldMusic after you confirm everything is ok.
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  5. #5
    Join Date
    Dec 2009
    Beans
    6,767

    Re: Splitting home directory

    My personal preference ( not that anyone's asked ) is to use bind. Probably because I share a lot of my folders with Samba across the network and Samba can't follow symlinks.

    Let's say your second disk is mounted in fstab as /Data. Then copy all of the home folders you want to /Data. Then use the following command to bind the folders in /Data back to the home folder:
    Code:
    sudo mount --bind /Data/Videos /home/morbius/Videos
    You've got 3 options to have this all happen automatically:

    [1] Stick that same expression in /etc/rc.local right above the "exit 0" line.

    [2] Back in the good old days you could add it to fstab but that doesn't work anymore - well, it works in Debian just not in Ubuntu. The syntax changes though:
    Code:
    /Data/Videos /home/morbius/Videos auto bind 0 0
    You just had to make sure you place that line after the fstab line that mounts /Data itself.

    [3] Create an upstart job that will execute the "mount --bind" only after mountall is complete. This is that way I do it these days.

    Either way you have to make sure you are auto mouning /Data in fstab.

  6. #6
    Join Date
    Jul 2011
    Beans
    Hidden!

    Re: Splitting home directory

    Thank you very much

  7. #7
    Join Date
    Mar 2011
    Location
    Goshen, IN
    Beans
    396
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Splitting home directory

    Quote Originally Posted by Morbius1 View Post
    My personal preference ( not that anyone's asked ) is to use bind. Probably because I share a lot of my folders with Samba across the network and Samba can't follow symlinks.
    In smb.conf:

    Code:
    follow symlinks = yes
    wide symlinks = yes
    unix extensions = no
    Will fix that.

  8. #8
    Join Date
    Jun 2010
    Location
    Madrid, Spain
    Beans
    27

    Re: Splitting home directory

    I have reused a 350 GiB hdd (after moving all the important files to a backup USB HDD) to introduce Ubuntu in my home main computer.

    I specifically told the installer to use some 50 GiB for "/" mountpoint (ext4), some 4 GiB for swap and the rest of it for "/home" mountpoint (ext4 as well).
    I did assume the system would place my $HOME folders and files under the "/home" mountpoint, so I kept installing applications to get the system closer to what I need.

    To my surprise, I found my $HOME folder is located in the small partition I wanted to devote for / and /boot, with almost nothing inside the equivalent folder in the bigger partition.

    I have closely followed your comprehensive explanation on how to get the system refer to the files wherever you may want the to be; however, I wonder why didn't the system perform as expected on installation time?

    I have almost no new data in the new disk: I installed Ubuntu on it last week. Of course I can follow your hints with whatever folder the system or I have created; however, isn't it a waste of time? shouldn't have the installer done it that way firsthand?

    I consider this question a no-nonsense one. Like other people here, I have inadvertently ruined a couple of systems just because I was a newbie then (more than I am now), and because user and data trees shared partition with system and boot trees. I agree with those who think having those trees in separate partitions helps you keep your system in good health.

  9. #9
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Splitting home directory

    During install I have not ticked the correct options. Are you sure you chose /home, formatted ext4?

    You can post this to quickly see what is where:

    sudo fdisk -lu
    sudo blkid -c /dev/null -o list

    mount
    sudo cat /etc/fstab
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

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
  •