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

pvcreate

Turn a disk or partition into an LVM physical volume (pvcreate), or remove the LVM label again (pvremove).

Niveau
RHCSA-examen
Groep
LVM
Root nodig
Ja
Pakket
lvm2
Ook
pvremove

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

Wat het doet

pvcreate DEVICE writes an LVM label and metadata area on the device, so it can join a volume group. It works on whole disks and on partitions (type lvm recommended). It refuses devices with an existing file system or partition table signature — clear them with wipefs -a first if you are sure.

pvremove deletes the LVM label from a PV that is no longer in a VG.

Zo schrijf je het

pvcreate [OPTION]... DEVICE...
pvremove [OPTION]... PV...

Opties 27

Meest gebruikt

pvcreate

-f, --force
Create even when a signature is found (twice: also over an existing PV).
-u, --uuid UUID
Use this UUID (with --restorefile, for recovery).
--restorefile FILE
Metadata backup for -u.
--norestorefile
Allow -u without a restore file.
--metadatasize SIZE
Size of the metadata area.
--pvmetadatacopies 0|1|2, --metadatacopies 0|1|2
Number of metadata copies on the PV.
--metadataignore y|n
Ignore the metadata areas on this PV.
-M, --metadatatype lvm2
Metadata format.
--dataalignment SIZE
Align the start of data.
--dataalignmentoffset SIZE
Shift the alignment.
--bootloaderareasize SIZE
Reserve space for a boot loader.
--labelsector N
Sector of the LVM label.
--setphysicalvolumesize SIZE
Override the detected size.
-Z, --zero y|n
Wipe the first sectors.
--reportformat basic|json
Output format.

pvremove

-ff
Remove even if the PV is in a VG (dangerous).

Common LVM options

-t, --test
Test only; change nothing.
-v, --verbose
More output (repeat for more).
-q, --quiet
Less output.
-y, --yes
Answer yes to questions.
-d, --debug
Debug output.
--config STRING
Override lvm.conf settings for this command only.
--commandprofile STRING, --profile STRING
Use a configuration profile.
--devices PV, --devicesfile STRING
Limit the devices LVM looks at.
--driverloaded y|n, --nolocking, --lockopt STRING, --nohints, --journal STRING
Special and debug settings.
-h, --help, --longhelp
Show help.
--version
Show the version.

Voorbeelden 10

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

  1. 1Create a PV on a partition

    pvcreate /dev/vdb1
      Physical volume "/dev/vdb1" successfully created.

    Partition type lvm first (fdisk t → lvm).

  2. 2Whole disks

    pvcreate /dev/vdc /dev/vdd

    No partition table needed.

  3. 3Check the result

    pvs

    New PVs have no VG yet.

  4. 4A disk with old signatures

    pvcreate /dev/vde
      WARNING: xfs signature detected on /dev/vde at offset 0. Wipe it? [y/n]:

    Answer only if the data is not needed; or run wipefs -a first.

  5. 5Test first

    pvcreate -t /dev/vdc

    Shows what would happen.

  6. 6Remove the LVM label

    pvremove /dev/vdd
      Labels on physical volume "/dev/vdd" successfully wiped.

    Only after vgreduce took it out of the VG.

  7. 7Grow a PV after the disk or partition grew

    pvresize /dev/vdb1

    The VG gets the new space (for example after a VM disk resize).

  8. 8See details of a PV

    pvdisplay /dev/vdb1

    Size, PE count, VG.

  9. 9Find devices LVM can use

    lvmdiskscan

    Lists disks and partitions with sizes.

  10. 10Restore a lost PV label (recovery)

    pvcreate --uuid "Wq3k…" --restorefile /etc/lvm/backup/vgdata /dev/vdc

    Then vgcfgrestore vgdata. Metadata backups are in /etc/lvm/backup.

Bestanden

/etc/lvm/lvm.conf
LVM settings.
/etc/lvm/backup/, /etc/lvm/archive/
Metadata backups.

Exitcodes

0Done.
5Error.