Dec 22

Disk/Partition/Logical Volume (LVM) Management related commands in Centos/Redhat Linux

echo "Dec 22nd 2017"
321 pvs
322 output
323 PV VG Fmt Attr PSize PFree
324 /dev/sda2 cl lvm2 a-- 19.00g 0
325 pvs
326 vgs
327 lsblk
328 vgdisplay
329 vgdisplay | grep "PE Size"
330 PE Size 4.00 MiB
331 vgdisplay > vgdisplay20171222.txt
332 vgdisplay | grep 'PE Size'> vgdisplay20171222.txt
333 lvs
334 lvs > lvs20171222.txt
335 lvs
336 lvdisplay vg00
337 lvdisplay cl
338 lvdisplay cl > lvdisplaycl.txt
339 lvdisplay /dev/cl
340 lvdisplay /dev/cl/root
341 lsblk
342 lvdisplay /dev/cl/swap
343 lvdisplay /dev/cl/swap > swaplv.txt
344 pvck
345 pvck /dev/sda
346 lsblk
347 pvck /dev/sda2
348 pvs
349 pvs > pvsoutput
350 pvck /dev/sda2
351 echo "physical volume related commands - just the terms"
352 pvck
353 pvcreate
354 pvdisplay
355 pvresize
356 pvmove
357 pvremove
358 pvs
359 pvscan
360 echo "volume group related commands"
361 echo "you create volume groups out of physical volumes"
362 vgch
363 vgck-> checks integrity of volume groups
364 vgck
365 vgcreate : you provide the physical volumes as parameters
366 vgcreate
367 vgdisplay
368 vgextend
369 vgextend -> you can add additional physical volumes to a volume group
370 vgreduce
371 vgreduce : reduce size of a volume group
372 use -L target-size as parameters for vgreduce along with vg name or -L -100m where 100m is the amount to reduce. not the final size
373 vgrename
374 vgremove
375 vgremove -> removes a volume group
376 vgs
377 vgs -> list volume groups
378 vgscan -> scan system find volume groups
379 vgscan
380 vgscan /dev/sda2
381 vgscan
382 echo "Logical Volume related commands"
383 lvcreate
384 lvdisplay
385 lvextend
386 lvreduce
387 lvremove
388 lvrename
389 lvresize
390 lvs
391 lvscan
392 lvm
393 lvscan
394 lvm
395 lsblk | grep vd
396 lsblk | grep sd
397 lvmdiskscan
398 lvscan
399 lvmdiskscan > outputoflvmdiskscan.txt
400 lsblk
401 parted /dev/sdc mkpart primary 1 100m
402 parted /dev/sdc mklabel msdos
403 parted /dev/sdc mkpart primary 1 201m
404 parted /dev/sdc print
405 pvcreate /dev/sdb /dev/sdc1 -v
406 pvcreate /dev/sdb /dev/sdc1 -v > outputofpvcreate
407 lsblk
408 vgcreate vg01 -s 16 /dev/sdb /dev/sdc1 -v
409 cat pvsoutput
410 cat outputofpvcreate
411 vgs vg01
412 vgscan
413 vgdisplay
414 vgdisplay -v
415 vgdisplay -v vg01
416 pvs
417 pvscan
418 pvdisplay /dev/sdb
419 pvdisplay /dev/sdb > pvdisplaydevsdb
420 pvdisplay /dev/vdc1
421 pvdisplay /dev/sdc1
422 lvcreate -n lvol0 -L 600MB vg01 -v
423 lvcreate -n oravol -L 1.3g vg01 -v
424 lvs
425 lvscan
426 lvdisplay
427 lvdisplay /dev/vg01/lvol0
428 lvdisplay /dev/vg01/oravol
429 vgextend vg01 /dev/sdd -v [need to initialize with pvcreate]
430 pvcreate /dev/sdd
431 vgextend vg01 /dev/sdd -v
432 vgs vg01
433 vgscan
434 lvextend /dev/vg01/lvol0 -L 1g -v
435 lvextend /dev/vg01/oravol -L 2g -v
436 lvdisplay oravol0
437 lvdisplay /dev/vg01/oravol
438 vgdisplay -v vg01
439 lvrename /dev/vg01/lvol0 lvolnew -v
440 lvs /dev/vg01/lvolnew
441 lvs
442 lvs | grep lvolnew
443 lvreduce /dev/vg01/lvolnew -L 800m -v
444 lvresize /dev/vg01/lvolnew -L -100m -v
445 lvremove /dev/vg01/lvolnew
446 lvremove -f /dev/vg01/oravol
447 vgdisplay vg01 | grep 'Cur LV'
448 vgreduce vg01 /dev/sdb /dev/sdc1
449 vgs
450 vgs vg01
451 vgscan
452 lsblk
453 vgdisplay vg01
454 vgdisplay vg01 -v
455 vgremove vg01
456 vgdisplay vg01 -v
457 pvremove /dev/sdb /dev/sdc1 /dev/sdd
458 exit
459 history

Skip to toolbar