Disk Partitioning¶
Overview¶
Before creating a ZFS pool, you may need to partition disks. This guide covers partitioning the internal NVMe to coexist with ext4 root.
When to Partition¶
| Scenario | Partition Needed |
|---|---|
| Dedicated disk for ZFS | No - use whole disk |
| ZFS alongside ext4 root | Yes - create partition for ZFS |
| Adding spare space from boot disk | Yes - create partition from free space |
For this setup:
- Internal NVMe (2TB): Partitioned - ext4 root + ZFS partition
- Secondary NVMe (4TB): Whole disk for ZFS
Identify Disks¶
List block devices:
Example output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n1 259:0 0 1.8T 0 disk
├─nvme0n1p1 259:1 0 512M 0 part /boot/efi
├─nvme0n1p2 259:2 0 1G 0 part /boot
└─nvme0n1p3 259:3 0 500G 0 part /
nvme1n1 259:4 0 3.6T 0 disk
Get persistent disk IDs:
Use disk IDs
Always reference disks by /dev/disk/by-id/ paths. Device names like /dev/nvme0n1 can change between boots.
Plan Partition Layout¶
Target layout for internal NVMe:
| Partition | Size | Purpose |
|---|---|---|
| p1 | 512 MB | EFI System |
| p2 | 1 GB | /boot |
| p3 | 500 GB - 1 TB | / (ext4 root) |
| p4 | Remaining | ZFS pool member |
Partition Internal NVMe¶
Check Free Space¶
If the disk has unallocated space after the root partition, you can create a new partition.
Create ZFS Partition¶
Using gdisk (recommended for GPT disks):
Commands:
p- Print partition table (verify current layout)n- New partition- Partition number: 4 (or next available)
- First sector: (press Enter for default - starts after last partition)
- Last sector: (press Enter for default - uses remaining space)
- Hex code:
bf00(Solaris root - recognized by ZFS)
p- Verify new partitionw- Write changes and exit
Alternative: Using fdisk¶
Commands:
p- Print partition tablen- New partition- Partition type: primary
- Partition number: 4
- First sector: (default)
- Last sector: (default)
t- Change partition type- Partition: 4
- Type:
bf(Solaris root)
w- Write and exit
Verify Partitions¶
After partitioning:
Expected output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n1 259:0 0 1.8T 0 disk
├─nvme0n1p1 259:1 0 512M 0 part /boot/efi
├─nvme0n1p2 259:2 0 1G 0 part /boot
├─nvme0n1p3 259:3 0 500G 0 part /
└─nvme0n1p4 259:4 0 1T 0 part
nvme1n1 259:5 0 3.6T 0 disk
Verify partition IDs are available:
Look for entries like:
nvme-<model>-part4- The new ZFS partitionnvme-<model>- The secondary disk (whole disk)
Important Notes¶
Backup First
Always backup important data before modifying partition tables.
Live System
If modifying the boot disk on a running system, consider booting from a live USB. Some partition changes require a reboot to take effect.
Secondary Disk
The 4TB secondary NVMe needs no partitioning - ZFS will use the entire disk.
Next Steps¶
Proceed to Pool Creation to create the ZFS pool from these devices.