• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Partitioning for Linux

rpc64

Platinum Member
I am getting ready to install RedHat 7.3 and I have a couple questions before I get started. I'm planning to give Linux 10GB on my hard drive and I want a multiple partition setup. I'm planning to have /, /swap, /usr, /var partitions. My question is what kinds of files or programs go in which partitions? I know what /swap is for, but I'm not sure about the other ones. Also, if I'm dual booting, can Linux be installed onto a logical partition or does it have to be primary?
 
"/" usually has the sbin, bin, etc, and user home directories in it plus some other stuff. In other non-RH systems there's usually a boot directory which contains the kernel and bootloader also but RH builds a small /boot partition for that during the install.
"/usr" is where most all of your software will be stored.
"/var" is where the temp and most of the logs get put.
Yes, you can install Linux in an extended partition.

 
I usually partition like this:

/ <--- root

/usr/local/ <------- this is usually were downloaded and installed programs get sent post-installation (tends to fill up quick if you do a lot of downloads)

swap <--- swap partition (i doesn't get mounted like a standard partition)(if you got lots and lots of ram (>516) you can ussually get away without a swap partition (better performance))

/home/ <---- seperate home partition so you can delete your OS and reistall a new one without losing all your settings and personal files....

otherwise you can make any folder in your directory a seperate hardrive partition (exept you may have issues with /proc.... i donno for sure)
if you like to have a seperate /var there is no problem. This mounted stuff is completely transperant to the OS (including mounting remote folder ie. NFS)

The only one that I would realy recommend is having a seperate /home/ partition, because If you are a newbie and like to experament alot you can do it with out having to worry about losing your personal data with a new installation.....
 
usr/local/ <------- this is usually were downloaded and installed programs get sent post-installation (tends to fill up quick if you do a lot of downloads)

This is only used if you compile programs from source and leave them go to the default locations. RPMs will go in /usr

swap <--- swap partition (i doesn't get mounted like a standard partition)(if you got lots and lots of ram (>516) you can ussually get away without a swap partition (better performance))

Having no swap is very highly not recommended, especially with 2.4.x kernels because they don't free swap as aggressively as 2.2.x did, it results in less disk activity but you run a higher chance of running out of swap letting the oom killer loose.

otherwise you can make any folder in your directory a seperate hardrive partition (exept you may have issues with /proc.... i donno for sure)

/proc is in memory only, it's a filesystem representation of certain kernel variables, it's not mounted on a disk at all.

The only partition I would recommend making seperate is /home (maybe /boot) because seperating /usr and /var on home machines just tends to cause more problems than it's worth and make things over complicated.
 
The only partition I would recommend making seperate is /home (maybe /boot) because seperating /usr and /var on home machines just tends to cause more problems than it's worth and make things over complicated.
I agree completely.

I've never understood why so many people seem obsessed with having loads and loads of partitions on their workstations.
On a server, it can definately be very helpful though, such as giving /var to avoid having Apache fill up your root with Code Red events and such.
 
Thanks for the links and all the information. Very helpful! So let me see if I have this right. I don't need to make separate partitions for /usr and /var? So I should have:

/
/swap
/home


Is that right? How much space should I give to each partition if I'm giving Linux 10GB? And if I want to install a program where does it go? In /usr? In /home?
 
Originally posted by: rpc64
Thanks for the links and all the information. Very helpful! So let me see if I have this right. I don't need to make separate partitions for /usr and /var? So I should have:

/
/swap
/home


Is that right? How much space should I give to each partition if I'm giving Linux 10GB? And if I want to install a program where does it go? In /usr? In /home?

I would recommend:
/ = whatever is left after the other partitions are made
/boot = 100MB
/home = 3GB
swap = 2xRAM

Having read the links, you would know anything you install should go in /usr/local/. Any documents and whatnot that you download go in ~/ (/home).
 
Having read the links, you would know anything you install should go in /usr/local/.

On the contrary, nearly all RPMs will install right in /usr, /usr/local is only for programs compiled from source and even then you can put them in your home dir or /usr if you want. I never make /usr/local it's own partition because it has maybe 10 files in it, everything I install is straight from the Debian archives or in my home directory.
 
Originally posted by: Nothinman
Having read the links, you would know anything you install should go in /usr/local/.

On the contrary, nearly all RPMs will install right in /usr, /usr/local is only for programs compiled from source and even then you can put them in your home dir or /usr if you want. I never make /usr/local it's own partition because it has maybe 10 files in it, everything I install is straight from the Debian archives or in my home directory.

To me, thats wrong (after checking it does not apear to be specific in the docs). Id be lost if packages/ports were installed anywhere but /usr/local/ on my OpenBSD system. This way, I know where everything is, and I know whats part of the base system.
 
Installing misc programs in /usr is kind of a Linux-ism.
Most Linux distros hardly seems to make use of /usr/local or /opt for anything in most cases.
 
To me, thats wrong (after checking it does not apear to be specific in the docs). Id be lost if packages/ports were installed anywhere but /usr/local/ on my OpenBSD system. This way, I know where everything is, and I know whats part of the base system.

I personally don't care where the files go, because I can easily find them with dpkg -L and remove them with dpkg -P. You can tell rpm (maybe dpkg too, never felt inclined to look) to relocate the files if you want, so you can put them in /usr/local but I don't see why you would even care as long as /usr is big enough.

And if you think about it, all 10,000 packages in Debain testing right now could be considered part of the base system =)
 
Originally posted by: Nothinman
To me, thats wrong (after checking it does not apear to be specific in the docs). Id be lost if packages/ports were installed anywhere but /usr/local/ on my OpenBSD system. This way, I know where everything is, and I know whats part of the base system.

I personally don't care where the files go, because I can easily find them with dpkg -L and remove them with dpkg -P. You can tell rpm (maybe dpkg too, never felt inclined to look) to relocate the files if you want, so you can put them in /usr/local but I don't see why you would even care as long as /usr is big enough.

Because Im an ass when it comes to my systems 😉

I dont complain when Im using someone else's system, just shake my head and think I would have done it better. Why do I like blackbox better than WindowMaker? I think its better. Its personal preference. Thats it.

And if you think about it, all 10,000 packages in Debain testing right now could be considered part of the base system =)

