0

I have two hard drives. Both are FireCudas, "half ssd, half hdd". One has 1TB of space and the other, with my Manjaro on it, has 480GB. Up until now (for 2 years) i have not used the second drive, however since my install is pretty fresh, i thought i'd get around to it. Currently the 1TB only has a lost+found dir and is otherwise empty. I want to somehow have my /home folder (I assume that's where all personal junk is) on the second drive along with documents, games on steam, pictures and all the junk. Is that even possible? Is reinstalling every program necessary? How would i go about this, i assume a lot of programs just use /home/me so all would have to change to /db/home/me (/db is where my 1TB is mounted)

4
  • You could change your home directory to the second hard drive but you would have to take some steps to do so, firstly the second hdd would have to be mounted and have an active /etx/fstab entry. once this is sorted out and done you can then use vipw and vipw -s to edit your users home directory, vipw is the command to edit the passwd file and vipw -s is for the shadow file. Directly editing the files can cause corruption so it's best to use these commands.
    – programmer
    Jan 15, 2020 at 22:53
  • @Qasim I have edited the fstab file and i believe its all working. Will editing the uder home dir with vipw just create a new /home or copy the existing files? Will there be problems with programs trying to acces the old /home? Jan 15, 2020 at 22:58
  • Whever you start a program, they go to the passwd and shadow files to get user details such as gid, uid and home directory etc. so it wont be a problem. Also sid you use my answer or did you think of doing this before I commented? Just asking because then I can write an actual answer.
    – programmer
    Jan 16, 2020 at 6:57
  • Nope didnt know this command. Please do write an answer. Sorry for the late response, it was kind of a weird time here. Jan 16, 2020 at 7:29

2 Answers 2

0

This is very possible indeed, if you want to make your home directory, firstly you should ensure you have a active fstab entry to automatically mount the second hard drive upon system boot, you can learn to do this by reading this useful article, https://ask.fedoraproject.org/en/question/62643/code-to-edit-fstab-file

Now once the drive is mounted and the fstab entry has been tested now you can change your home directory to the second drive, you will need to edit the /etc/passwd and /etc/shadow files.

/etc/passwd is a file which stores important information on all users of the system such as GID, UID, Usernames, Names, DOB and home directories etc. Many programs use this file to obtain data and infromation on users to effectively start and sustain what it needs to do.

/etc/shadow is a file which stores basic infromation on each users too, but it mainly stores encrypted user password, this file is not available to users without sudo privileges.

To edit these files you MUST use the vipw command, this command allows you to edit the shadow and passwd files in a way where a temporary copy which you are editing is stored in the /tmp directory, this ensures that the actual /etc/passwd or shadow file isnt edited directly, in order to avoid corruption to the files, changes are only made if each entry is correct and everything goes smoothly.

vipw is used to edit /etc/passwd safely

vipw -s is used to edit /etc/shadow safely.

Once you have made the changes to the home directory sections of each files you can reboot with the sudo reboot command and then type cd and pwd to see if the directory is what you wanted it to be.

Remember you must edit both files to make sure consistency is kept between files because both of them work together at times. If the passwd file is edited the shadow file must also be edited with the same changes.

=-)

2
  • Thanks a lot! I will update if anything goes wrong. Right now though i have trouble here :/ superuser.com/questions/1518046/… Jan 17, 2020 at 16:49
  • hmm I'll try help out in the mean while can you click the grey tick next to my answer near to top If it helped
    – programmer
    Jan 17, 2020 at 18:21
0

The question is a bit old, but... From what I understand, this is a single-user system. The currently accepted answer is perfect to use the second HDD for /home/me only, but a much simpler solution would be to mount it on /home. This requires altering /etc/fstab only, and not fiddling with vipw.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .