The correct way to move /home to another partition on linux

0

I've moved /home to a separate partition, this involved creating and mounting the new partition, copying the old home directory over to the newly mounted one, editing fstab to mount the new partition as /home on boot. This has worked great for my admmin account but not for the other user accounts.

I copied like so

http://embraceubuntu.com/2006/01/29/move-home-to-its-own-partition/

mv /home /old_home

mv /new_home /home

I then made sure that ls -l was the same for home as old_home

I think it may be to do with the edits to /etc/fstab only mounting the partition for the user I edited it as

edits below:

/dev/sdb1      /home            ext4    nodev,nosuid      0       2,

My guess would be the options nodev, nosuid but without knowing what to change this to im reluctant to make further edits.

Any suggestions ?

Luke

Posted 2011-12-16T21:27:36.413

Reputation: 119

In what way does it not work for the other accounts? – None – 2011-12-16T21:30:40.753

1How have you copied /home? And what do you mean by "doesn't work for other users"? (and btw this should go to serverfault) – None – 2011-12-16T21:32:26.783

how is it a server fault ? Im talking about a netbook, and a partition of an SSD ? – None – 2011-12-16T21:34:56.097

@ChrisDodd When logging in as a user that doesn't have admin priveleges the menu doesn't populate, you can't browse to /home – None – 2011-12-16T21:37:58.870

@fge updated question with how I copied files – None – 2011-12-16T21:42:36.417

1@fge it should go to unix. – Kevin – 2011-12-16T21:44:55.290

@Luke Did you copy the files as root (for instance, sudo cp ...) or as a regular user? – Jonathan Callen – 2011-12-16T21:51:07.253

as root, i also chmod'd the permissions to fstab as root, granting write whilst I made the edit then revoking it afterwards. – None – 2011-12-16T21:52:57.733

Answers

0

The cp command doesn't copy hidden files (i.e. files that begin with .) so this will cause a big issue as all of the .bashrc and any other settings (e.g. .vimrc, .screenrc, .dircolors, etc) will be lost.

You could try doing the following from the home directory:

tar cpf - . | (cd /new_home; tar xf -)

which would transfer all file including the hidden ones and retain all permissions of the files and folders.

Daemon of Chaos

Posted 2011-12-16T21:27:36.413

Reputation: 178

I'm sorry I actually did $cd /home/ $find . -depth -print0 | cpio --null --sparse -pvd /mnt/newhome/ I couldn't ind the page i referenced so went back through the terminal history and must have identified the wrong line, having moved to my PC i browsed back to the guide here

– Luke – 2011-12-16T23:07:50.460

its working ok for my account but not for the existing user accounts, I've deleted these (there was only 2) and recreated a new user and the problems appear to be the same – Luke – 2011-12-16T23:59:28.193

I formatted the HDD and used the above bash commands when copying the directory to the new partition. so far its been ok. Thanks – Luke – 2011-12-18T01:55:01.920