Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to move my root user's directory to a larger partition. Sometimes "he" runs out of space when performing tasks.

Here are my partitions:

host3:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1               334460    320649         0 100% /
tmpfs                   514128         0    514128   0% /lib/init/rw
udev                     10240       720      9520   8% /dev
tmpfs                   514128         0    514128   0% /dev/shm
/dev/sda9            228978900   1534900 215812540   1% /home
/dev/sda8               381138     10305    351155   3% /tmp
/dev/sda5              4806904    956852   3605868  21% /usr
/dev/sda6              2885780   2281584    457608  84% /var

The root user's home directory is /root. I would like to relocate this, and any other user's home directories to a new location, perhaps on sda9. How do I go about this?

share|improve this question
Do you need to have /root on a separate partition, or would it be enough to simply copy the contents somewhere else and set up a symbolic link? (Disclaimer: I've never tried this, but it should work.) –  SmallClanger Nov 30 '10 at 17:31
add comment

4 Answers

up vote 1 down vote accepted

You should avoid symlinks, it can make nasty bugs to appear... one day. And very hard to debug.

Use mount --bind:

# as root
cp -a /root /home/
echo "" >> /etc/fstab
echo "/home/root /root none defaults,bind 0 0" >> /etc/fstab

# do it now
cd / ; mv /root /root.old; mkdir /root; mount -a

it will be made at every reboots which you should do now if you want to catch errors soon

share|improve this answer
I have tried this and all seems to be fine so far. Thanks shellholic. –  nicholas.alipaz Nov 30 '10 at 18:34
You're welcome. But remember moving /root is a bad practice. Perhaps you could change a bit and make /home/bigrootfiles and mount/link it to some directory inside /root. If your "big files" are for some service. The best practice on Debian is to put them in /var/lib/somename –  shellholic Nov 30 '10 at 18:40
I see. Ultimately root login should not be used IMO. I guess I still might forgo moving /root entirely since it is not really very good to do. I just need to setup some new sudoer users with directories on the right partition and setup keyed authentication for better security. That would be the best solution I think. –  nicholas.alipaz Nov 30 '10 at 18:42
Perhaps make a new question describing the purpose of your case and you could come with great answers. –  shellholic Nov 30 '10 at 18:45
add comment

Never tried it, but you shouldn't have a problem with:
cd / to make sure you're not in the directory to be moved
mv /root /home/root
ln -s /home/root /root symlink it back to the original location.

share|improve this answer
add comment

You can do the following

usermod -d /home/root root
mv /root /home
share|improve this answer
Thanks, I looked up info on usermod and looks like the directory can be moved too using that command and -m option: computerhope.com/unix/usermod.htm –  nicholas.alipaz Nov 30 '10 at 17:48
This seemed to work, but doing cd ~ causes the error "-bash: cd: /root: No such file or directory". Do I need to logout/login for the new "~" to take effect? –  nicholas.alipaz Nov 30 '10 at 17:55
I would really not try that. It can be a nightmare soon. –  shellholic Nov 30 '10 at 17:56
shellholic, what is wrong with usermod? seems like the "correct" solution to moving a user's home directory in that it is modifying the user's home directory. –  nicholas.alipaz Nov 30 '10 at 17:59
I found this info somewhere else as to "why not to physically move /root", You probably shouldn't move /root to a new partition. The reason /root is put on the root filesystem is so that if there's a boot problem and Linux is unable to mount any other partitions besides the root partition, then root can still get to all his files. If /root is on a separate partition, he'll still be able to log in in that case, but won't have any access to files in his home dir. I think I may change to shellholic's solution. –  nicholas.alipaz Nov 30 '10 at 18:28
show 9 more comments
  • Boot from any available Linux LiveCD
  • mount /dev/sda1 and /dev/sda9
  • move /root content to /home
  • edit /etc/fstab to reflect changes
share|improve this answer
booting from a live cd is unfortunately not an option for a remote server, which this is the case here. –  nicholas.alipaz Nov 30 '10 at 17:54
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.