Differences between revisions 7 and 29 (spanning 22 versions)
Revision 7 as of 2005-11-11 00:06:39
Size: 2808
Editor: PaulBrossier
Comment:
Revision 29 as of 2019-11-22 13:48:09
Size: 4740
Editor: leela52452
Comment: updated wikipedia redirected URL of Partition_(IBM_PC), URL on wiki has missing closing bracket also
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
Partitioning is a means to divide a single hard drive into many logical drives. A partition is a contiguous set of blocks on a drive that are treated as an independent disk. A partition table is an index that relates sections of the hard drive to partitions. #language en
||<tablestyle="width: 100%;" style="border: 0px hidden">~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: English - [[it/Partition|Italiano]]-~||<style="text-align: right;border: 0px hidden"> (!) [[/Discussion|Discussion]]||
----
Line 4: Line 6:
==== Definitions ====  . '''[[WikiPedia:Disk_partitioning|Disk partitioning]]''' is the creation of one or more storage regions (called partitions), so that each region can be managed separately. It is typically the first step of preparing a newly installed [[HardDisk|disk]], before any [[FileSystem|file system]] is created. The disk stores the information about the partitions' locations and sizes in an area known as the partition table that the operating system reads before any other part of the disk. Each partition then appears to the operating system as a distinct "logical" disk that uses part of the actual disk.

