LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-06-2019, 04:53 PM   #1
edjenn1998
LQ Newbie
 
Registered: Jul 2019
Posts: 12

Rep: Reputation: Disabled
Question Mount second drive and move Home to second drive


I installed a second drive into my laptop. Iím running Pop_OS 19-04. I want to mount the drive and move home folder to the second drive so that putting files into pictures, download or documents will be stored on second drive. Without having to manually moving them from one drive to the other. This is a new install. So no personal files in folders yet.

1- where do I mount the drive at. Do I mount it in / ? Or create another folder and mount it there?

2- how do I move the home folder so that my files are stored on the second drive.

Iíve found instructions on the internet but many show different ways and are old so something could have changed.
 
Old 07-06-2019, 05:12 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,146

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
is that even Linux?

https://www.maketecheasier.com/move-home-folder-ubuntu/
 
Old 07-06-2019, 08:38 PM   #3
X-LFS-2010
Member
 
Registered: Apr 2016
Posts: 423

Rep: Reputation: Disabled
I would tell you to back up your /home but it appears that's what your doing?

TELL ME YOUR NOT attempting to mv(1) your only copy of /home. please!

do not mv(1) files, cp(1) them then delete them only if that succeeds (don't say i didn't warn you)

and do always have a backup (or two - three total is the standard for personal creations like term papers)

you can mount the 2nd disk anywhere under / you like: however i warn you - do not use linux symlinks especially not between the drives. don't say i didn't warn you!

(/ is like a config of your whole disk(s) system - if you change where that is then all symlinks point wrong. be careful with /)

# mkdir /mnt/d2
# mount /dev/borphee /mnt/pheebor
# cp -a /home/ /mnt/d2/home

it's a common newbie mistake to end up copying the contents of home into /d1 (no home directory) instead of the directory home (so /d1/home/ exists). check and see which you got after you do it.

now didn't i mention / is not something trivial? well. ALL YOUR SOFTWARE including libc and utils has static strings pointing you home to /home - so it does have to be in /. you can make a softlink to make /home point to the other disk but DO NO, because not all software does that correctly.

so you can mount /d12/home into / and even have /etc/fstab do that automagically (which i also denounce as something you wish you hadn't done)

so you are left with that you have to do:

## after copying files, and if you don't keep /d1 (one)/home as your backup

# mkdir /home

now in /etc/ "somewhere" (depends on nix distro) there are "startup scripts". one of them is responsible for doing all default mounting work (and this is going to be one of them!)

SO THERE IS SOMETHING ELSE TO CONSIDER

if you ever somehow put a file needed for startup under /home/where needed during booting you won't be able to boot

if you mount the /d1 in a rescue and you have essential files in /home/ you won't even be able to chroot(1) to d1.

why is because your / doesn't really contain /home anymore

there is good news. having followed advice your /home in / is "still real", it's just empty, and that will be good enough for most software unless you make unwise changes (so don't configure any startup file to look for files in /home since during startup it is empty)

also note you may not be able to chroot into /d1 now if your a "normal user" because your /home/my directory isn't there until after mounting. well. that makes using /etc/fstab for automounting attractive? no that's a mess. you can't unmount ever (without rebooting) if you do that. and if you chroot - well when you chroot there is no automount of, ie, /proc or what - so if things are in /home you still can't get in as a normal user.

STILL FEEL LIKE MOVING /HOME ??

have fun
 
Old 07-06-2019, 08:40 PM   #4
X-LFS-2010
Member
 
Registered: Apr 2016
Posts: 423

Rep: Reputation: Disabled
if i could ask you to remember 1 thing above it would be:

do not use linux symlinks, not unless your sure you'll be deleting in in a few mintues
 
Old 07-06-2019, 09:26 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 15,443
Blog Entries: 25

Rep: Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447
Quote:
Pop_OS 19-04
is that even Linux?
PopOS is a System 76 spin of Ubuntu.

As if the world needed yet another *buntu.
 
Old 07-07-2019, 11:54 PM   #6
New World Man
LQ Newbie
 
Registered: Nov 2017
Posts: 15

Rep: Reputation: Disabled
I would copy them first. Better yet, two copies of /home ( makes the next part easier and less dangerous ) one copy to the second hd, a second copy to a different directory anywhere. Go in to the file ( as root ) /etc/fstab and create an entry for /home pointing to the second hd. Reboot. If it is all there, remark out the entry you just made in /etc/fstab - reboot - un-remark entry in /etc/fstab - delete contents of /home but leave the directory /home ( all files and directories in it, but not itself ) - re-boot. That should do it.
 
