Linux LVM

Der Logical Volume Manager LVM2

Ab Suse 9.3 ist der LVM2 im Einsatz.
Hierbei wird nicht mehr das Verzeichnis /proc/lv eingesetzt(dieses ex. auch gar nicht mehr), sondern ein sog.Mapper-Verzeichnis /dev/mapper, in dem fuer jedes LV ein Blockdevice enthalten ist.

Wird z.B.das LV /dev/system/logdbs_001 erstellt, so ist
dessen devicename /dev/system/logdbs_001 ein symbolischer Link:

/dev/system/logdbs_001 -> /dev/mapper/system-logdbs_001

Die Datei /dev/mapper/system-logdbs_001 ist ein Blockdevice, das urspruenglich eben nur ein Blockdevice war, dann aber mit dem Raw-Kommando an ein Raw-Device gebunden wurde:

libelle$ls -ail /dev/mapper/system-logdbs_001
79744 brw-rw----  1 informix informix 253, 0 2005-07-18 19:17 /dev/mapper/system-logdbs_001

Diese Raw-Anbindung ist seit Informix 10.0 nicht mehr notwendig.


lvscan

        
        libelle:/home/informix # lvscan
        lvscan -- ACTIVE            "/dev/system/data2" [5 GB]
        lvscan -- ACTIVE            "/dev/system/data1" [2.90 GB]
        lvscan -- ACTIVE            "/dev/system/inf" [2 GB]
        lvscan -- ACTIVE            "/dev/system/data3" [2 GB]
        lvscan -- 4 logical volumes with 11.90 GB total in 1 volume group
        lvscan -- 4 active logical volumes

lvdisplay Anzeigen der Eigenschaften eines LV

      
        libelle:/home/informix # lvdisplay /dev/system/data2
        --- Logical volume --- 
        LV Name                /dev/system/data2
        VG Name                system
        LV Write Access        read/write
        LV Status              available
        LV #                   1
        # open                 0
        LV Size                5 GB
        Current LE             1279
        Allocated LE           1279
        Allocation             next free
        Read ahead sectors     1024
        Block device           58:0

lvremove Entfernen eines LV

        libelle:/home/informix # lvremove /dev/system/data2
        lvremove -- do you really want to remove "/dev/system/data2"? [y/n]: y
        lvremove -- doing automatic backup of volume group "system"
        lvremove -- logical volume "/dev/system/data2" successfully removed

lvcreate Erstellen eines neuen Volumes

        libelle:/home/informix # lvcreate -L 100M -n otto  system
        lvcreate -- doing automatic backup of "system"
        lvcreate -- logical volume "/dev/system/otto" successfully created
        libelle:/home/informix # lvscan
        lvscan -- ACTIVE            "/dev/system/otto" [100 MB]
        lvscan -- ACTIVE            "/dev/system/data1" [2.90 GB]
        lvscan -- ACTIVE            "/dev/system/data3" [2 GB]
        lvscan -- 3 logical volumes with 5 GB total in 1 volume group
        lvscan -- 3 active logical volumes

lvmdiskscan Anzeige aller Partitionen incl. LVM-Partitionen

libelle:/home/informix # lvmdiskscan
        lvmdiskscan -- reading all disks / partitions (this may take a while...)
        lvmdiskscan -- /dev/hda1   [        502 MB] Primary  LINUX swap partition [0x82]
        lvmdiskscan -- /dev/hda2   [       8.58 GB] Primary  LINUX native partition [0x83]
        lvmdiskscan -- /dev/hda5   [       4.99 GB] Extended LVM partition [0x8E]
        lvmdiskscan -- /dev/hda6   [          5 GB] Extended LVM partition [0x8E]
        lvmdiskscan -- /dev/hda7   [       2.01 GB] Extended LVM partition [0x8E]
        lvmdiskscan -- 1 disk
        lvmdiskscan -- 0 whole disks
        lvmdiskscan -- 0 loop devices
        lvmdiskscan -- 0 multiple devices
        lvmdiskscan -- 0 network block devices
        lvmdiskscan -- 5 partitions
        lvmdiskscan -- 3 LVM physical volume partitions

Befehle fuer die physical Volumes

        /sbin/pvchange
        /sbin/pvcreate
        /sbin/pvdata
        /sbin/pvdisplay
        /sbin/pvmove
        /sbin/pvpath
        /sbin/pvpathrestore
        /sbin/pvpathsave
        /sbin/pvscan

pvscan - Lesen aller PV


        libelle$pvscan
                pvscan -- reading all physical volumes (this may take a while...)
                pvscan -- ACTIVE   PV "/dev/hda5" of VG "system" [4.99 GB / 2.09 GB free]
                pvscan -- ACTIVE   PV "/dev/hda6" of VG "system" [5 GB / 4.84 GB free]
                pvscan -- ACTIVE   PV "/dev/hda7" of VG "system" [2 GB / 2 GB free]
                pvscan -- total: 3 [12 GB] / in use: 3 [12 GB] / in no VG: 0 [0]

