본문 바로가기
IT/linux

Linux LVM LV attr 정보 조회

by 방구석꼰머 2022. 10. 18.
반응형

이번 포스팅에서는 Linux 서버 LVM에서 LV의 정보를 조회할 수 있는 “lvs” 명령어와 관련 lv 정보에 대해 자세히 알아보도록 하겠습니다.

 

이 포스팅은 아래의 버전에서 테스트한 내용을 기반으로 작성하였습니다
Linux : Red Hat Enterprise Linux release 8.6

 

1. Logical volume (LV) 정보 조회

LV 정보를 조회하는 명령은 lvs 가 있습니다. 먼저 lvs를 수행해 보도록 하겠습니다.

lvs를 수행하면 현재 만들어져 있는 lv의 기본 정보를 표시합니다.

 

# lvs

# lvs
  LV      VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  testlv  testvg -wi-ao----   5.00g
  testlv2 testvg -wi-a----- <10.00g

lvs의 각 필드의 정보는 아래와 같습니다.

 

LV : LV name

VG : LV가 할당된 VG

Attr : LV의 상태(속성), LV Attr 은 아래의 속성을 나타냅니다. ( 속성의 왼쪽부터 )

  • 첫 번째 속성 항목 : Volume type : (C)ache, (m)irrored, (M)irrored without initial sync, (o)rigin, (O)rigin with merging snapshot, (r)aid,  (R)aid  without  initial  sync, (s)napshot, merging (S)napshot, (p)vmove, (v)irtual, mirror or raid (i)mage, mirror or raid (I)mage out-of-sync, mirror (l)og device, under (c)onver‐sion, thin (V)olume, (t)hin pool, (T)hin pool data, v(d)o pool, v(D)o pool data, raid or pool m(e)tadata or pool metadata spare.
  • 두 번째 속성 항목 : Permissions : (w)riteable, (r)ead-only, (R)ead-only activation of non-read-only volume
  • 세 번째 속성 항목 : Allocation policy :  (a)nywhere, (c)ontiguous, (i)nherited, c(l)ing, (n)ormal
  • 네 번째 속성 항목 : fixed (m)inor
  • 다섯 번째 속성 항목 : State :  (a)ctive,  (h)istorical,  (s)uspended,  (I)nvalid snapshot, invalid (S)uspended snapshot, snapshot (m)erge failed, suspended snapshot (M)erge failed, mapped (d)evice present without tables, mapped device present with (i)nactive table, thin-pool (c)heck needed,  suspended  thin-pool  (C)heck needed, (X) unknown
  • 여섯 번째 속성 항목 : device (o)pen, (X) unknown
  • 일곱 번째 속성 항목 : Target  type : (C)ache, (m)irror, (r)aid, (s)napshot, (t)hin, (u)nknown, (v)irtual.
  • 여덟 번째 속성 항목 : Newly-allocated data blocks are overwritten with blocks of (z)eroes before use.
  • 아홉 번째 속성 항목 : Volume Health : (p)artial, (X) unknown, (r)efresh needed, (m)ismatches exist, (w)ritemostly, (F)ailed, out of (D)ata space, (M)etadata read only,
  • 열 번째 속성 항목 : s(k)ip activation : this volume is flagged to be skipped during activation.

LSize : LV의 크기

Pool : cache/thin/vdo 볼륨의 경우 이 볼륨에 대한 cache/thin/vdo pool LV

Origin : 스냅숏 및 thin의 경우 이 LV의 원본 장치

Data% : 활성화 LV의 데이터 비율

Meta% : 활성화 LV의 메타데이터 비율

Move : pvmove에 의해 생성된 임시 LV의 소스 PV

Log : 미러 로그 장치

Cpy%Sync : 캐시, RAID, 미러 및 pvmove의 경우 현재 동기화 비율

Convert : lvconvert에 의해 생성된 임시 LV의 이름

 

“-o help” 옵션을 함께 수행하여 lv의 모든 필드 정보를 확인할 수 있습니다.

# lvs -o help

