Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 03-11-2002, 06:27 AM   #1
Registered: Feb 2002
Distribution: Slackware 8.1
Posts: 244

Rep: Reputation: 30
Create new partition and use it as a directory...


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...

Old 03-11-2002, 09:31 AM   #2
Senior Member
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Mostly Debian based systems
Posts: 4,368

Rep: Reputation: 63
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.
Old 03-12-2002, 05:15 AM   #3
Registered: Feb 2002
Distribution: Slackware 8.1
Posts: 244

Original Poster
Rep: Reputation: 30
Hi, thnx

Can you pls give an example of how to edit the fstab to include the new '/home' ?
Old 03-12-2002, 06:27 AM   #4
Senior Member
Registered: Sep 2001
Location: Brisvegas, Antipodes
Distribution: Slackware
Posts: 4,590

Rep: Reputation: 56
You can even have it on a completely different hard drive, this is my /etc/fstab entry for /home,
/dev/hdb1       /home      reiserfs        defaults   1   1
Old 03-12-2002, 06:46 AM   #5
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982
following thymox's general (albeit highly inconsistent ) 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


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
create a directory in C++ poeta_boy Programming 15 11-02-2011 02:53 PM
Using partition magic to create Linux partition then install EviLBoX Linux - General 5 09-12-2008 06:01 AM
How to resize a partition and create/mount a new partition? Maarten_Holland Linux - Newbie 1 04-20-2005 09:56 AM
Can't create new directory!!?? catty Linux - Newbie 7 10-06-2003 06:33 PM
Create a directory SnowSurfAir Linux - Software 15 07-21-2003 07:12 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:12 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