pvdisplay:

        libelle$pvdisplay  /dev/hda6
        --- Physical volume ---
        PV Name               /dev/hda6
        VG Name               system
        PV Size               5 GB [10490382 secs] / NOT usable 4.19 MB [LVM: 132 KB]
        PV#                   1
        PV Status             available
        Allocatable           yes
        Cur LV                3
        PE Size (KByte)       4096
        Total PE              1279
        Free PE               1240
        Allocated PE          39
        PV UUID               LExZaA-5ETi-OOYg-Xr5Q-mNLT-1Vgf-zkTJQN

pvdata: Was ist in einem Physical Volume enthalten?

        libelle$pvdata /dev/hda6 | more
        --- Physical volume ---
        PV Name               /dev/hda6
        VG Name               system
        PV Size               5 GB [10490382 secs] / NOT usable 4.19 MB [LVM: 132 KB]
        PV#                   1
        PV Status             available
        Allocatable           yes
        Cur LV                3
        PE Size (KByte)       4096
        Total PE              1279
        Free PE               1240
        Allocated PE          39
        PV UUID               LExZaA-5ETi-OOYg-Xr5Q-mNLT-1Vgf-zkTJQN

        --- Volume group ---
        VG Name
        VG Access             read/write
        VG Status             NOT available/resizable
        VG #                  0
        MAX LV                256
        Cur LV                4
        Open LV               0
        MAX LV Size           255.99 GB
        Max PV                256
        Cur PV                3
        Act PV                3
        VG Size               11.98 GB
        PE Size               4 MB
        Total PE              3068
Alloc PE / Size       782 / 3.05 GB
        Free  PE / Size       2286 / 8.93 GB
        VG UUID               EAkvB8-UpzB-tFUp-rGS2-qKu2-LZyG-2vjCCp

        --- List of logical volumes ---

        pvdata -- logical volume "/dev/system/rinf_001_2" at offset   0
        pvdata -- logical volume "/dev/system/data1" at offset   1
        pvdata -- logical volume "/dev/system/rinf_001_1" at offset   2
        pvdata -- logical volume "/dev/system/physdbs" at offset   3
        pvdata -- logical volume struct at offset   4 is empty
        pvdata -- logical volume struct at offset   5 is empty
        pvdata -- logical volume struct at offset   6 is empty
        pvdata -- logical volume struct at offset   7 is empty
        pvdata -- logical volume struct at offset   8 is empty
        pvdata -- logical volume struct at offset   9 is empty
        .......................
        pvdata -- logical volume struct at offset 253 is empty
        pvdata -- logical volume struct at offset 254 is empty
        pvdata -- logical volume struct at offset 255 is empty
        --- List of physical volume UUIDs ---

        001: LExZaA-5ETi-OOYg-Xr5Q-mNLT-1Vgf-zkTJQN
        002: vhTaiK-hMwg-DwIa-BtLg-hxUN-Dgbf-XlrOw7
        003: 2jUJHN-snuS-ng9q-WbOx-xZDi-Fe29-ZAsWEi


Befehle fuer die Volume Groups:

        vgcfgbackup
        vgcfgrestore
        vgchange
        vgck
        vgcreate
        vgdisplay
        vgexport
        vgextend
        vgimport
        vgmerge
        vgmknodes
        vgreduce
        vgremove
        vgrename
        vgscan
        vgsplit

vgscan (listet die Volumegroups auf):

        libelle$vgscan
        vgscan -- reading all physical volumes (this may take a while...)
        vgscan -- found active volume group "system"  -----------> auf libelle gibt es kein anderes.
        vgscan -- "/etc/lvmtab" and "/etc/lvmtab.d" successfully created
        vgscan -- WARNING: This program does not do a VGDA backup of your volume group


vgdisplay vg-name Listet alle Eigenschaften einer Volume-Group auf

        libelle$vgdisplay system
        --- Volume group ---
        VG Name               system
        VG Access             read/write
        VG Status             available/resizable
        VG #                  0
        MAX LV                256
        Cur LV                4
        Open LV               2
        MAX LV Size           255.99 GB
        Max PV                256
        Cur PV                3
        Act PV                3
        VG Size               11.98 GB
        PE Size               4 MB
        Total PE              3068
        Alloc PE / Size       782 / 3.05 GB
        Free  PE / Size       2286 / 8.93 GB
        VG UUID               EAkvB8-UpzB-tFUp-rGS2-qKu2-LZyG-2vjCCp


vgdisplay: Ueberblick ueber die gesamte Volumegroup

