Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

While installing Linux, it asks for a 'mount point' selection. I gave it /, but I don't know the exact meaning and aim of this.

Also, now I want to create one more mount point, /home in my machine with the already installed Linux with mount point /. Is it possible to do that from my current Linux install? If yes, what are the steps/commands?

My understanding of 'mount point' is, when I need to preserve my /home contents in a safer way that it wont get deleted if my current Linux get corrupted. For example, by detaching and connecting the hard disk from the machine with corrupted Linux to a new Linux machine, I should get my /home content

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

The mount point specifies at which location in the directory hierarchy a device or disk partition appears.

If you want to move /home to a new partition, you have to create a new partition for it, say /dev/sda4 and format it, e.g. with ext4. Creating partitions and formatting them can be comfortably done using e.g. gparted.

Then you have to copy the old contents to the new partition and modify /etc/fstab so /home points to the new partition. As root do something like this after having the partition created and formated. Again I assume /dev/sda4 for the partition, this is just an example and you have to use your real partition device:

$ mkdir /mnt/tmphome
$ mount /dev/sda4 /mnt/tmphome
$ cd /home/
$ find . -depth -print0 | cpio --null --sparse -pvd /mnt/tmphome/
$ umount /mnt/newhome
$ mv /home /old_home
$ mkdir /home
$ mount /dev/sda4 /home

Now check if your system is still working correctly. If it does, add a line like this to /etc/fstab:

/dev/sda4 /home ext4    defaults        1 2

and delete the backup in /old_home

if however you find that something went wrong, you can move back by not adding respectively removing the above line in /etc/fstab and doing as root

$ umount /home
$ rmdir /home
$ mv /old_home /home

This answer is inspired by the howto on http://embraceubuntu.com/2006/01/29/move-home-to-its-own-partition/

share|improve this answer
    
Then you are telling that, if i connect my hard disk to another Linux machine, i will get all my ' /home ' contents in /dev/sda4 partition ? –  Renjith G Oct 18 '10 at 9:19
    
/dev/sda4 is just an example. It's not clear to me, what you mean with "if i connect my hard disk to another Linux machine, i will get all my ' /home ' in /dev/sda4" –  fschmitt Oct 18 '10 at 9:39
    
Yes. I got your point about /dev/sda4. Suppose my machine got corrupted(lets say the LINUX itself). I want to get all the data from that machine. The data is in the hard disk right? I have kept all the data in my '/home/renjithg' directory. On corruption of the LINUX in my machine probably would cause its home to corrupt right? So i will not get that data under /home on connecting the hard disk to another machine right? To avoid that , If i have mounted that '/home' earlier then then i would get that data under /home if i connect my hard disk to another Linux machine? –  Renjith G Oct 18 '10 at 9:54
    
A broken Linux distribution should not destroy your data. This is very, very unlikely. In 99% of all cases, you can boot a Live-CD, mount your partitions and you data is accessible, even if your installation is broken and e.g. doesn't boot anymore. Whether /home is on the same partition as / is not really relevant for this. –  fschmitt Oct 18 '10 at 11:04
    
What happens if my machine is not having a CD ROM? –  Renjith G Oct 18 '10 at 11:08
show 3 more comments

Your Answer

 
discard

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.