LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Create new partition and use it as a directory... (https://www.linuxquestions.org/questions/linux-general-1/create-new-partition-and-use-it-as-a-directory-16007/)

nutshell 03-11-2002 05:27 AM

Create new partition and use it as a directory...
 
Hi,

I was wondering if it's possible to create a new partition and assign one of the directories in the directory tree to use that partition. FOr example, i made a new partition, and i want to use it as /home. How do i assign /home to the new partition and delete the old /home.

Forgot to mention one thing, the above example is based on the assumption that all directories are in one single root partition...

thnx

Thymox 03-11-2002 08:31 AM

You could try mounting the new partition somewhere else, then copying everything over, editing your fstab to point to the new partition and then reboot.

e.g. (not my current system, but hey!!:

/dev/hda1 = /

I create a new partition /dev/hdb6 and what it to be /home

mkdir /mnt/newhome
mount /dev/hdb6 /mnt/newhome -t ext3
cp /home /mnt/home -R
jed /etc/fstab
#edit the fstab to include a line that mounts /dev/hdb6 as /home with ext3 filesystem
init 6


There are probably other, better ways, but I can't think of any at the moment - not at my Linux box.

nutshell 03-12-2002 04:15 AM

Hi, thnx

Can you pls give an example of how to edit the fstab to include the new '/home' ?

Aussie 03-12-2002 05:27 AM

You can even have it on a completely different hard drive, this is my /etc/fstab entry for /home,
Code:

/dev/hdb1      /home      reiserfs        defaults  1  1

acid_kewpie 03-12-2002 05:46 AM

following thymox's general (albeit highly inconsistent :D) schema, i'd just say that a few things are more water tight...

instead of the cp:

find -xdev /home | cpio -pvd /mnt/

as this will ensure that symlinks and other such hangups are copied correctly. this way means that you naturally mount your new drive as /mnt/home


All times are GMT -5. The time now is 04:18 PM.