2

I'm replacing few disks configured with RAID5 at LVM.

The command used to replace is

lvconvert --replace /dev/oldpv vgname/lvname /dev/newpv

It's start the process in background.
The parameter -i # have no effect , either -v

I try a lot of options at lvs -o +<fields> (and pvs, vgs) , no one return this progress..

I want check the progress because are big disks and fews LVs. This take few minutes running , I don't want to start the next LV while the current process still running...

For now I'm monitoring the I/O using dstats/iostats command but this is very ugly way to check this...

2 Answers 2

4

I'm not 100% sure about RAID5, but for mirrors use

# dmsetup status

rootvg-testmirror: 0 9216000 raid raid1 2 AA 3233673/9216000 idle 0

In this example its about 33% when you evalute 3233673/9216000

I haven't enough disks to create a test RAID5, but I'm sure it'll be something similar.

1
  • works perfectly . Do you know if exists some kind of better/friendly viewer for dmsetup status ? (I trying check the answer but the site is returning "an error has occurred" , I will try later).
    – ceinmart
    Sep 8, 2015 at 14:45
1

Expanding on banjo67xxx's answer you can get the percent complete (with decimals) using the following:

echo "(`dmsetup status | tail -n 1 | awk '{print $8}'`)*100" | bc -l

If you want to limit the number of decimal places you use a scale declaration in the string echoed to bc. Here's the same command constrained to 2 decimal places:

echo "scale=2; (`dmsetup status | tail -n 1 | awk '{print $8}'`)*100" | bc -l
1
  • The required line might not be the last one in dmsetup status and the required column might not be the 8th one. I succeeded with echo "100*$(dmsetup status | awk '/snapshot-merge/{print $5}')" | bc -l for snapshot merging on Ubuntu 18.04.
    – Melebius
    Aug 27, 2019 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.