{{{#!wiki debian
[[https://www.debian.org/doc/manuals/debian-reference/ch09.en.html#_data_storage_tips|Debian Manual - 9.5. Data storage tips]]
}}}

== Tools ==

The following software allows working on disk partitions:

 * [[DebianPkg:gnome-disk-utility]] - manage and configure disk drives and media
 * [[DebianPkg:gparted]] - GNOME partition editor
 * [[Parted]] - command-line disk partition manipulator
 * [[DebianPkg:fdisk]] - collection of command-line partitioning utilities


== Definitions ==
Line 9: Line 28:
==== Partition Naming ====
== Partition Naming ==
Line 11: Line 31:
   /dev/hda1 The 1st primary partition
   /dev/hda2 The 2nd primary partition
   /dev/hda3 The 3rd primary partition
   /dev/hda4 An extended partition
   /dev/hda5 The 1st logical partition
   /dev/hda6 The 2nd logical partition
   /dev/sda1 The 1st primary partition
   /dev/sda2 The 2nd primary partition
   /dev/sda3 The 3rd primary partition
   /dev/sda4 An extended partition
   /dev/sda5 The 1st logical partition
   /dev/sda6 The 2nd logical partition
Line 19: Line 39:

In this example, /dev/hda4 is the extended partition. All the logical partitions reside on an extended partition.

==== LVM ====
If you're not sure what size to make your partitions, using a small ext3 {{{/boot}}} partition and lvm2-based partitions for the rest can be a good idea. The advantage of lvm is that it makes resizing more practical. In the DebianInstaller partition manager each logical volume is treated as if it were a disk in which you make partitions.

I assign a single partition per logical volume. Then when I want to increase the size of a partition, I umount the donor and recipient partitions, resize (shrink) the donor partition, resize (shrink) the donor logical volume, resize (grow) the recipient logical volume, resize (grow) the recipient partition, and finally remount. This may sound the same as with e2fsresize on regular partitions, but it's not.

Ext2/3 partition cannot be moved, so you can only gain space by shrinking the preceding partition, deleting the partition to grow, and recreating it larger, or by removing the following partition, increasing the size of the current partition, and recreating the following partition. With lvm2 the space comes from whatever logical volume you choose to shrink. lvm handles the details of where on the disk the partition blocks actually are.

Good Luck! -DD
In this example, {{{/dev/sda4}}} is the extended partition. All the logical partitions reside on an extended partition.
Line 32: Line 42:
=== See Also === == LVM ==
If you're not sure what size to make your partitions, using a small ext3 {{{/boot}}} partition and lvm2-based partitions for the rest can be a good idea. The advantage of LVM is that it makes resizing more practical. In the DebianInstaller partition manager each logical volume is treated as if it were a disk in which you make partitions.

I assign a single partition per logical volume. Then when I want to increase the size of a partition, I umount the donor and recipient partitions, resize (shrink) the donor partition, resize (shrink) the donor logical volume, resize (grow) the recipient logical volume, resize (grow) the recipient partition, and finally remount. This may sound the same as with e2fsresize on regular partitions, but it is not.

ext2/3 partition cannot be moved, so you can only gain space by shrinking the preceding partition, deleting the partition to grow, and recreating it larger, or by removing the following partition, increasing the size of the current partition, and recreating the following partition. With lvm2 the space comes from whatever logical volume you choose to shrink. lvm handles the details of where on the disk the partition blocks actually are.


== After Partitioning ==
After partitioning, the partition numbers of the unaltered partitions may change. For example, a partition that used to be identifed as /dev/sda7 may change to /dev/sda6 after the deletion of a partition. In this case, a number of configuration files needs to edited:

 1. The [[fstab]] file needs to be altered so that the swap partition and the various static mount points will work properly
 1. If the partition number for the swap partition was altered, the {{{/etc/initramfs-tools/config.d/resume}}} file also needs to be edited. This file indicates the partition used for hibernation; the swap partition is generally used for this purpose. {{{update-initramfs -u}}} needs to be ran afterwards to update the initramfs image.


== See Also ==
Line 35: Line 61:
 * ["Fdisk"]
 * ["SoftwareRAID"] on debian
 * [[Fdisk]]
 * [[SoftwareRAID]] on Debian
 * [[Part-UUID|Partition Identifiers]]
Line 38: Line 65:
=== External Links ===
== External Links ==
Line 40: Line 69:
 * http://staff.washington.edu/trav/linux/lost_partition.html Recovering a Lost Partition Table
 * http://en.wikipedia.org/wiki/Partition_(IBM_PC)
 * http://www.salingfamily.net/trav/linux/lost_partition.html Recovering a Lost Partition Table
 * https://en.wikipedia.org/wiki/Disk_partitioning

----

CategorySystemAdministration CategoryStorage

Translation(s): English - Italiano

(!) ?Discussion


  • Disk partitioning is the creation of one or more storage regions (called partitions), so that each region can be managed separately. It is typically the first step of preparing a newly installed disk, before any file system is created. The disk stores the information about the partitions' locations and sizes in an area known as the partition table that the operating system reads before any other part of the disk. Each partition then appears to the operating system as a distinct "logical" disk that uses part of the actual disk.

Tools

The following software allows working on disk partitions:

  • gnome-disk-utility - manage and configure disk drives and media

  • gparted - GNOME partition editor

  • Parted - command-line disk partition manipulator

  • fdisk - collection of command-line partitioning utilities

Definitions

  • Primary partition - A disk can have up to 4 primary partitions. It cannot have more that 4 due to limitations of the disk primary partition table. To get around this limitation, an extended partition may be used.
  • Extended partition - A special primary partition that is subdivided into logical partitions. There can be no more than 1 extended partition on a disk.
  • Logical partition - A partition residing on an extended partition

Partition Naming

   /dev/sda1      The 1st primary partition
   /dev/sda2      The 2nd primary partition
   /dev/sda3      The 3rd primary partition
   /dev/sda4      An extended partition
   /dev/sda5      The 1st logical partition
   /dev/sda6      The 2nd logical partition
   etc...

In this example, /dev/sda4 is the extended partition. All the logical partitions reside on an extended partition.

LVM

If you're not sure what size to make your partitions, using a small ext3 /boot partition and lvm2-based partitions for the rest can be a good idea. The advantage of LVM is that it makes resizing more practical. In the DebianInstaller partition manager each logical volume is treated as if it were a disk in which you make partitions.

I assign a single partition per logical volume. Then when I want to increase the size of a partition, I umount the donor and recipient partitions, resize (shrink) the donor partition, resize (shrink) the donor logical volume, resize (grow) the recipient logical volume, resize (grow) the recipient partition, and finally remount. This may sound the same as with e2fsresize on regular partitions, but it is not.

ext2/3 partition cannot be moved, so you can only gain space by shrinking the preceding partition, deleting the partition to grow, and recreating it larger, or by removing the following partition, increasing the size of the current partition, and recreating the following partition. With lvm2 the space comes from whatever logical volume you choose to shrink. lvm handles the details of where on the disk the partition blocks actually are.

After Partitioning

After partitioning, the partition numbers of the unaltered partitions may change. For example, a partition that used to be identifed as /dev/sda7 may change to /dev/sda6 after the deletion of a partition. In this case, a number of configuration files needs to edited:

  1. The fstab file needs to be altered so that the swap partition and the various static mount points will work properly

  2. If the partition number for the swap partition was altered, the /etc/initramfs-tools/config.d/resume file also needs to be edited. This file indicates the partition used for hibernation; the swap partition is generally used for this purpose. update-initramfs -u needs to be ran afterwards to update the initramfs image.

See Also


CategorySystemAdministration CategoryStorage