Ask Your Question
0

How to change home directory location to be on HDD drive when system is installed on SSD?

asked 2014-07-10 03:32:57 -0600

Fedorian123 gravatar image

updated 2014-09-28 23:48:00 -0600

mether gravatar image

Hi, I installed Fedora 20 on SSD, and i want the home directory to be on the HDD that is also installed on the computer because i eared that SSD gets weared when writing to it.

Is ti possible to move home directory to a different drive?

edit retag flag offensive close merge delete

Comments

@Fedorian123 - I'm pretty sure a reinstall would be easiest.

abadrinath gravatar imageabadrinath ( 2014-07-10 04:21:02 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2014-07-10 04:23:07 -0600

cobra gravatar image

updated 2014-07-10 07:47:16 -0600

Yes, it's possible. The filesystem mount points are defined in the file `/etc/fstab'. Here's the process:

  1. Create the filesystem on the hard disk
  2. Log everyone off your system, drop to single user mode if necessary
  3. Log into a text console as the root user
  4. Temporarily mount your new disk to somewhere where you can write to it... mount /dev/sdb0 /mnt. Of course, you need to use the right disk id, I've suggested /dev/sdb0, but yours is likely be different.
  5. Copy all the files from your current home directory to the new one with cp -a /home/* /mnt
  6. Edit your /etc/fstab and add an entry that looks a bit like /dev/sd0 /home ext4 defaults,noatime 0 0, this line needs to be like the others in this file, check the man page for fstab with man fstab to help and guide you if you can't work it out.
  7. Reboot and try to log-in as a user

Once this is working, you can delete the old home directory data from your SSD by:

  1. Log in as root and comment out your new line in `/etc/fstab', then reboot to ensure the new filesystem is not mounted and nobody is using it
  2. Log in to the text console as root and delete the contents of the /home directory with rm -r /home/*. This should ask for confirmation of every file you remove, you can use rm -fr /home/* if you want to shortcut that. Take extra care here, though, you're deleting files with a wildcard and that's normally a bad idea.
  3. Edit `/etc/fstab' and re-enable your new line
  4. Reboot and use your system normally.

Enjoy your new home directory.

edit flag offensive delete link more
1

answered 2014-07-10 04:48:41 -0600

NickTux gravatar image

updated 2014-07-10 10:48:06 -0600

Yes it is possible, although the procedure is not recommended for novice users. You have to be very careful, because you might end without a home directory, equals to "I cannot login".

Also, inside the home directory, lots of programs store their configuration files. By moving those files to HDD might reduce the performance of those programs.

Better would be just to move Downloads / Pictures / Videos / Music ... etc folders at HDD , and create symbolic links (symlinks) to those folders on SSD.

You can do it graphical, right click cut and paste to HDD. Then right click and "make a link" , and move the link to SSD.

If you insist to move the whole home directory from SSD to HDD,

I will give instructions on how to move the whole /home/ directory to another Hard Disk after installation. You have to know that this procedure will move any other user's home directory that is listed under /home/ . Give this command to list them all ls /home/ . We will work through the terminal.

In short, the procedure is as follows:

  • Create another partition, format the partition to a Linux filesystem (ext4 preferred)
  • Create the /home/ directory
  • Copy (rsync) the old /home/ contents to the new /home/
  • Edit the /etc/fstab file
  • Backup the old home, test the new one
  • Remove the old home

More Analytical

Create another partition, format the partition to a Linux filesystem (ext4 preferred)

Install gparted . This tool will help you to create the new partition, where you will create the new /home directory.

Open gparted (needs root privileges) and create a new partition. You decide the size(the size of course should be equal of greater than the old /home/), but format the partition to ext4 filesystem.

image description

Create the new /home/ directory

Mount the new partition (we assume here is /dev/sda3) under /mnt and create the new /home/ directory

sudo mount /dev/sda3 /mnt 
sudo mkdir /mnt/home/

Copy (rsync) the old /home/ contents to the new /home/

sudo rsync -aAXv /home/* /mnt/home/

Edit the /etc/fstab file

Now, this is a very important step. Here you have to find the UUID of the new /home and add an entry to /etc/fstab/ file. If the entry is wrong, you will end up without a /home/ directory, thus "I cannot login anymore".

Find the UUID of /dev/sda3

sudo blkid /dev/sda3

copy the alphanumerical entry , without the quotes and open /etc/fstab file (as root) and create an entry there.

sudo gedit /etc/fstab

The entry should be

UUID=THE-NUMBER-HERE    /home    ext4    relatime,data=ordered,defaults    0    2

If you have already an entry for /home (the old home/) then comment the entry (do not delete it) . Place the hash mark # at the very beginning of the line.

proofread, and save the file.

Backup the old home, test the new one

Let's make a backup of the old home (just in any case) and test the new one.

sudo mv /home /old_home/ 
sudo ...
(more)
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-07-10 03:32:57 -0600

Seen: 14,766 times

Last updated: Jul 10 '14