Logical Volume Fields
  ---------------------
    lv_all                      - All fields in this section.
    lv_uuid                     - Unique identifier.
    lv_name                     - Name.  LVs created for internal use are enclosed in brackets.
    lv_full_name                - Full name of LV including its VG, namely VG/LV.
    lv_path                     - Full pathname for LV. Blank for internal LVs.
    lv_dm_path                  - Internal device-mapper pathname for LV (in /dev/mapper directory).
    lv_parent                   - For LVs that are components of another LV, the parent LV.
    lv_layout                   - LV layout.
    lv_role                     - LV role.
    lv_initial_image_sync       - Set if mirror/RAID images underwent initial resynchronization.
    lv_image_synced             - Set if mirror/RAID image is synchronized.
    lv_merging                  - Set if snapshot LV is being merged to origin.
    lv_converting               - Set if LV is being converted.
    lv_allocation_policy        - LV allocation policy.
    lv_allocation_locked        - Set if LV is locked against allocation changes.
    lv_fixed_minor              - Set if LV has fixed minor number assigned.
    lv_skip_activation          - Set if LV is skipped on activation.
    lv_autoactivation           - Set if LV autoactivation is enabled.
    lv_when_full                - For thin pools, behavior when full.
    lv_active                   - Active state of the LV.
    lv_active_locally           - Set if the LV is active locally.
    lv_active_remotely          - Set if the LV is active remotely.
    lv_active_exclusively       - Set if the LV is active exclusively.
    lv_major                    - Persistent major number or -1 if not persistent.
    lv_minor                    - Persistent minor number or -1 if not persistent.
    lv_read_ahead               - Read ahead setting in current units.
    lv_size                     - Size of LV in current units.
    lv_metadata_size            - For thin and cache pools, the size of the LV that holds the metadata.
    seg_count                   - Number of segments in LV.
    origin                      - For snapshots and thins, the origin device of this LV.
    origin_uuid                 - For snapshots and thins, the UUID of origin device of this LV.
    origin_size                 - For snapshots, the size of the origin device of this LV.
    lv_ancestors                - LV ancestors ignoring any stored history of the ancestry chain.
    lv_full_ancestors           - LV ancestors including stored history of the ancestry chain.
    lv_descendants              - LV descendants ignoring any stored history of the ancestry chain.
    lv_full_descendants         - LV descendants including stored history of the ancestry chain.
    raid_mismatch_count         - For RAID, number of mismatches found or repaired.
    raid_sync_action            - For RAID, the current synchronization action being performed.
    raid_write_behind           - For RAID1, the number of outstanding writes allowed to writemostly devices.
    raid_min_recovery_rate      - For RAID1, the minimum recovery I/O load in kiB/sec/disk.
    raid_max_recovery_rate      - For RAID1, the maximum recovery I/O load in kiB/sec/disk.
    raidintegritymode           - The integrity mode
    raidintegrityblocksize      - The integrity block size
    integritymismatches         - The number of integrity mismatches.
    move_pv                     - For pvmove, Source PV of temporary LV created by pvmove.
    move_pv_uuid                - For pvmove, the UUID of Source PV of temporary LV created by pvmove.
    convert_lv                  - For lvconvert, Name of temporary LV created by lvconvert.
    convert_lv_uuid             - For lvconvert, UUID of temporary LV created by lvconvert.
    mirror_log                  - For mirrors, the LV holding the synchronisation log.
    mirror_log_uuid             - For mirrors, the UUID of the LV holding the synchronisation log.
    data_lv                     - For cache/thin/vdo pools, the LV holding the associated data.
    data_lv_uuid                - For cache/thin/vdo pools, the UUID of the LV holding the associated data.
    metadata_lv                 - For cache/thin pools, the LV holding the associated metadata.
    metadata_lv_uuid            - For cache/thin pools, the UUID of the LV holding the associated metadata.
    pool_lv                     - For cache/thin/vdo volumes, the cache/thin/vdo pool LV for this volume.
    pool_lv_uuid                - For cache/thin/vdo volumes, the UUID of the cache/thin/vdo pool LV for this volume.
    lv_tags                     - Tags, if any.
    lv_profile                  - Configuration profile attached to this LV.
    lv_lockargs                 - Lock args of the LV used by lvmlockd.
    lv_time                     - Creation time of the LV, if known
    lv_time_removed             - Removal time of the LV, if known
    lv_host                     - Creation host of the LV, if known.
    lv_modules                  - Kernel device-mapper modules required for this LV.
    lv_historical               - Set if the LV is historical.
