ZFS: Difference between revisions

Sandro (talk | contribs)
Better headline
Tboston (talk | contribs)
update partitioning tasks to follow a complete example with gdisk
Line 52: Line 52:


* 1G for boot partition with "boot" as the partition label (also called name in some tools) and ef00 as partition code
* 1G for boot partition with "boot" as the partition label (also called name in some tools) and ef00 as partition code
* 10G for a swap partition with "swap" as the partition label and 8200 as partition code. We will encrypt this with a random secret on each boot.
* 4G for a swap partition with "swap" as the partition label and 8200 as partition code. We will encrypt this with a random secret on each boot.
* The rest of disk space for zfs with "root" as the partition label and 8300 as partition code (default code)
* The rest of disk space for zfs with "root" as the partition label and 8300 as partition code (default code)


Line 58: Line 58:
In low-memory situations, ZFS therefore might need a bit longer to free up memory from its cache. The swap partition will help with that.
In low-memory situations, ZFS therefore might need a bit longer to free up memory from its cache. The swap partition will help with that.


Example output from fdisk:
Example with gdisk:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo gdisk /dev/nvme0n1
sudo gdisk /dev/nvme0n1
GPT fdisk (gdisk) version 1.0.9.1
GPT fdisk (gdisk) version 1.0.10
...
...
Command (? for help): p
# boot partition
Disk /dev/nvme0n1: 500118192 sectors, 238.5 GiB
Command (? for help): n
Sector size (logical/physical): 512/512 bytes
Partition number (1-128, default 1):  
Disk identifier (GUID): CA926E8C-47F6-416A-AD1A-C2190CF5D1F8
First sector (2048-1000215182, default = 2048) or {+-}size{KMGTP}:  
Partition table holds up to 128 entries
Last sector (2048-1000215182, default = 1000215175) or {+-}size{KMGTP}: +1G
Main partition table begins at sector 2 and ends at sector 33
Current type is 8300 (Linux filesystem)
First usable sector is 34, last usable sector is 500118158
Hex code or GUID (L to show codes, Enter = 8300): ef00
Partitions will be aligned on 2048-sector boundaries
Changed type of partition to 'EFI system partition'
Total free space is 2669 sectors (1.3 MiB)


Number  Start (sector)   End (sector) Size      Code  Name
# Swap partition
  1            2048        2099199  1024.0 MiB  EF00  boot
Command (? for help): n
  2        2099200        23070719  10.0 GiB    8200 swap
Partition number (2-128, default 2):
  3        23070720      500117503  227.5 GiB  8300  root
First sector (2099200-1000215182, default = 2099200) or {+-}size{KMGTP}:
Last sector (2099200-1000215182, default = 1000215175) or {+-}size{KMGTP}: +4G
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300): 8200
Changed type of partition to 'Linux swap'


Command (? for help):  
# root partition
Command (? for help): n
Partition number (3-128, default 3):
First sector (10487808-1000215182, default = 10487808) or {+-}size{KMGTP}:
Last sector (10487808-1000215182, default = 1000215175) or {+-}size{KMGTP}:
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
 
# write changes
Command (? for help): w
 
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
 
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/nvme0n1.
The operation has completed successfully.
</syntaxhighlight>
</syntaxhighlight>