LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 03-21-2005, 01:51 PM   #1
Jukas
Member
 
Registered: Mar 2005
Posts: 141

Rep: Reputation: 15
Seperate Partitions for /usr & /home?


I'm fairly new to linux and I've tried a couple different distro's and I think I've settled on Debian as my prefered one. I did a hdd install from Knoppix 3.7 and I have two hard drives in my system.

The first is a 4gb hdd partitioned to a 3.5b for the system and 500mb for the swap file. The second is a 20gb.

How can I have the /usr and /home directories go to the 20gb partition instead of the 4gb system partition? I think from my reading I would have to change the mount points in the /etc/fstab file but can you tell me if the below syntax would be correct?

/dev/hdb1 /mnt/home ext3 noauto,users,exec 0 0

If not, what would be the correct syntax?
 
Old 03-21-2005, 02:43 PM   #2
mjuhannus
Member
 
Registered: Sep 2004
Location: Finland
Distribution: Ubuntu 10.04, Debian 5, OpenSUSE 11.3
Posts: 60

Rep: Reputation: 15
I don't really know if it will work not to mount those directories later on different partitions. Usually you should configure the partitions during the installation. I think fresh install would be best because your /usr/ won't have any files on it if you mount a different partition as /usr/, and you really have lots of important stuff on that directory.

But to be honest I don't really know if it would work to just copy everything from your current /usr/ to the new partition and then mount the new one as /usr/. In this case you'll may have to delete all the files in your current /usr/ because usually the mount dirs have to empty. (As I write this, it begins to sound more and more hazardous, so do a fresh install!)

But anyway your example of fstab line will mount it on /mnt/home/ not to /home/, and atleast in my fstab defaults instead of noauto,users,exec is just fine.
 
Old 03-21-2005, 03:02 PM   #3
Jukas
Member
 
Registered: Mar 2005
Posts: 141

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by mjuhannus
I think fresh install would be best because your /usr/ won't have any files on it if you mount a different partition as /usr/, and you really have lots of important stuff on that directory.
That would be my first choice, but unfortunately I couldn't find anywhere during the knoppix hdd install to specify which partition to put /usr and /home to. Hence why I think I have to do it post install.
 
Old 03-21-2005, 03:24 PM   #4
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Rep: Reputation: 33
There shouldn't be any problems by splitting up the filesystem into separate partitions, I've done it many times in the past without problems................I agree it is a good idea to put the /home directory on its own partition, which is where all the personal data resides, keeping it separate from the system data but, personally, I feel it isn't really necessary to put /usr on a separate partition................I used to in the past 'cause I read it was a good idea, but for the typical home pc, it just isn't necessary.............

That being said, you will need to split up the 20 GB hard drive, one for the /usr and one for the /home partitions....................For the /usr, you shouldn't need a very large one, maybe 4-5 GB, while the /home partition should be as big as you can get.................The reason for a large /home partition is because the user's home directory is where the normal user has unrestricted access, and is the default for storing personal data, music files, etc..........In time, this can get quite large (especially when storing music, videos, pix, etc.)..............

For the n00b, cfdisk will work the best to partition the bigger drive.....Run this command:

cfdisk /dev/hdx

Substitute x for the correct letter for the drive (such as b, c, or d), depending on where the drive is installed at, and partition accordingly (you can make them both primary partitions here, and you can read "man cfdisk" for an explanation).....

After partitioning the drive, you may or may not have to reboot..................At the bottom of the cfdisk screen, after using the "Write" option, it may tell you that it couldn't reread the new partition table, which means you have to reboot, and if there was no warning you won't need to reboot.........

Now you can format the partitions.................for ext3 use the command:

mke2fs -j /dev/hdx1

for the first partition and

mke2fs -j /dev/hdx2

for the second partition..........Note: The '-j' switch is important to make it an ext3 instead of ext2.....

Now it's time to mount these to a temporary mount point.............You can make one for each in the /mnt directory like so.....

mkdir /mnt/temp1 && mkdir /mnt/temp2

Then mount the partitions with these commands:

mount /dev/hdx1 /mnt/temp1 -t ext3
mount /dev/hdx2 /mnt/temp2 -t ext3

Now you can copy the files over to the directories, using the 'cp -a' command:

cd /usr && cp -a . /mnt/temp1
cd /home && cp -a . /mnt/temp2

The reason for changing to the directories before copying is to make sure hiddens files will be included.....

Now it's time to enter the appropriate entries into /etc/fstab so they will be mounted automatically at boot time:

/dev/hdx1 /usr ext3 defaults 0 1
/dev/hdx2 /home ext3 defaults 0 1

At this point you are ready to use them...................However you might want to clear the directories first and then mount them, like so

cd /home && rm -rf .
cd /usr && rm -rf .
mount -a

that last command will cause the 'mount' command to reread /etc/fstab and mount any directories that need mounting, if they're not already mounted (such as the two entries you added)........

Don't forget to unmount them from their temporary directories:

umount /mnt/temp*

HTH
 
Old 03-21-2005, 06:02 PM   #5
Jukas
Member
 
Registered: Mar 2005
Posts: 141

Original Poster
Rep: Reputation: 15
Geekster,

Thanks for the reply. The only part I'm not clear on is where you said

Quote:
that last command will cause the 'mount' command to reread /etc/fstab and mount any directories that need mounting, if they're not already mounted (such as the two entries you added)........

Don't forget to unmount them from their temporary directories:

umount /mnt/temp*
If I unmount the temp mount points I made, do I need to create a permanent mount point in fstab and if so what would the syntax look like? If I don't need to create the entry in fstab, how does linux then know where to look for the /home /usr directories after the temporary mount points are removed and it's flushed from system memory (i.e after a reboot)?

Thanks,

Jesse
 
Old 03-22-2005, 12:42 AM   #6
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Rep: Reputation: 33
Sorry I took so long to reply, but I had to take my mother to the hospital...

If you followed along, I already showed you the entries to make in /etc/fstab, before unmounting the temp mount points :
Quote:
Now it's time to enter the appropriate entries into /etc/fstab so they will be mounted automatically at boot time:

/dev/hdx1 /usr ext3 defaults 0 1
/dev/hdx2 /home ext3 defaults 0 1
(And don't forget to substitute the x in hdx for the correct letter to the drive being partitioned)......

And the "last" command I was talking about is 'mount -a', which will reread the /etc/fstab file and mount any entry that needs mounting, while ignoring those already mounted, thus automatically mounting those two entries I showed you to add in /etc/fstab........

HTH
 
Old 03-24-2005, 10:50 AM   #7
Jukas
Member
 
Registered: Mar 2005
Posts: 141

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by thegeekster
[B]Sorry I took so long to reply, but I had to take my mother to the hospital...

If you followed along, I already showed you the entries to make in /etc/fstab, before unmounting the temp mount points : (And don't forget to substitute the x in hdx for the correct letter to the drive being partitioned)......
You're right, I don't know how I missed it. You're tutorial worked perfectly, thank you.

I hope your mother is doing better.
 
  


Reply


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
Directories on seperate partitions. ToothlessRebel Linux - Newbie 5 11-27-2004 09:34 AM
/usr in a seperate drive navinxavier Linux - Software 1 11-24-2004 05:16 PM
mount / , /home , /home/usr on different partitions alekoos Slackware 14 05-03-2004 11:39 AM
Advantages of partitions for /home and /usr Rudebr00d Linux - General 15 01-29-2004 08:19 PM
moving /home and /usr to new partitions? commuter Linux - General 12 01-05-2003 07:57 AM


All times are GMT -5. The time now is 09:01 PM.

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