Home Wiki > SDB:Partitioning
Sign up | Login

SDB:Partitioning

tagline: From openSUSE

Icon-cleanup.png This article is in need of attention because it does not follow our wiki guidelines.
If you want to contribute, please read the rules for this wiki and if you have any questions, don't hesitate to contact the wiki team, we are more then willing to help you! :-)
Icon-expand.png This article is a stub!
This article needs to be expanded. You are welcome to help in line with the Style Guidelines.

Tested on openSUSE Recommended articles Related articles
Icon-checked.png

Icon-manual.png Icon-help.png

Partition Schemes

Standard

A "standard" or purely primary partition scheme is the most common and is how most computers are partitioned from the manufacturer. In an IBM partition scheme, the partition table on the master boot record has 4 entries. This is where information about primary partitions is stored. It is generally a good idea to have at least one primary partition used to boot the system.


Extended

Information about extended partitions is stored in the extended partition boot record descriptor. Each extended partition has its own descriptor, independent from other extended partitions. The maximum number of logical partitions that can be made inside an extended partition is only limited by the amount of available disk space, however, in earlier versions of Windows, fdisk was limited by the number of available drive letters it could assign. A and B were reserved, C was system; therefore the maximum number of logical partitions was 23, before Windows adopted a Unix-like partition mounting scheme.

It is of somewhat importance to make the distinction between "extended partition" and "logical partition". An extended partition is actually a special type of primary partition, which, by itself, doesn't really contain any file system information. It instead usually contains 1 or more logical partitions ("logical" tends to get confused with "extended", and in some cases is considered and appropriate substitution).


LVM

Using the Linux kernel's logical volume manager works like this: you create a physical primary or extended partition (usually the latter) and then create multiple logical volume groups or partitions inside the physical LVM partition. LVM is more flexible than traditional partitioning in a variety of ways; the features that have the highest probability of interest are listed here:

  • Volume groups can consist of and span multiple physical volumes
  • Mirroring/striping entire or partial sections of logical volumes (similar to RAID 1 or 0, respectively)
  • Create read-only or read-write snapshots of logical volumes (volume-level backups)
  • Online volume groups can be resized, either by absorbing new physical volumes or by ejecting existing ones
  • Online logical volumes can be resized as well, by either concatenating or truncating extents to/from them
  • Flexibly move logical volumes between physical volumes

It would be, in most cases, a good idea to stick with a standard Primary/Extended partitioning scheme unless one of these features is of particular interest to you.