# vgdisplay  --verbose system
--- Volume group ---
VG Name               system
VG Access             read/write
VG Status             available/resizable
VG #                  0
MAX LV                256
Cur LV                5
Open LV               4
MAX LV Size           255.99 GB
Max PV                256
Cur PV                3
Act PV                3
VG Size               11.98 GB
PE Size               4 MB
Total PE              3068
Alloc PE / Size       795 / 3.11 GB
Free  PE / Size       2273 / 8.88 GB --------------------------------> 8,88 GB sind jetzt noch frei.
VG UUID               EAkvB8-UpzB-tFUp-rGS2-qKu2-LZyG-2vjCCp

--- Logical volume ---
LV Name                /dev/system/db1_001
VG Name                system
LV Write Access        read/write
LV Status              available
LV #                   1
# open                 2
LV Size                52 MB
Current LE             13
Allocated LE           13 ----------------------------------> weil die PE-Size 4 MB ist.
Allocation             next free
Read ahead sectors     1024
Block device           58:0

--- Logical volume ---
LV Name                /dev/system/data1
VG Name                system
LV Write Access        read/write
LV Status              available
LV #                   2
# open                 0
LV Size                2.90 GB
Current LE             743
Allocated LE           743
Allocation             next free
Read ahead sectors     1024
Block device           58:1

--- Logical volume ---
LV Name                /dev/system/rinf_001_1
VG Name                system
LV Write Access        read/write
LV Status              available
LV #                   3
# open                 7
LV Size                52 MB
Current LE             13
Allocated LE           13
Allocation             next free
Read ahead sectors     1024
Block device           58:2

--- Logical volume ---
LV Name                /dev/system/physdbs
VG Name                system
LV Write Access        read/write
LV Status              available
LV #                   4
# open                 1
LV Size                52 MB
Current LE             13
Allocated LE           13
Allocation             next free
Read ahead sectors     1024
Block device           58:3


--- Logical volume ---
LV Name                /dev/system/db2_001
VG Name                system
LV Write Access        read/write
LV Status              available
LV #                   5
# open                 2
LV Size                52 MB
Current LE             13
Allocated LE           13
Allocation             next free
Read ahead sectors     1024
Block device           58:4

---------------------------------------------------------> Und jetzt kommen die Physical Volumes,
                                                           aus denen die Volumegroup besteht:
--- Physical volumes ---
PV Name (#)           /dev/hda5 (2)
PV Status             available / allocatable
Total PE / Free PE    1277 / 534

PV Name (#)           /dev/hda6 (1)
PV Status             available / allocatable
Total PE / Free PE    1279 / 1227

PV Name (#)           /dev/hda7 (3)
PV Status             available / allocatable
Total PE / Free PE    512 / 512


sfdisk (besseres fdisk)

Welche Platten gibt es? (sfdisk -s)

libelle:/home/f995440/wissen # sfdisk -s
/dev/hda:  40209120
zusammen: 40209120 BlC6cke

Partitionen auf einer Platte: sfdisk -l /dev/hda

libelle:/home/f995440/wissen # sfdisk -l /dev/hda

Festplatte /dev/hda: 79780 Zylinder, 16 KC6pfe, 63 Sektoren/Spur
Warnung: erweiterte Partition beginnt nicht an einer Zylindergrenze
DOS und Linux werden den Inhalt unterschiedlich interpretieren.
Warning: The partition table looks like it was made
  for C/H/S=*/255/63 (instead of 79780/16/63).
For this listing I'll assume that geometry.
Einheit = Zylinder von 8225280 Bytes, BlC6cke von 1024 Bytes, ZC$hlung beginnt bei 0

   GerC$t  boot. Anfang   Ende  #Zyl.    #BlC6cke   Id  System
/dev/hda1          0+     63      64-    514048+  82  Linux Swap / Solaris
/dev/hda2         64    1184-   1121-   9000000+  83  Linux
/dev/hda3       1185    5004    3820   30684150    f  W95 Erw. (LBA)
/dev/hda4          0       -       0          0    0  Leer
/dev/hda5       1185+   1836     652-   5237158+  8e  Linux LVM
/dev/hda6       1837+   2489     653-   5245191   8e  Linux LVM
/dev/hda7       2490+   2751     262-   2104483+  8e  Linux LVM
/dev/hda8       2752+   3796    1045-   8393931   83  Linux
/dev/hda9       3797+   5004    1208-   9703228+  83  Linux

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
CAPTCHA
Diese Frage dient dazu festzustellen, ob Sie ein Mensch sind und um automatisierte SPAM-Beiträge zu verhindern.
9 + 0 =
Lösen Sie dieses einfache mathematische Problem und geben Sie das Ergebnis ein. Für 1 + 3 geben Sie z.B. 4 ein.