Here's a another way to 'move' the '/home' directory.
In the following example the 'manual' creation of a separate '/home' partition in also _not_ required at initial installation of the *nix OS. At some point, a one-time '/etc/fstab' configuration of (in this example) the '/data' partition _is_ require but can be done at anytime prior- or post-install of most any *nix OS install. (I mostly use 'gparted' to create partitions [GParted in the GUI menu]). What follows is the assumption that the '/data' partition has _already_ been properly created, configured in '/etc/fstab', and successfully mounted at boot up.
With that typed, my 'home' directory(ies) is/are _always_ ultimately positioned on a separate partition on /dev/sdaX or different hard drive (/dev/sdbX, or /dev/sdcX, or /dev/{wherever}) i.e., somewhere other than it's default '/home' position. Here's what I do...
On any new or existing hard drive I always leave enough room to create as large a partition as possible called: '/data' <== The partition name is totally arbitrary, of course!
Code: Select all
somename - # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 24G 6.3G 16G 29% /
udev 3.0G 12K 3.0G 1% /dev
tmpfs 1.2G 1.1M 1.2G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 3.0G 344K 3.0G 1% /run/shm
/dev/sda7 902G 471G 386G 55% /data
The procedure:
After a sucssesful install of whatever Linux distro, I enable 'root's' password (temporarily). Open a 'Terminal' window and do:
Code: Select all
someuser@somename ~ $ sudo passwd root
[sudo] password for someuser:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Next. Logout of X and at the resulting GUI login screen I do the keystrokes: 'Ctrl+Alt F2' . You should now be at a black screen that looks something like this:
Code: Select all
Linux Mint 13 Maya somename tty2
somename login:
At the prompt, login as 'root' .
Code: Select all
somename login: root
Password:
Last login: Fri ... .. 09:..:.. CDT 2012 on tty2
Welcome to Linux Mint 13 Maya (GNU/Linux 3.2.0-23-generic-pae i686)
Welcome to Linux Mint
* Documentation: http://www.linuxmint.com
somename ~ #
Once logged in as 'root' do the following at the prompt:
Change to the '/' directory:
'
cd /'
Move the existing '/home' directory to '/data'
'
mv home /data/'
Code: Select all
somename ~ # mv home data/
`home' -> `data/home'
Create new
symbolic link to '/data/home' in '/'
'
ln -s /data/home' <== NOTE:
No forward slash ('/') after '/data/home' !
Check you new symbolic link is correct. If your result looks like this you're good(!):
Code: Select all
somename / # ls -ld home
lrwxrwxrwx 1 root root 9 ... ... home -> data/home
--Or--
Another example of the 'mv'. In a current installation of LM 13 Maya MATE my 'mv' command was:
'
mv home /data/mate_home'
'mate_home' could also be (in no particular order): 'cinnamon_home' or 'debian_home' or 'kde_home' or xfce_home'... I think you get the idea!
The symbolic link:
ln -s /data/mate_home home'
After creating the symbolic link, a 'ls -l' from commandline in the root ('/') directory shows this:
Code: Select all
somename / # ls -l
total 100
drwxr-xr-x 2 root root 12288 Oct 4 17:47 bin
drwxr-xr-x 3 root root 4096 Oct 4 17:56 boot
drwxr-xr-x 9 root root 4096 Aug 14 17:27 data
drwxr-xr-x 16 root root 4320 Oct 12 13:56 dev
drwxr-xr-x 164 root root 12288 Oct 12 13:58 etc
lrwxrwxrwx 1 root root 15 Aug 14 17:28 home -> /data/mate_home
drwxr-xr-x 23 root root 4096 Oct 2 00:17 lib
drwx------ 2 root root 16384 Jun 13 11:23 lost+found
drwxr-xr-x 3 root root 4096 Oct 12 13:57 media
drwxr-xr-x 5 root root 4096 Oct 4 17:26 mnt
drwxr-xr-x 5 root root 4096 Oct 5 10:53 opt
dr-xr-xr-x 170 root root 0 Oct 12 08:56 proc
drwx------ 23 root root 4096 Oct 11 20:26 root
drwxr-xr-x 25 root root 1000 Oct 12 13:56 run
drwxr-xr-x 2 root root 12288 Oct 8 11:11 sbin
drwxr-xr-x 2 root root 4096 Mar 5 2012 selinux
drwxr-xr-x 2 root root 4096 Apr 23 06:34 srv
drwxr-xr-x 12 root root 0 Oct 12 08:56 sys
drwxrwxrwt 11 root root 4096 Oct 12 13:57 tmp
drwxr-xr-x 10 root root 4096 Apr 23 06:34 usr
drwxr-xr-x 12 root root 4096 Oct 12 13:47 var
somename / #
Looks good!
Reboot.
Log into 'X' as usual.
In a 'Terminal' window and running the 'pwd' command should give you:
Code: Select all
pwd
/home/someuser
pwd -P
/data/home/someuser
--Or--
Code: Select all
pwd
/home/someuser
pwd -P
/data/mate_home/someuser
depending on which one of the move examples was used? Otherwise, the access to the '/home' directory is transparent.
Don't forget to disable 'root's' logon when satisfied all is well. Open a terminal window:
Code: Select all
someuser@somename ~ $ sudo passwd -d -l root
[sudo] password for someuser:
passwd: password expiry information changed.
someuser@somename ~ $
Done.
NOTE: I've used this technique for years. It's always worked.
.