A logical volume group consists of 1 or more LVM partitions (which can be either primary or extended, so long as the partition type code is 0x8E (LVM). The former requirement makes creating a LVG slightly more elusive in YaST, but once you know how to do it, the procedure becomes ridiculously simple.

Those familiar with the Microsoft's LVM implementation (also called "dynamic disk array") might also note that instead of requiring that an entire "basic" disk be converted to a "dynamic" disk, the Linux LVM is more flexible and is implemented within partition boot records instead.


Examples

Simple

Device Type Size Filesystem Mount
/dev/sda - 200gb - -
/dev/sda1 Primary 100mb EXT4 /boot
/dev/sda2 Primary 20gb EXT4 /
/dev/sda3 Primary 178.49gb EXT4 /home
/dev/sda4 Primary 1.5gb Swap swap

On thing to notice is that you could just as easily create just a single 200gb root--or "/"--partition and that would work just fine (provided you had enough physical memory to avoid requiring a swap partition).

The reasoning for this is that if, for example, you ever wanted to do a clean (re)installation of openSUSE, you wouldn't have much, if anything, to backup prior to formatting the root partition, as it is all stored in /home. On the other hand, if /home was on the root partition, this would probably require that you migrate /home to another physical volume prior to formatting the root partition. Creating a separate /boot in this scenario could be considered somewhat unnecessary, but usually is a good idea.


Dual Boot/Extended

Device Type Size Filesystem Mount
/dev/sda - 200gb - -
/dev/sda1 Primary 100gb ntfs-3g /windows/C
/dev/sda2 Primary 100mb EXT4 /boot
/dev/sda3 Extended (Primary) 20gb - -
/dev/sda5 Extended 20gb EXT4 /
/dev/sda6 Extended 78.49 GB EXT4 /home
/dev/sda7 Extended 1.5gb Swap swap

Note the device numbering, paying special attention to sda3.

/boot ends up being more than a few gigabytes from the beginning of the drive in this case. This, in general, is not a very good practice, and in some circumstances (on older/crappier BIOS's) will cause the system not to boot; YaST warn you about this too. However, on modern systems, the BIOS will still be able to find the boot partition, and you'll never notice the difference once you accept the partition scheme. For more information: SDB:Sandbox#Boot_Volume

This is where the advantages of separating /boot from the root partition become more evident. /boot, in most cases, needs to be located on a primary partition (and this is true of any operating system). It would be inconvenient (but still possible), in this case, to make a primary root partition, and keep /home and swap in the extended partition. This would make even more sense if you added in the a windows recovery partitions that are becoming more common in OEM Windows installations. If you had one of those systems with both a "system" partition (presumably containing the NTLDR) and a recovery system, you now only have room for one more primary partition.

It would also cause minimal disruption of your Windows partition to shrink it by 100mb instead of 20+gb to add a /boot partition, and then place the root partition on another physical volume, thereby avoiding having to reconfigure your BIOS to boot from the secondary PV as an additional bonus.


LVM

Creating a LVG really only makes sense when you're dealing with multiple physical volumes with which you want to span a single partition across. One of the most brilliant partition schemes I can think of would involve having one small, high-speed SSD, and two larger HDD's. The partition scheme would look thus:

Device Type Size Filesystem Mount Stripes
/dev/sda - 4gb - - -
/dev/sda1 Primary 100mb EXT4 /boot -
/dev/sda1 Primary 3.9gb Swap swap -
/dev/sdb - 200gb - - -
/dev/sdb1 LVM (Primary) 200gb - - -
/dev/sdc - 200gb - - -
/dev/sdc1 LVM (Primary) 200gb - - -
/dev/lvg1 LVG 400gb - - -
/dev/lvg1/root LV 20gb EXT4 / 2
/dev/lvg1/home LV 380gb EXT4 /home 2

Telling the LVM that you want two stripes on lvg1/root and lvg1/home on the same two physical volumes is just barely scratching the surface of the power of the LLVM.

Warning Critical: Do not add two (or more) physical partitions on the same physical volume to the same logical volume group.

The LVM physical partitions work somewhat similarly to how extended partitions work, not directly containing any filesystem information. The interesting thing here is that instead of creating another device on that parent node, an entirely new device node structure is created: /dev/lvg1 (you actually select what you want the device to be called, "lvg1" is completely arbitrary, as well as "lvg1/root" and "lvg1/home").

You don not need /boot to be on a physical volume not used in LVM. The following is just as valid:

Device Type Size Filesystem Mount Stripes
/dev/sda - 200gb - - -
/dev/sda1 Primary 100mb EXT4 /boot -
/dev/sda2 LVM (Primary) 199.9gb - - -
/dev/sdb - 200gb - - -
/dev/sdb1 LVM (Primary) 200gb - - -
/dev/lvg1 LVG 399.9gb - - -
/dev/lvg1/root LV 20gb EXT4 / 2
/dev/lvg1/home LV 379.8gb EXT4 /home 2

To explain: if you want to have multiple stripes, it is a good idea to make your physical LVM partitions the same size. Otherwise, the maximum size of a striped logical volume would be limited to the maximum size of smallest physical volume/partition in the logical volume group multiplied by the number of physical volumes/partitions in the group. The above table is an example of this, where 100mb of the lvg1 is unused. If lvg1/home or lvg1/root only had 1 stripe, then the maximum size of the logical volume would be 379.9gb or 20.1gb, respectively. Neither lvg1/home or lvg1/root is particularly closer to any portion of either disk, but explaining the actual mechanics of how the LLVM decides where to store what extent is far outside the scope of this article.


Advanced

Boot Volume

If another operating system is already present on the boot volume (Windows), you may want to free 100MB to make room for a proper /boot partition. However, sadly, the YaST partitioning module doesn't support moving partitions around like that, so if you wish to do that, you'll need to get a more advanced tool like SDB:Gparted


See also