The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    Moving /home to its own partition

    Discussion in 'Linux Compatibility and Software' started by Bog, Mar 17, 2008.

  1. Bog

    Bog Losing it...

    Reputations:
    4,018
    Messages:
    6,046
    Likes Received:
    7
    Trophy Points:
    206
    I’m trying to set up my computer to dual boot Vista and Ubuntu, but in a trickier way… this is my partition set-up:

    <Vista (NTFS)> <Data (NTFS)> <Linux (ext3)> <swap (swap)>

    Basically I would like both Vista and Ubuntu (using ntfs-3g) to have access to my data partition, which will serve as my central storage space for my files. The trick is, I want Linux to treat the data partition as its /home directory so that all default save directories for applications and everything revert to my data partition instead of the root volume. I know there are some guides on the net, but I found them to be confusing. Could someone walk me through this?


    Some of the guides I found.
    http://www.funtoo.org/en/articles/linux/partitioning/1/
    http://ubuntu.wordpress.com/2006/01/29/move-home-to-its-own-partition/
    http://www.go2linux.org/how-to-move-home-directory-to-another-partition
    http://linuxmint.com/wiki/index.php/Move_home_to_its_own_partition

    Thanks for any help!
     
  2. Pitabred

    Pitabred Linux geek con rat flail!

    Reputations:
    3,300
    Messages:
    7,115
    Likes Received:
    3
    Trophy Points:
    206
    I'm not sure if that's a great idea. NTFS doesn't support the same user permissions and such that are necessary for Linux... that being said, it's not a terribly difficult procedure. The first thing you want to do is get your data partition up and mounting automatically under Linux. You have to do all the next steps as root, or use sudo in front of the commands. Have it mount at /media/data or whatever. Next step is to "cp -a /home/* /media/data" and make sure everything copies. I would then suggest doing "mv /home /oldhome" and then "mkdir /home". Then you go into your fstab, and put a line in that'll be something similar to this: "/dev/sda2 /home ntfs-3g defaults, auto 0 1". That will mount your sda2 partition as the /home directory. If all goes to plan, a reboot will have you using the data partition as your /home. I'm assuming, going off of your partition list above that sda2 is the partition that's currently the data partition. If it's not, adjust accordingly.

    Be careful doing this... there's nothing protecting the files under Windows, so you could EASILY nuke your system configuration. Keep the oldhome directory around... if something breaks, you should be able to boot into Recovery Mode under ubuntu, and then do the reverse of what we did above... remove or comment out the line in /etc/fstab (a # in front of the line comments it out), and then "rmdir /home" and "mv /oldhome /home".

    I can't guarantee you it'll work... it's an interesting experiment ;) If it's going to work, the steps I gave you are how you would do it, and how you would fix it if it doesn't work.

    Post back if you have any problems!
     
  3. Bog

    Bog Losing it...

    Reputations:
    4,018
    Messages:
    6,046
    Likes Received:
    7
    Trophy Points:
    206
    I'll try that out. Thanks!
     
  4. Bog

    Bog Losing it...

    Reputations:
    4,018
    Messages:
    6,046
    Likes Received:
    7
    Trophy Points:
    206
    Well that didn't work out well... for some reason Ubuntu failed to find my home directory; needless to say, the OS got hosed in record time. I followed these directions but I suspect I did something wrong along step 1) or 4).

    1) Get Data partition to mount automatically.
    Shouldn't it mount automatically after I first do step two?

    2) Mount Data partition at media/Data ;
    sudo mkdir /media/Data
    sudo mnt -t ntfs /dev/sda2 /media/Data


    Question: What does the -t do? Also, do I use the "ntfs" or "ext3"?

    3) Copy the /home folder to the newly mounted folder (which resides in the sda2 partition)
    sudo cp -a /home/username /media/Data

    Question: Don't I need to copy over symbolic links and all that stuff?

    4) sudo mv /home /oldhome
    Question: Which home folders do these two folders above refer to?

    5) sudo mkdir /home
    Question: Why are we doing this, out of curiousity?

    6) Open fstab, add the following:
    /dev/sda2 /home ntfs-3g defaults, auto 0 1

    Could step 6) have been the problem?
     
  5. Pitabred

    Pitabred Linux geek con rat flail!

    Reputations:
    3,300
    Messages:
    7,115
    Likes Received:
    3
    Trophy Points:
    206
    Yes, it should work after you get step two working. You need to be using ntfs-3g if you want it working read/write (which is important if you want to save things). The -t just says to mount that "this filesystem is type ntfs". You formatted the data partition as NTFS already (format it under Windows), didn't you? I thought that was implied ;) Sorry.

    What symbolic links? The /home partition should be pretty much devoid of anything special like that... it just contains the user's files. The most important part is to keep your user's home partition in it. The symbolic links will "just work" if you put everything in the right place.

    All of them? You're renaming the old home folders (since you made a copy of them earlier) as a backup.

    We just renamed the old home directory to something different, so we need to create what's known as a mountpoint, which is where you put a filesystem. since we copied the home directories to the data partition, the data partition becomes the place you keep the new home directories. Perhaps you need to do some research into what mounting really means :)

    Nope. Step 6 is the part that mounts the data partition to the /home mountpoint. It's absolutely vital to the whole process. I don't know which actual device it is, I was just guessing. What errors came up when you booted?
     
  6. bmwrob

    bmwrob Notebook Virtuoso

    Reputations:
    4,591
    Messages:
    2,128
    Likes Received:
    0
    Trophy Points:
    55
    Damn, bc, to think I feel clever just getting any Linux system up and running at all! LOL

    Good luck with this.
     
  7. Bog

    Bog Losing it...

    Reputations:
    4,018
    Messages:
    6,046
    Likes Received:
    7
    Trophy Points:
    206
    Yeah, I way in over my head in this one. I keep getting messed up with this /home, that /home, the backup /home... /etc!! ;)

    I'll try again tomorrow, too tired of Ubuntu tonight.
     
  8. bmwrob

    bmwrob Notebook Virtuoso

    Reputations:
    4,591
    Messages:
    2,128
    Likes Received:
    0
    Trophy Points:
    55
    Just noticed your User Title: excellent. [​IMG]

    Sudo install Gentoo because I'm too damn dumb

    /Runs off to Sudo install (I hope!) Slackware along with Suse/Ubuntu
     
  9. Bog

    Bog Losing it...

    Reputations:
    4,018
    Messages:
    6,046
    Likes Received:
    7
    Trophy Points:
    206
    No worries about mounting, I'm clear on that; I'm just not clear on step 5);

    sudo mkdir /home

    Where do I make this /home folder? Can you explain the purpose of this command in greater detail? :eek: Wow this is making me feel like an idiot.

    So although I mounted sda2 (I like to think of it as "plugging" it into the root filesystem), I still have to mount the newly copied /home under sda2;

    So this step lets Ubuntu find the /home folder by looking under sda2?

    My problem began when I logged in, receiving an error stating something to the effect of "/home not found, trying to log in as root." When that failed, I couldn't login at all.

    EDIT: I think I found something in this guide (the part that uses the same command as step 5):
    http://ubuntu.wordpress.com/2006/01/29/move-home-to-its-own-partition/

    It might explain the purpose of recreating the /home directory. Basically you're recreating the /home folder that was copied to the other partition, but then you are mounting the partition under the /home folder. Is that correct? So, in the end how many mountpoints are created in this setup? Three?
     
  10. Pitabred

    Pitabred Linux geek con rat flail!

    Reputations:
    3,300
    Messages:
    7,115
    Likes Received:
    3
    Trophy Points:
    206
    Exactly. And you should only be "creating" one mountpoint, /home.

    And when you "mkdir /home", that makes the folder "home" under the root "/" of the system. Hence, "/home". You can reference any folder specifically by starting it with / ("cd /etc/X11/" and whatnot).
     
  11. Solarex

    Solarex Newbie

    Reputations:
    0
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    5
    you won't need to do make the /home directory, because you had redirected it to /media/Data in the previous step.


    your account home folder is in /home. the system is looking for it at the top level of the file system. what you need to do is create a symbolic link to /media/Data.
    do this:
    Code:
    sudo ln -s /media/Data /home
     
  12. timberwolf

    timberwolf Notebook Consultant

    Reputations:
    131
    Messages:
    288
    Likes Received:
    0
    Trophy Points:
    30
    Solarex, sorry I think the symbolic link is a horrible kludge and not the right way to go about creating a new /home filesystem.

    The creation of a temporary mount point such as /mnt/newhome and then the manual mount of a new partition on to that mount point is supposed to be temporary, because the mount is only there so that data can be copied from the original /home directories to the /mnt/newhome directories.

    Once the /home data has been copied, the new partition should be umounted.

    It also worries me that much of this activity is being performed with the system running in a multi-user mode, which is not such a great idea from a data integrity point of view if you have any users logged in and updating files in their home directories!
     
  13. theZoid

    theZoid Notebook Savant

    Reputations:
    1,338
    Messages:
    5,202
    Likes Received:
    22
    Trophy Points:
    206
    LOL...hang in there Rob....no one was born a linux geek :)
     
  14. Solarex

    Solarex Newbie

    Reputations:
    0
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    5
    of course the right way is pointing /home to the new mount point in the fstab.
     
  15. theZoid

    theZoid Notebook Savant

    Reputations:
    1,338
    Messages:
    5,202
    Likes Received:
    22
    Trophy Points:
    206
    Me, I would have 4 partitions, Vista NTFS, Linux EXT3, /Home EXT3, /Data NTFS

    EDIT...the above won't work because of /Swap....maxxed at 4 partitions....you can share off your Vista partition in Linux, same thing
     
  16. Bog

    Bog Losing it...

    Reputations:
    4,018
    Messages:
    6,046
    Likes Received:
    7
    Trophy Points:
    206
    I'm trying to create a centralized setup where both operating systems can work on the same files.

    Could someone summarize the instructions please? I really appreciate your help, but I'm lost again.

    Also, after moving the /home folder to /old_home, none of my applications start, which, I think, means that I need to invoke a permanent root command (ie, switch to root instead of just using it). What command has this function?
     
  17. timberwolf

    timberwolf Notebook Consultant

    Reputations:
    131
    Messages:
    288
    Likes Received:
    0
    Trophy Points:
    30
    1. What partitions do you have? To list them type the following (note: -l is a minus sign followed by a lowercase 'L':
    Code:
    sudo fdisk -l
    2. What partitions do you have actually mounted at this point?
    Code:
    mount
    3. Have you edited /etc/fstab yet? And can we see what it looks please?
    Code:
    cat /etc/fstab
    If you have already edited the /etc/fstab to add your new partition, it would be useful if you pay extra attention to where the spaces are in the line that you added. The file format separates the data into fields using white space, so if for example you have added white space unintentionally in the wrong place it will result in more fields being present in the line than the format allows.