User:Alfplayer/draft1

From ParabolaWiki
Jump to: navigation, search
Summary
An overview of disk partitioning tools, best practices, and additional considerations.
Related
fstab
LVM
Swap
Format a device
File systems

There are many partition schemes. It's possible to create only one partition (to be used by the root file system) for a simple partitioning scheme and a simple setup. Some setups involve more complex partition schemes. Creation of both GPT and MBR partition tables is shown - only one of these must be created on a drive. More information on Partitioning.

1 Notes

1.1 About UEFI boot

  • If you have a UEFI motherboard, you will need to create an extra UEFI System partition.
  • It is recommended to always use GPT for UEFI boot, as some UEFI firmwares do not allow UEFI-MBR boot.

1.2 About GPT partitioning

2 Using GPT - Modern Method

2.1 Gdisk

  • gdisk from gptfdisk package is necessary - it is already available on the official ISO image.
  • Start gdisk against your drive
# gdisk /dev/sdXN

where X is the drive letter, and N is the partition number.

  • If the drive is brand new or if wanting to start over, create a new empty GUID partition table (aka GPT) with the o command.
  • Create the root partition with the n command (primary type/1st partition).
  • Assuming the partition is new, gdisk will pick the highest possible alignment. Otherwise, it will pick the largest power of two that divides all partition offsets.
  • If choosing to start on a sector before the 2048th gdisk will automatically shift the partition start to the 2048th disk sector. This is to ensure a 2048-sectors alignment (as a sector is 512B, this is a 1024KiB alignment which should fit any SSD NAND erase block).
  • Use the +x{M,G} format to extend the partition x megabytes or gigabytes, if choosing a size that is not a multiple of the alignment size (1024kiB), gdisk will shrink the partition to the nearest inferior multiple.
  • Select the partition type. The default value is Linux/Windows data (code 0700) which should be fine for most use. Press L to show the codes list.
  • It's possible to assign other partitions in a like fashion.
  • Write the table to disk and exit via the w command.
  • Create the filesystems as usual.
Warning: If planning to use the GPT partitioned SSD as a boot-disk on a BIOS based system (most systems except Apple computers and some very rare motherboard models with Intel chipset) one may have to create, preferably at the disk's beginning, a 2 MiB partition with no filesystem and with the partition type as BIOS boot or bios_grub partition (gdisk type code EF02) for booting from the disk using GRUB. For Syslinux, one does not need to create a separate 2 MiB bios_grub partition, but one needs to have separate /boot partition and enable Legacy BIOS Bootable partition attribute for that partition (using gdisk). See GPT for more information.
Warning: GRUB legacy does not support GUID partitioning scheme, users must use burg, GRUB or Syslinux.

3 Using MBR - Legacy Method

3.1 Fdisk

  • Start fdisk.
  • If the drive is brand new, create a new empty DOS partition table with the o command.
  • Create the root partition with the n command (primary type/1st partition).
  • Use the +xG format to extend the partition x gigabytes.
  • Change the partition type from the default type of Linux (type 83) to the desired type via the t command. This is an optional step should the user wish to create another type of partition, for example, swap, NTFS, LVM, etc. Note that a complete listing of all valid partition types is available via the l command.
  • It's possible to assign other partitions in a like fashion.
  • Write the table to disk and exit via the w command.

When finished, users may format their newly created partitions with mkfs.x /dev/sdXN where x is the filesystem, X is the drive letter, and N is the partition number. The following example will format the first partition on the first disk to ext4 using the defaults specified in /etc/mke2fs.conf:

# mkfs.ext4 /dev/sda1
Warning: Using the mkfs command can be dangerous as a simple mistake can result in formatting the WRONG partition and in data loss! TRIPLE check the target of this command before hitting the Enter key!

4 See also