الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

pvcreate

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

المستوى
امتحان RHCSA
المجموعة
LVM
يحتاج root
نعم
الحزمة
lvm2
يُسمّى أيضًا
pvremove

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

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.

طريقة الكتابة

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

الخيارات 27

الأكثر استخدامًا

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.

أمثلة 10

$ مستخدم عادي# بصلاحية root (أو مع 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.

الملفات

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

رموز الخروج

0 :: Done. 5 :: Error.