…

 

 

“-v” 옵션을 사용하면 #Seg, LProfile 및 LV UUID 등의 추가 정보를 함께 표시합니다.

# lvs -v

# lvs -v
  LV      VG     #Seg Attr       LSize   Maj Min KMaj KMin Pool Origin Data%  Meta%  Move Cpy%Sync Log Convert LV UUID                                LProfile
  testlv  testvg    1 -wi-ao----   5.00g  -1  -1  253    0                                                     TL1FU0-T9Au-Fvf1-dh3w-lKcI-Lu6X-gFjx0P
  testlv2 testvg    1 -wi-a----- <10.00g  -1  -1  253    1
  • LV UUID : LV의 UUID
  • LProfile : LV의 profile
  • #Seg : LV의 세그먼트 개수
  • Maj : LV의 영구 major 번호, 지정되지 않은 경우 -1
  • Min : LV의 영구 minor 번호, 지정되지 않은 경우 -1
  • KMaj : LV에 현재 할당된 major 번호, 비활성인 경우 -1
  • KMin : LV에 현재 할당된 minor 번호, 비활성인 경우 -1

 

“-o” 옵션과 확인하고자 하는 필드를 “+”와 함께 지정하여 특정 필드 정보를 추가로 확인할 수 있습니다.

예를 들어 lv_path 필드 정보를 추가로 확인하고자 할 경우 아래와 같이 수행합니다.

# lvs -o +lv_path

# lvs -o +lv_path
  LV      VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Path
  testlv  testvg -wi-ao----   5.00g                                                     /dev/testvg/testlv
  testlv2 testvg -wi-a----- <10.00g                                                     /dev/testvg/testlv2

 

추가 필드를 여러 개 지정할 경우 “,” 구분하여 추가합니다.

# lvs -o +lv_path,lv_time

# lvs -o +lv_path,lv_time
  LV      VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Path                CTime
  testlv  testvg -wi-ao----   5.00g                                                     /dev/testvg/testlv  2022-10-05 02:50:19 +0900
  testlv2 testvg -wi-a----- <10.00g                                                     /dev/testvg/testlv2 2022-10-05 02:56:33 +0900

 

lv 정보는 lvs 외에 “lvdisplay” 명령으로도 관련 정보를 확인할 수 있습니다.

# lvdisplay

--- Logical volume ---
  LV Path                /dev/testvg/testlv
  LV Name                testlv
  VG Name                testvg
  LV UUID                TL1FU0-T9Au-Fvf1-dh3w-lKcI-Lu6X-gFjx0P
  LV Write Access        read/write
  LV Creation host, time server01, 2022-10-05 02:50:19 +0900
  LV Status              available
  # open                 1
  LV Size                5.00 GiB
  Current LE             1280
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

 

 

lvdisplay
lvdisplay

LE는 Logical extent의 약자로 LV의 볼륨의 확장 단위(chunk) 입니다.

 

 

지금까지 Linux 서버 LVM에서 LV 정보를 조회하는 방법에 대해 알아봤습니다.

 

감사합니다.

 

반응형

'IT > linux' 카테고리의 다른 글

Redhat linux 8 LVM 볼륨 증설방법  (0) 2022.10.19
Linux xfs 파일시스템 생성방법  (0) 2022.10.18
Linux LVM VG attr 정보 조회  (0) 2022.10.14
LVM PV attr 정보 조회  (0) 2022.10.12
Redhat Linux 8 LVM 볼륨 생성방법  (0) 2022.10.05

댓글