LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Mount second drive and move Home to second drive (https://www.linuxquestions.org/questions/linux-newbie-8/mount-second-drive-and-move-home-to-second-drive-4175656978/)

edjenn1998 07-06-2019 04:53 PM

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.

BW-userx 07-06-2019 05:12 PM

is that even Linux?

https://www.maketecheasier.com/move-home-folder-ubuntu/

X-LFS-2010 07-06-2019 08:38 PM

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

X-LFS-2010 07-06-2019 08:40 PM

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

frankbell 07-06-2019 09:26 PM

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.

New World Man 07-07-2019 11:54 PM

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.

hazel 07-08-2019 08:32 AM

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.

edjenn1998 07-08-2019 09:46 AM

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.

BW-userx 07-08-2019 09:54 AM

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.

edjenn1998 07-08-2019 10:50 AM

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.


All times are GMT -5. The time now is 12:59 AM.