Then I could include all packages as part of an OpenBSD install, but thats a silly way to look at it in my opinion, since they dont come installed by default or in one of the system packages. Again, just my opinion.
 
Then I could include all packages as part of an OpenBSD install, but thats a silly way to look at it in my opinion, since they dont come installed by default or in one of the system packages. Again, just my opinion.

With the BSDs it's easy to differentiate the base system from additional software, with Linux it's harder. Technically Debian includes only the stuff in the base.tgz in it's base system but that base isn't very functional without any other packages.
 
Here's what I thought about swaps:

Swaps are there to pick up the exxesse memory run-off and have a place were the kernel can put memory portions of programs that are not currently be utilized, but could be in a short amount of time.

I thought that with enough RAM the kernel will just not use the swap stuff and keep everything up in RAM, were the access time is best and never use the swap partition.

+I thought that if the kernel had to use swap space, but ran out It would just create a swap file... ala windows?

am I that wrong?
 
OK my bad... I did some research...

If you have excessive amounts of RAM there is no need for a swap partition. The kernel will simply not use it for anything important.

Like on a modern distro two sticks of 516 ram will provide you more memory than you will probably ever use for a desktop. Hell, anything above 516 and you probably be fine. Remember don't be decieved if you look at you memory statistics a see that you RAM is full even from running just X windows and something simple like a card game. The goal of the linux kernel is to use as much RAM as possible. Unused RAM is wasted RAM.

I use 128megs and I DO do quite a bit of paging....

Plus Linux can use a swap file you can create it and put it in you fstab file so it's available on boot up, however this is pointless if you have a modern large harddive, space is so figgin' cheap on a HD then compared to RAM, there is not much point to not having a swap partition and using a swap file will cause a performance hit.

I guess a swap is good insurance, because if a active proccess consumes your entire RAM and runs out of space it can crash your computer pretty easily. Plus it is quicker to put unused information in the swap partition for retreival later than keeping loading it from the HD.

So why would you not want a swap partition?

For security that's why. Your swap partition is a garbage collector. It can have sensitive (or incrimitaing 😉 ) material lodged in some corner of the partition for practicly forever and it don't go away when you turn your computer off.....


(and about the /proc, my bad)
 
Originally posted by: drag
OK my bad... I did some research...

If you have excessive amounts of RAM there is no need for a swap partition. The kernel will simply not use it for anything important.

