Linux - GeneralThis 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.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I was hoping someone could help me better understand how I should partition my harddrive as well as the appropriate file system I should run. This question stems from my attempt to install Suse 10.1.
1) I have a 8GB harddrive which I would like to install the following partitions
/
/usr
/home
/var
/tmp
/swap
When I attempted to setup the abovementioned partitions (custom) under Suse 10.1. it only allowed me to setup the first 4 and thereafter gave me a warning that it could no longer configure any primary, extended or logical partitions since there it had reached its maximum i.e. /dev/hda4. How do I get around this to setup all partitions?
2) Suse by defaults selects ReiserFS as its file system. I was wondering if I should use ext3 and if so what are the pro and cons of using either ext3 or ReiserFS. I intend to run the following environments - 1 workstation and 1 server (initial setup) with the possibility of adding more workstations
A hard disk can only have a maximum of four primary or extended partitions. If you want more than that, you have to create an extended partition, then you can create multiple logical partitions inside of that.
As I understand it, ext3 is older and thus more stable, but the difference probably isn't so much that the average user needs to worry about it these days. It is slightly easier to work with when there are problems. Conversely, reiserfs may have better performance, especially when working with large numbers of small files.
Thanks for that. Are you suggesting that rather than me creating primary partitions or extended partitions I create a single extended partition e.g. / and then multiple logical partitions for each of the remaining partitions e.g. /usr /home, etc
I'm not an expert here, but as I understand it, primary partitions are not necessary for Linux. The bootloader, placed in the disks MBR, will direct the system to the proper start up sequence.
And an extended partition is not usable on it's own. It's really just a special kind of primary partition that's used as a container for logical partitions. My main hard disk is broken up into the following partitions:
Code:
# fdisk -l /dev/hda
Disk /dev/hda: 61.4 GB, 61492838400 bytes
255 heads, 63 sectors/track, 7476 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 243 1951866 83 Linux
/dev/hda2 244 7476 58099072+ 5 Extended
/dev/hda5 244 1337 8787523+ 83 Linux
/dev/hda6 1338 7294 47849571 83 Linux
/dev/hda7 7295 7476 1461883+ 82 Linux swap / Solaris
hda1 is a primary partition, which I mount as /. hda2 is an extended partition which holds hda5, hda6, and hda7, my /usr, /home, and swap partitions respectively. I didn't have to make hda1 a primary partition; I could've placed it inside the extended one also, but I think it's more convenient this way because of how partitions get numbered. hd*1-4 are reserved for the four primary or extended partitions, with logical partitions following from 5.
Thanks for that. I would like to clarify what your posted. As far as you are aware, primary partitions are not required for *nix to boot as the bootloader is placed on the MBR (I assume that if the bootloader is not placed on the MBR, a primary partition would be required). Hence I could have one extended partition and multiple logical partitions within the extended partition container. I however did not understand your comment "And an extended partition is not usable on it's own. It's really just a special kind of primary partition that's used as a container for logical partitions". What do you mean by that an extended partition is not usable on its own?
As David the H. explained initially, hard drives can only recognize a total of 4 partition definitions. To get around that limitation, and allow the user to define more than four partitions, the concept of an extended partition was introduced, and basically it means that you can further subdivide that last extended partition into smaller pieces. (Typically I declare the first 3 partitions a primary regardless of their size, then declare the fourth one as extended, which I then split into as many logical paritions as I want)
What David the H meant when he said that the "extended partition was not usable on its own" is that it's only a placeholder, the actual partitions will be /dev/hda5, /dev/hda6, etc. To illustrate, suppose I have a 60G drive which I've divided into six partitions of varying size. My partitioning scheme might look like the following:
As you can see, /dev/hda4 is your extended partition, but it's just a placeholder containing the 3 other logical partitions. You would not actually be able to reference '/dev/hda4', as it is more or less just a conceptual reference to the area of the disk that is occupied by your logical partitions. As David said, it exists only as a 'container' for the other partitions, sort of like how an ice cube tray will contain multiple ice cubes. The tray itself is like the extended partition, which can be divided into multiple smaller logical partitions (eg, the ice cubes). Note that unlike an ice cube tray, the logical partitions (the cubes) do not need to be a uniform size, you can make them as big or small as you like
This is a bit anticlimatic, but note that extended partitions are not exactly "containers". What happens is this: An extended partition in the mbr (sector #1) simply points to another partition table in a different sector (#2). This has the first of the "logical" partitions. Then, when another logical partition is added, ANOTHER extended partition is added (in sector #2) to point to it. This process continues (indefinitely?)---building what one writer called a "linked list"
I assume that if the bootloader is not placed on the MBR, a primary partition would be required.
Linux does not need a primary partition to boot. Even if you put your bootloader in the MBR. Windows certainly wants a primary partition for booting, but does not require one as many people think. I believe this Windows peculularity is why people think a primary partition is always needed to boot.
Your MBR ("Master Boot Record") consists of a couple of things. It is physically found on your harddisk in the "First Sector of Track Zero". The entire thing is only 512 bytes long. Part of the MBR is known as the "Boot Code" and part of it is the "Partition Table". There are also things called "Volume Bytes" and some special bytes right after the partition table that are designed to signifiy a good partition table.
When Grub is "installed to the MBR" it writes itself to the Boot Code part of the MBR. It also puts some of itself to other sectors in Track Zero (MBR = the first sector of Track Zero, there are 63 sectors in Track Zero). More of Grub will be installed to a regular partition (it's menu.lst file for example). Grub works with a standard partition table. Some bootloaders do not - stay away from them.
Aside: When you reinstall Windows or run it's "fixmbr" or "fdisk /mbr" commands, it simpy overwrites the Boot Code (but not the Partition Table). So Grub gets nuked if you had it installed to the MBR. You recover easily by simply reinstalling Grub. Since the Partition Table was never touched during any of this procedure (unless you instructed Windows to do so during a reinstall), everything comes out just fine.
The Partition Table has slots for four entities. These are Primary Partitions. One of these Primary Partitions may be a special type ... called an Extended Partition. This Extended Partition can point to Logical Partitions. Logical Partitions are defined using a shortened version of the normal Partition Table found in the MBR. These Extended Partition Tables only hold two entities: (1) The definition of the current Logical Partition, and (2) A pointer to the next Extended Partition Table. So Logical Partitions are linked together in a chain using these Extended Partition Tables.
Extended Partition Tables will be scattered about your disk, physically sitting right in front of each Logical Partition. This makes Extended Partitions tougher to recover after a disaster that nukes your disk. First you have to find them. The Partition Table in your MBR is always sitting in the same place, so recovery of that can be easier.
Boy, I hope I got all the above correct! I'm pretty sure my memory is intact enough to remember all these details, but I make no guarrantees!!!
I would like to add a clarification of why MS systems like primary partitions.
If a MS system is first to be introduced into a PC it certainly needs to reside in a primary partition.
The reason is very simple. All MS systems, from Dos to XP, have a commond MBR. The role of MS's MBR is to search the 4 primary partitions and boot the one that has the "bootable" flag switched on. It is just the a byte in the partition table to indicate that partition is "active". MS's MBR does not have the intelligence (or more accurately sufficient code) to search the extended partition.
In the PC standard a hard disk has a maximum of 4 primary partitions as indicated by some posters here. The first 446 bytes are the boot code. 16 bytes per each of the primary partitions are reserved between the 447th to 510th bytes. When an extended partition is created it actually takes up the position of one of the allocated 4 slots.
The role of MS's MBR is to search the 4 primary partitions and boot the one that has the "bootable" flag switched on.
This is exactly why it is often said that Windows must boot out of a primary partition. If you use Microsoft's boot code, this is true. The secret is NOT to use Microsoft's boot code. Get some other third party boot manager.
I also think this "active partition" is Microsoft-only these days. I don't think other OS'es boot loaders even look at this, but I'm not 100% sure. Grub certainly doesn't need any active flag to tell it which partition to boot.
Thanks for your in-depth answers. It certainly helped me understand partitions better but also confused me a wee bit.
To clarify what has been posted:
1) There can only ever been 4 primary and extended partitions
2) There can be a maximum of 63 partitions
3) There can be a maximum of 59 logical partitions
4) Linux does not require a primary partition but it is advisable (is this true and if so why?)
5) A logical partition is an extension of an extended partition to help overcome the barrier/limitation of 4 partitions
6) What is the "First Sector of Track Zero" and I assume the 'Partition table' portion of the MBR is an index of all the partitions?
7) If Linux does not require an 'active' flag to denote which partition to boot from, how does it know which partition to mount and boot from or does it simply look for the /boot partition under /?
They should give you an understanding of what a track is, a cylinder, a sector, etc.
Note: Some info on the web is outdated. Modern computer BIOS'es are not subject to the 1024 cylinder limit you may read about. And now-a-days disks are accessed using LBA (Logical Block Addressing), not CHS (Cylinder/Head/Sector) for the most part. So as you're reading, keep in mind that things have changed over the years. Some articles first describe the historical stuff, and then progress on to newer things.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.