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

lvcreate

Create a logical volume from the free space of a volume group (lvcreate), or delete one (lvremove).

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

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

ماذا يفعل

lvcreate -n NAME -L SIZE VG makes an LV; -l gives the size in extents or percent (-l 100%FREE). The new device is /dev/VG/NAME; put a file system on it and mount it.

lvcreate also makes snapshots (-s), thin pools and thin volumes (-T), striped, mirrored and RAID volumes, cache and VDO volumes (with --type).

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

lvcreate -n NAME (-L SIZE | -l EXTENTS) [OPTION]... VG [PV...]
lvcreate -s -n NAME -L SIZE VG/LV
lvremove [OPTION]... VG/LV...

الخيارات 46

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

Basic

-n, --name NAME
Name of the new LV.
-L, --size SIZE
Size, like 500M, 5G.
-l, --extents N[%VG|%FREE|%PVS|%ORIGIN]
Size in extents or percent, like 50, 100%FREE.
-a, --activate y|n|ay
Activate it (default y).
-p, --permission rw|r
Read-write or read-only.
-C, --contiguous y|n
Use one contiguous area.
--alloc POLICY
Allocation policy.
-r, --readahead auto|none|N
Read-ahead sectors.
-Z, --zero y|n
Zero the first KiB (default y).
-W, --wipesignatures y|n
Wipe old signatures on the new LV.
--addtag TAG
Add a tag.
-k, --setactivationskip y|n, -K, --ignoreactivationskip, --setautoactivation y|n
Activation settings.
-M, --persistent y|n, -j, --major N, --minor N
Fixed device numbers.

Types

--type TYPE
linear, striped, snapshot, raid0/1/4/5/6/10, mirror, thin, thin-pool, cache, writecache, vdo …
-s, --snapshot
Create a snapshot of an LV.
-T, --thin
Thin pool or thin volume.
--thinpool LV
The thin pool for a thin volume.
-V, --virtualsize SIZE
Virtual size of a thin volume.
-c, --chunksize SIZE
Chunk size (snapshot, thin, cache).
--poolmetadatasize SIZE, --poolmetadataspare y|n
Pool metadata.
--discards passdown|nopassdown|ignore
Discard behaviour of thin pools.
--errorwhenfull y|n
Fail writes when a thin pool is full.
-i, --stripes N
Spread over N PVs (striped).
-I, --stripesize SIZE
Stripe size.
-m, --mirrors N
Number of extra copies (mirror/raid1).
-R, --regionsize SIZE, --mirrorlog core|disk, --nosync
Mirror settings.
--raidintegrity y|n, --raidintegritymode MODE, --raidintegrityblocksize N, --maxrecoveryrate SIZE, --minrecoveryrate SIZE
RAID settings.
-H, --cache, --cachepool LV, --cachevol LV, --cachedevice PV, --cachesize SIZE, --cachemode MODE, --cachepolicy STRING, --cachesettings STRING, --cachemetadataformat auto|1|2
Cache settings.
--vdo, --vdopool LV, --compression y|n, --deduplication y|n
VDO (deduplication and compression).
--monitor y|n, --ignoremonitoring
dmeventd monitoring.
--noudevsync
Do not wait for udev.
--metadataprofile STRING
Metadata profile.
--reportformat basic|json
Output format.

lvremove

-f, --force
Remove without asking (also active LVs).
-S, --select EXPR
Remove LVs that match.

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. 1LV with a size

    lvcreate -n lvdata -L 5G vgdata
      Logical volume "lvdata" created.

    Device: /dev/vgdata/lvdata.

  2. 2LV with a number of extents

    lvcreate -n lvfiles -l 50 vgfiles

    50 × PE size (see vgdisplay).

  3. 3Use all free space

    lvcreate -n lvweb -l 100%FREE vgdata

    Or 50%FREE for half.

  4. 4File system and mount

    mkfs.xfs /dev/vgdata/lvdata
    mkdir /data; echo "/dev/vgdata/lvdata /data xfs defaults 0 0" >> /etc/fstab
    systemctl daemon-reload; mount -a

    The usual next steps.

  5. 5A swap LV

    lvcreate -n lvswap -L 2G rhel; mkswap /dev/rhel/lvswap

    Add it to fstab as swap.

  6. 6Snapshot for a backup

    lvcreate -s -n lvdata-snap -L 1G /dev/vgdata/lvdata
    mount -o ro,nouuid /dev/vgdata/lvdata-snap /mnt

    Frozen view; back up /mnt, then remove the snapshot. (nouuid is needed for XFS.)

  7. 7Thin pool and thin volume

    lvcreate -T -L 10G vgdata/pool1
    lvcreate -T -V 50G -n lvthin vgdata/pool1

    Over-provisioning: watch the pool usage!

  8. 8Place an LV on a chosen PV

    lvcreate -n lvfast -L 2G vgdata /dev/nvme0n1p3

    For example on the faster disk.

  9. 9Remove an LV

    umount /data; lvremove /dev/vgdata/lvdata
    Do you really want to remove active logical volume vgdata/lvdata? [y/n]: y

    Remove the fstab line too.

  10. 10RAID1 mirror LV

    lvcreate --type raid1 -m 1 -n lvsafe -L 2G vgdata

    Two copies on different PVs.

رموز الخروج

0 :: Done. 5 :: Error.