Like on a modern distro two sticks of 516 ram will provide you more memory than you will probably ever use for a desktop. Hell, anything above 516 and you probably be fine. Remember don't be decieved if you look at you memory statistics a see that you RAM is full even from running just X windows and something simple like a card game. The goal of the linux kernel is to use as much RAM as possible. Unused RAM is wasted RAM.

I use 128megs and I DO do quite a bit of paging....

Plus Linux can use a swap file you can create it and put it in you fstab file so it's available on boot up, however this is pointless if you have a modern large harddive, space is so figgin' cheap on a HD then compared to RAM, there is not much point to not having a swap partition and using a swap file will cause a performance hit.

I guess a swap is good insurance, because if a active proccess consumes your entire RAM and runs out of space it can crash your computer pretty easily. Plus it is quicker to put unused information in the swap partition for retreival later than keeping loading it from the HD.

In my dual p3 system I have a gig of ram. When linux was loaded on there I still had a swap partition. I dont think I used my 2x ram equation, but it was atleast 1x ram.

So why would you not want a swap partition?

For security that's why. Your swap partition is a garbage collector. It can have sensitive (or incrimitaing 😉 ) material lodged in some corner of the partition for practicly forever and it don't go away when you turn your computer off.....

You mean linux doesnt have encrypted swap?!
 
Swaps are there to pick up the exxesse memory run-off and have a place were the kernel can put memory portions of programs that are not currently be utilized, but could be in a short amount of time.

True, if the kernel needs more memory it flushes the disk cache and if there's still not enough after that it swaps some stuff out.

If you have excessive amounts of RAM there is no need for a swap partition. The kernel will simply not use it for anything important.

Depends on what you do, I have 1.2G of memory but there's always something that Linux decides to swap out because it hasn't been used for a long time.

Plus Linux can use a swap file you can create it

Yes, but a pagefile is slower than a partition because it has to go through the filesystem.

I guess a swap is good insurance, because if a active proccess consumes your entire RAM and runs out of space it can crash your computer pretty easily.

The only way a process can crash the whole system is if it's either run as root, or you run into a bug in the VM.

So why would you not want a swap partition?

For security that's why. Your swap partition is a garbage collector. It can have sensitive (or incrimitaing ) material lodged in some corner of the partition for practicly forever and it don't go away when you turn your computer off.....

Most likely it's touched the disk somewhere else too like web cache, temp file, etc.
 
You can encrypt the swap, with a performance hit of course + security programs (encrypted passwords and such) are designed as to not use the swap partition. If you have some ultra-sensitive material, why worry about a partition storing it that you have almost no direct control of in day to day usage? And if linux decides to swap out stuff and doesn't have a swap partition, then it just won't swap it out, its not that big of a deal. The time you would run into problems with not having a swap partition is if you run out of room for active proccesses..... You could easily run out of room if you are doing some serious cad, database or graphical work(or something like that). There are people using Linux everyday with 64 megs of ram and a 128 megs of swap space, your 1.2 gig RAM is much more than that. Linux is to good to be screwed up just by not having a swap partition.
 
security programs (encrypted passwords and such) are designed as to not use the swap partition

Only root can mlock pages of memory, so any program run by a normal user is subject to paging to disk if the VM system deems necessary.

And if linux decides to swap out stuff and doesn't have a swap partition, then it just won't swap it out, its not that big of a deal.

Actually if Linux decided to swap stuff out and there's no swap space it starts the OOM killer and kills a random process to free memory. (well it's not totally random, but chances are it'll be one of your apps like Mozilla)

You could easily run out of room if you are doing some serious cad, database or graphical work(or something like that)

Or running Mozilla...

I like Mozilla and all, but it's huge.
 
Is it necessary after all to have a separate /boot partition?

I think for everyday use, the following partitions should suffice:

/
/home
/swap
 
Quote:
Originally posted by: civad
Is it necessary after all to have a separate /boot partition?
--------------------------------------------------------------------------------



With the elimination of the 1024 cylinder thing, no.

Thats true, but some distros still recommend having a separate /boot partition...but thats another story
 
Thats true, but some distros still recommend having a separate /boot partition...but thats another story

That way you can have a read-only place to stick your kernel and initrd incase something happens to the root fs you can still get a partial command prompt. And lilo/grub don't support all the filesystems available yet, I know lilo and grub had issues with XFS before (since it's what my rootfs is) and I'm not sure if they're fixed in the upstream releases or not yet.
 
Back
Top