Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-19-2008, 11:41 AM   #1
Registered: Aug 2007
Posts: 47

Rep: Reputation: 15
Red face removed by mistake /home any possibility to get it back?

newbie mistake

using the following instructions, I tried to move /home to a separate partition in a) Jacklab 1.0 which is based on Suse 10.2 and b) in Centos5.

The instructions following a thread by Stewe W on 03-12-08, Member

Registered: Mar 2007
Distribution: Ubuntu 7.10, Knoppix 5.1.1
Posts: 53

are by Randux post #2 the following:

Sorry but as I cannot find the #2 answer to that which is by Randux any longer to copy and paste I will type it from my printed copy of May 11, 2008 . I copy hopefully without mistakes:

As root:

mkdir /mnt/hda8 (hda is only used as an example)
mount -w /dev/hda8 /mnt/hda8
rsync -axv /home/ /mnt/hda8/
umount /dev/hda8

Now update /etc/fstab to look something like:

/dev/hda8 /home ext3 defaults 1 2

then as root:
mount /dev/hda8 /home

make sure it worked:


You should see something like this:

/dev/hda8 on /home type ext3 (rw)

Well this is the first part, the formation of new /home on /dev/hda8.

The second part is deleting the original /home from root:

umount /dev/hda8
rm -rf /home
mkdir /home
chmod 755 /home
mount /dev/hda8

I tried the above on system a) Jacklab i.0 but made some mistakes. The new /home on /dev/hda8 was formed with about 470MiB of files but due to my mistakes later both it and the original root /home dissapeared.So I cannot boot any longer.

I tried the same on system b) Centos5 and I was succesful. The new /home was formed, with about 177MiB of files and I am able to boot. I could not delete the old house though as I was told that it is busy. I logged in as root to do that. Not that bad.

Now checking the files in Jacklab 1.0 with Gparted livecd I noticed that they are almost the same size before and after the /home deletion.5.03GiB
before to 4.94GiB after. Considering that 470MiB is the transferred /home
I thought that they might be "hidden" somewhere and if there is a slight possibility of resurrecting them.

Hence my question.

Thank you,

Old 05-19-2008, 01:22 PM   #2
Registered: Aug 2007
Posts: 47

Original Poster
Rep: Reputation: 15
Here I found it! and I coppy and paste the part that I copied only:03-12-08, 02:00 PM #2
Senior Member

Registered: Feb 2006
Location: Siberia
Distribution: Slackware. What else is there?
Posts: 1,326

Originally Posted by Steve W View Post
I'm looking for the best way to set up my /home directory on a separate partition to my root directory. This setup is widely recommended for any Linux distro and I understand the reasons why. I've been researching how to do this, in Linux magazines and on the internet, but I'm getting more and more confused as to the way it should be done.

Part of the problem is that some methods go into detail about creating and formatting the partition itself, as well as copying the /home directory over. This does not apply in my case as I already have a spare 17Gb partition formatted as ext3. I just need to get my stuff over and tell the system this is where my new /home is located.

Could someone please go into detail as to the exact terminal commands I will need to do this? From the different methods outlined on the internet, it seems to be done using a variety of weird and wonderful commands such as rsync and other; some just use "mv".

There is also the question of whether I need to amend fstab to take account of the new location. One method detailed in a Linux magazine makes no mention of fstab at all; is it necessary to amend it or will Ubuntu just locate and pick up the /home directory automatically?

For instance, here is one method detailed in a magazine. It assumes all your stuff is currently on hda1, and you want your new home partition to be hda2:

mkdir -p /mnt/{root,home}
mount /dev/hda1 /mnt/root
mount /dev/hda2 /mnt/home
mv /mnt/root/home/* /mnt/home/
rm -fr /mnt/root/home/*

And that's it. No mention of fstab at all. Would this work in those five lines?

Obviously, I could just try it and see, but without knowing exactly what is going to happen, I don't want to risk messing up my system as it is now...

Could someone please advise whether I should go ahead using the above method, or do they have a better way?

Steve Wylie

Hi Steve,

If you want to use the whole 17G as your home you can do something like this. Supposing your new partition is /dev/hda8 for example:


As root:

mkdir /mnt/hda8 # make a temp mountpoint for new /home
mount -w /dev/hda8 /mnt/hda8 # mount the new /home r/w
rsync -axv /home/ /mnt/hda8/ # copy everything from /home
# note trailing '/' must be present!
umount /dev/hda8 # don't need new /home at the moment

Now update /etc/fstab to look something like:


/dev/hda8 /home ext3 defaults 1 2

then as root:


mount /dev/hda8 /home

make sure it worked:



You should see something like this:


/dev/hda8 on /home type ext3 (rw)

Check your files under /home to make sure everything's ok. If not, stop, go back, and find your mistake (or mine).

If everything worked your new /home is operational and you can delete home from the / partition. As root:


umount /dev/hda8 # temp unmount real /home
rm -rf /home # delete old /home under /
mkdir /home # someone else can probably do this simpler
# maybe just cd /home and rm -rf * but I tremble whenever I do
# rm * so I would do it in the steps I outlined here
chmod 755 /home # make sure perms are correct
mount /dev/hda8 # real /home now activated

If not, DO NOT delete (rm) anything until you've figure what you've done wrong (or what mistake I made here!)
Shape up, man- you're a Slacker! Do you want to be a Slacker for the rest of your life? -- Principal Strickland, BACK TO THE FUTURE!
Last edited by Randux : 03-12-08 at 02:13 PM.
Randux is offline
Tag This Post No tags yet, please tag this post - what is this?
Your Tags:
Report this post



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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get back removed files? sacoskun Linux - Newbie 19 01-23-2007 12:45 AM
removed libstdc++-4.0.0-8 big mistake? ginda Linux - Software 6 01-03-2006 06:25 AM
Mistake configuring X Window System; how do I get back to terminal? audiorevolution Debian 6 05-22-2005 02:06 AM
'Accidentally' removed XFree86-libs, how can I bring back the desktop? freddan Fedora 3 03-22-2004 08:56 AM
removed dockapps icons and wmconfig icons by mistake ethereal Linux - General 1 09-04-2003 04:54 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration