LVM2 builtin raid - how to check raid status

12,116

As far as I understand,

lvs -a -o name,copy_percent,devices yourvgname

will show less than 100% in the copy_percent column if your RAID devices are not in sync yet.

Share:
12,116

Related videos on Youtube

osgx
Author by

osgx

Linux programmer, interested in compilers (with theory and standard-compliance), cryptography, OS and microelectronics design Works deeply with compilers, standard-compliance and OS libraries.

Updated on September 18, 2022

Comments

  • osgx
    osgx over 1 year

    I just created LVM2 builtin RAID1 (something like lvm mirrir, but newer) with lvconvert --type raid1 -m1 /dev/ubuntu/root /dev/sdb5, Ubuntu 12.10.

    How can I check mirror status/health both in command-mode and in GUI from non-root?

    There are my vgs, pvs, lvs (root-only, needed to open /dev/mapper/control):

    # vgs
     VG      #PV #LV #SN Attr   VSize   VFree
     ubuntu    2   2   0 wz--n- 27.52g  916.00m
    # pvs
     PV        VG     Fmt  Attr PSize  PFree
     /dev/sda5 ubuntu lvm2 a--  13.76g 408.00m
     /dev/sdb5 ubuntu lvm2 a--  13.76g 508.00m
    # lvs
     LV     VG     Attr     LSize   Pool Origin Data% Move Log Copy%  Convert
     root   ubuntu rwi-aom-  13.26G                            100.00
     swap_1 ubuntu -wi-ao-- 100.00m
    # lvs -a
     LV              VG     Attr     LSize   Pool Origin Data% Move Log Copy%  Convert
     root            ubuntu rwi-aom-  13.26G                            100.00
     [root_rimage_0] ubuntu iwi-aor-  13.26G
     [root_rimage_1] ubuntu iwi-aor-  13.26G
     [root_rmeta_0]  ubuntu ewi-aor-   4.00m
     [root_rmeta_1]  ubuntu ewi-aor-   4.00m
     swap_1          ubuntu -wi-ao-- 100.00m
    

    My /proc/mdstat is empty:

    # cat /proc/mdstat
    Personalities : [raid6] [raid5] [raid4] [raid1] [linear] [multipath] [raid0] [raid10]
    unused devices: <none>
    #
    

    There are files from my /dev/mapper, most are symlinks to dm-*:

    control
    ubuntu-root -> ../dm-4
    ubuntu-root_rimage_0 -> ../dm-1
    ubuntu-root_rimage_1 -> ../dm-3
    ubuntu-root_rmeta_0 -> ../dm-0
    ubuntu-root_rmeta_0 -> ../dm-2
    ubuntu-swap_1 -> ../dm-5
    

    There are messages from my dmesg:

    md/raid1:mdX: active with 2 out of 2 mirrors
    created bitmap (14 pages) for device mdX
    mdX: bitmap initialized from disk: read 1 pages, set 42 of 27152 bits
    EXT4-fs (dm-4): mounted filesystem with ordered data mode. Opts: (null)
    

    (Is it normal that some bits are set in bitmap? )

    My dmsetup (root only too):

    # dmsetup table
    ubuntu-root_rimage_1: 0 27803648 linear 8:21 10240
    ubuntu-root_rimage_0: 0 27803648 linear 8:5 2048
    ubuntu-swap_1: 0 204800 linear 8:5 27805696
    ubuntu-root: 0 27803648 raid raid1 3 0 region_size 1024 2 252:0 252:1 252:2 252:3
    ubuntu-root_rmeta_1: 0 8192 linear 8:21 2048
    ubuntu-root_rmeta_0: 0 8192 linear 8:5 28010496
    

    (is my raid setup correct?)