Old 07-08-2019, 08:32 AM   #7
hazel
Senior Member
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 3,391
Blog Entries: 9

Rep: Reputation: 1895Reputation: 1895Reputation: 1895Reputation: 1895Reputation: 1895Reputation: 1895Reputation: 1895Reputation: 1895Reputation: 1895Reputation: 1895Reputation: 1895
What exactly are you envisioning? Do you want a complete home directory on your second drive? If so, it will eventually be mounted on $HOME, i.e./home/your_user_directory. For the copying operation, you should mount it temporarily on /mnt or a subdirectory of /mnt.

Or do you want a data directory where you can keep personal files but not necessarily your configuration files? If you are dual-booting more than one Linux distro, that can be useful. I have a home directory on each of my Linux partitions for config files and a common data directory for personal data files mounted on /home/data.

Remember too that mounting a disk does not destroy any files in the directory used as the mount point. They merely become invisible for the duration. So if you want a complete home directory, you can copy over all the files in your present one, then mount the copy on $HOME and check it out. When you unmount it again, your old files will still be there as an extra backup. Only destroy them when you are sure it is safe.

In the old mainframe days when disks were tiny by modern standards, sysadmins often had to hive off data to a new disk to make space. They would copy a branch of the filesystem tree to the new disk and then mount it over the original to test it. Usually they added a marker file to one of the two so that they always knew which one they were using. You could do the same.

Last edited by hazel; 07-08-2019 at 08:38 AM.
 
Old 07-08-2019, 09:46 AM   #8
edjenn1998
LQ Newbie
 
Registered: Jul 2019
Posts: 12

Original Poster
Rep: Reputation: Disabled
I followed the instructions in the article that BW-userx posted. So far that seems to be what I want.

What I want is to use my second drive for personal files and time shift. I want to be able to drop files in my folder such as music, documents and so forth, and them to be stored on my second drive. I do not want to have to manually move them to the second drive. I want it to be seem less. I want programs to be stored on the first drive. So far, from what I can tell after following the instruction in the article. This is how it is working. When I copies music files in the music folder space was used up on the second drive, and as I installed programs, space was used up on the first drive. I can also tell the times gift is storing snapshots on the second drive. Time shift is not backing up my home folder.
 
Old 07-08-2019, 09:54 AM   #9
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,146

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Basically when installing ones system this is what is called spiting the system, where one has one partition as / (root) and another for /home and any other ones for a data storage. unless one is running a server.

Then it might be logical to split the system up into a hdd for each main dir if wanted, in leu of partitions even, and, or even into each sub dir separately. Which of course can get complicated as @hazel pointed out to give just some of what one can do with there system in splitting it up. of course this too can be done after a system is installed.

as far as timeshift, I'd create another partition just for that, or put it off board onto a separate external hdd.

Last edited by BW-userx; 07-08-2019 at 09:57 AM.
 
Old 07-08-2019, 10:50 AM   #10
edjenn1998
LQ Newbie
 
Registered: Jul 2019
Posts: 12

Original Poster
Rep: Reputation: Disabled
Thank you all for your input. I find this site a great help.

I’ve dabbled with Linux in the past but always ran into issues of not getting something to work. However, it seems, here lately, that Linux has come a long way. A while back I installed Linux Mint and was really impressed. It felt polished and worked. However, Linux gives way too many options for everything. So many distros. I’ve been downloading and installing different distros. Seeing what feels more comfortable. I find myself leaning toward Gnome 3 with a lot of extensions. I picked Pop_OS (System 76 distro that they came up with for their computers)because it is a descendant of Debian (through Ubuntu) and uses Gmone 3. Although Debian just released Buster. I’m tempted to just start over and install Debian 10 Buster. But I’m afraid it will be difficult to get it set up correctly. Anyhow thank you all for your time and input.
 
  


Reply

Tags
drives, home directory


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Fstab fails to mount second hard drive to /run/media/$USER: "mount point does not exist". MurderousMincePie Linux - Newbie 3 10-10-2017 06:41 AM
contents of 'home' directory found at sda5: mounted as /home, and also on sda6:/home leswatson Linux - Newbie 4 04-18-2008 04:02 PM
How to view/mount separate disk -- move /home to second disk Spearhead40 Ubuntu 12 11-03-2007 03:37 PM
second hard drive wont let me create or move files? peterbug Linux - Hardware 6 08-14-2007 12:37 PM
Mount. Umount. Mount. Umount. Mount. Umount. Mount.. cwizardone Slackware 10 03-22-2007 09:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration