LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-15-2015, 02:27 PM   #1
Germany_chris
Senior Member
 
Registered: Jun 2011
Location: NOVA
Distribution: Debian 12
Posts: 1,071

Rep: Reputation: 497Reputation: 497Reputation: 497Reputation: 497Reputation: 497
Help me with sym links


If I were to copy all of my home folders to another hard drive then created sym links to the new location all data save would go to the second drive correct?
 
Old 12-15-2015, 03:18 PM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,887
Blog Entries: 4

Rep: Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997
Consider what a "symbolic link" actually is. "It's a very-tiny disk file which has a file-name in it." When Linux sees that you've used a symlink in your file-reference, it simply grabs that file-name and substitutes it, then tries once again to find the target file or directory.

With regard to home folders, I think that a wiser approach would be to update the user-definition to point directly to the new home-folder location. I'm not persuaded that Linux will honor a symbolic reference to the user's "home." (I anticipate that it might make an exception, in the name of security ...)

As an experiment, make one dummy user, then move his home-directory, update the user to point to the new location, and verify that it worked. (The user should not be logged-on at the time.)
 
1 members found this post helpful.
Old 12-15-2015, 03:39 PM   #3
fu9ar
Member
 
Registered: Oct 2014
Location: Cyberinternetspace
Distribution: Slackware, mostly
Posts: 49

Rep: Reputation: 2
You don't want to do this. You are going to want to update your /etc/fstab so that /home is mounted from the second drive. You can copy or move the contents over to a directory, like /home.bak and then copy it in to your newly mounted /home on your second drive.

Last edited by fu9ar; 12-15-2015 at 04:04 PM.
 
Old 12-16-2015, 07:43 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,895
Blog Entries: 13

Rep: Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945
Yes, use the usermod command to alter the location of you home directory. Use the -m option so it will move your current home contents to the new location.

If you're unsure, create a test user account and perform the command to verify how things happen.
 
Old 12-17-2015, 04:54 AM   #5
Germany_chris
Senior Member
 
Registered: Jun 2011
Location: NOVA
Distribution: Debian 12
Posts: 1,071

Original Poster
Rep: Reputation: 497Reputation: 497Reputation: 497Reputation: 497Reputation: 497
so usermod -d -m then path to new drive?
 
Old 12-17-2015, 07:08 AM   #6
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,895
Blog Entries: 13

Rep: Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945Reputation: 4945
Quote:
Originally Posted by Germany_chris View Post
so usermod -d -m then path to new drive?
Yes, that is correct. As previously suggested, make a new temporary user, execute this command, and verify it operates as expected so there will be no surprises. You'll also have to use "sudo" because this should be performed as root.
 
Old 12-17-2015, 08:47 AM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,887
Blog Entries: 4

Rep: Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997Reputation: 3997
To clarify: "the path to the new home directory on the new drive."

Specify the complete path to where the home directory is now to be located.

The user should not be logged-in at the time. If so, s/he should log off and log back in.
 
Old 12-18-2015, 03:43 AM   #8
Germany_chris
Senior Member
 
Registered: Jun 2011
Location: NOVA
Distribution: Debian 12
Posts: 1,071

Original Poster
Rep: Reputation: 497Reputation: 497Reputation: 497Reputation: 497Reputation: 497
The -m option creates the new directory if there isn't one according to the man? I was going to do this last night but go distracted try to figure out why x suddenly decided it wanted to start locking up randomly
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
No CD/DVD sym links in 13.1 Woodsman Slackware 12 08-17-2011 12:36 PM
sym links and permissions emme0032 Linux - Newbie 2 11-18-2006 02:26 AM
Sym links and hard links akudewan Linux - Newbie 4 02-09-2005 05:08 AM
sym links -- RealPlayer lmellen Linux - Newbie 2 08-29-2004 02:29 PM
Sym Links and vsFTPd Datacraft Linux - Software 1 05-24-2003 05:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:42 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
Open Source Consulting | Domain Registration