Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

gdisk

Edit GPT partition tables with a menu (like fdisk, made for GPT).

Niveau
Extra
Groep
Schijven en bestandssystemen
Root nodig
Ja
Pakket
gdisk

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

gdisk (GPT fdisk) works like fdisk but only with GPT. It can convert MBR to GPT, repair GPT tables (the backup at the end of the disk) and uses 4-digit type codes (8300 Linux, 8200 swap, 8e00 LVM, ef00 EFI). The sgdisk command does the same without a menu. On RHEL it may need dnf install gdisk.

Zo schrijf je het

gdisk [-l] DEVICE

Belangrijkste delen

?
Help.
p
Print the table.
n
New partition.
d
Delete a partition.
t
Change the type code.
l
List the type codes.
c
Change a partition name.
i
Details of a partition.
o
New empty GPT table.
r
Recovery and transformation menu (rebuild, convert).
x
Expert menu.
v
Verify.
w
Write and quit.
q
Quit without saving.

Opties 1

Meest gebruikt

-l
List the partition table and exit.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1Install gdisk

    dnf install -y gdisk

    In the BaseOS repository.

  2. 2List a GPT table

    gdisk -l /dev/vdb

    Shows the type codes and names.

  3. 3Create a Linux LVM partition

    gdisk /dev/vdb
    Command (? for help): n
    Hex code or GUID (L to show codes, Enter = 8300): 8e00
    Command (? for help): w

    8e00 = Linux LVM.

  4. 4Swap partition type

    gdisk /dev/vdb
    Hex code or GUID (L to show codes, Enter = 8300): 8200

    8200 = Linux swap.

  5. 5Name a partition

    gdisk /dev/vdb
    Command (? for help): c

    GPT partitions can have names (PARTLABEL).

  6. 6Verify a disk

    gdisk /dev/vdb
    Command (? for help): v

    Finds problems in the table.

  7. 7Repair a damaged main table from the backup

    gdisk /dev/vdb
    Command (? for help): r
    Recovery/transformation command (? for help): b

    Uses the backup header at the end of the disk.

  8. 8Convert MBR to GPT (keep data)

    gdisk /dev/vdc

    gdisk offers the conversion when it finds MBR; write with w. Back up first.

  9. 9Script with sgdisk

    sgdisk -n 1:0:+2G -t 1:8300 -c 1:data /dev/vdb

    One partition of 2 GiB, Linux type, name data.

  10. 10Back up the GPT table

    sgdisk --backup=/root/vdb-gpt.bin /dev/vdb

    Restore with sgdisk --load-backup=.

Exitcodes

0 :: Done. 1 :: Error.

Volledige handleiding

Deze pagina legt het commando uit in eenvoudige woorden. De originele handleiding heeft elk detail.

In je terminal: man 8 gdisk