i have been using linux for 2 years, & until now i'm not so familiar with disk partitions! i always managed to create a "/" & "swap" partitions ...
can you explain me what every partition do & used for? & when such a partition is needed?
thnx a lot
well, those are the two basics, anything else you create (primary) can be salvaged in case you want to try something else.
most commonly people tend to create separate partitions for /home and /usr if they do at all.
In former days, you had to have a boot partition first on the drive, since BIOSes without LBA support couldn't read the kernel if it was further into the disk than the 1024th cylinder. Nowadays, all BIOSes support LBA anyway, so that's not a worry.
It can be a good thing to create a partition for /home, so that if you want to try a new distro, you can just format the root partition and still keep your home directory and all the settings in it. As for me, I mount /home over NFS, and on the server it is a LVM volume that spans two hard drives. I didn't combine it with the root filesystem, since that would complicate maintenence enormously.
If you want a high-security system, you might want to have a seperate partition for /tmp. Since many, if not most, worms put executables in /tmp which it later runs, it's good to be able to mount /tmp with noexec.
Noone wants a seperate partition for /usr. In the 70s, UNIX was distributed on two tapes, one root tape and one usr tape. The idea was that the root tape would be small and easy to set up, and then the usr tape was mounted on /usr once the system was up. That's not an issue anymore, so noone should ever create a /usr partition. In the GNU system, /usr is even symlinked to /. The legacy behaviour is still used, though. Only what is required to boot and maintain the system is put in the root filesystem, everything else (like user applications and the like) is put in /usr. If you have several computers, you could consider putting /usr on NFS to make all of them behave exactly the same.
If you have two hard drives or more, you might want to put a swap partition on each of them. That way, the kernel can optimize the swapping speed by striping the swap over all the swap partitions.
This is a little off topic but what is the purpose of the swap partition?
You don't know what swap is?
When the processes in your system together map more memory than you actually have in RAM (which they often do), the kernel puts unfrequently used memory pages in the swap partition (it swaps the pages out), and then, when the process wants to read from the pages again, the kernel just swaps them in again. It's all transparent to the process itself. When the kernel swaps out pages, it marks the pages to the processor as inaccessible. Therefore, when the process tries to read from the pages again, the processor generates a page fault, which the kernel catches. When it does, it looks up the right page in the swap page and loads it into a physical memory (RAM) page, which it then remaps into the process' addressing space, and then it lets the process continue. To the process it appears as if nothing ever happened.
Therefore, swap allows programs to use more memory than you actually have.
Thanks for clearing that up. I sort of had an idea before but that puts it into perspective..
LOL! Now that I look at it afterwards, I find it rather funny that I was just blindly assuming that everyone would know what swap is and how it works. Maybe that's a sign of spending too much time by the computer... =)
You can NEVER spend too much time in front of the computer. Unless your hand becomes perminetly glued to the mouse and the carpel tunnel has taken over so badly your hands and fingers are forever stuck in the home row position :lol:
Speaking of the mouse; isn't it time to do something about that. I really hate the mouse. The only thing I use it for is for web browsing, and I'd really like to get rid of that dependency. Can't anyone think of a more practical means of navigating web pages? Admittedly, it isn't very practical to have to tab around all the elements to get where you want.