Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to mount a LVM?

126 views
Skip to first unread message

Robert Latest

unread,
Nov 24, 2016, 1:40:04 PM11/24/16
to
Hey all,

I got it to work ONCE, but for the life of me I can't figure out how to do it again.

This is what I think I did the first time, but for the second time it just doesn't work.

root@dotcom:~# mdadm --assemble --scan
mdadm: /dev/md/2 has been started with 1 drive.
mdadm: /dev/md/3 has been started with 1 drive.

---OK, good so far. Now let's find the LVs

root@dotcom:~# lvmdiskscan
  /dev/loop0 [     213.51 MiB]
  /dev/loop1 [     206.55 MiB]
  /dev/sda1  [      30.00 GiB]
  /dev/loop2 [     220.89 MiB]
  /dev/md2   [     926.91 GiB] LVM physical volume
  /dev/loop3 [     208.05 MiB]
  /dev/md3   [     926.91 GiB] LVM physical volume
  /dev/sda5  [       2.00 GiB]
  /dev/sda6  [      30.00 GiB]
  /dev/sda7  [     200.00 GiB]
  /dev/sda8  [     203.76 GiB]
  /dev/sdb1  [       2.37 GiB]
  /dev/sdb2  [       2.00 GiB]
  /dev/sdc1  [       2.37 GiB]
  /dev/sdc2  [       2.00 GiB]
  /dev/sdd1  [     465.76 GiB]
  /dev/sde1  [     149.05 GiB]
  0 disks
  15 partitions
  0 LVM physical volume whole disks
  2 LVM physical volumes

---Still looking good. Now I'm supposed to find the logical volumes,
---but lvdisplay simply doesn't show anything.

root@dotcom:~# lvdisplay
root@dotcom:~#

---Now I'm stuck. All LVM instructions I find on the Internet say that I find the path of the LVM device by using lvdisplay. Also I know that one hour ago I had my volumes mounted and was copying data from them. After properly syncing and unmounting them, and stopping the LVM and md thingys, I'm stuck now.

Any suggestions?

robert

Roland Müller

unread,
Nov 24, 2016, 5:00:05 PM11/24/16
to
Hello,
I have a problem to understand what is actually your issue with LVM. Was
your system working before and now logical volumes that were existing
before disappeared?

What is the situation with volume group or groups? What does vgscan or
vgs commands say?

BR,

Roland

Nicolas George

unread,
Nov 24, 2016, 5:30:04 PM11/24/16
to
Le quartidi 4 frimaire, an CCXXV, Robert Latest a écrit :
> root@dotcom:~# lvmdiskscan
...
> 15 partitions
> 0 LVM physical volume whole disks
> 2 LVM physical volumes
>
> ---Still looking good. Now I'm supposed to find the logical volumes,
> ---but lvdisplay simply doesn't show anything.
>
> root@dotcom:~# lvdisplay

I do not see a "vgchange -a" call.

Regards,

--
Nicolas George
signature.asc

Alexandre GRIVEAUX

unread,
Nov 25, 2016, 8:20:04 AM11/25/16
to
Hello

Try using lvscan ?

Rick Thomas

unread,
Nov 25, 2016, 9:10:05 AM11/25/16
to
try “vgchange -aay /dev/md[23]” which should “activate” any volume groups on those devices and find the logical volumes they create.

Robert Latest

unread,
Nov 25, 2016, 12:50:06 PM11/25/16
to
Hi guys,

thanks for trying to help.

Here's the whole story: The two 1 TB disks originally were in a Synology NAS unit, not configured (to my knowledge) as any kind of RAID. The second disk was only physically installed in the NAS after the first one had been filling up. The NAS GUI showed the disks as two separate volume groups, vg1 and vg1000. I wanted to upgrade the disks to bigger size, so I took them out of the NAS and connected them directly to my Linux PC (using a USB docking station), wanting to copy the data to a couple of new disks installed in the NAS. I then went through a very steep (and incomplete) learning curve about mdadm and lvm and finally managed to mount the volumes. I could see and read all my files and stuff.

Because I wasn't yet ready to initiate the big data transfer, I unmounted the LVM disks, stopped the md stuff, and turned off the computer. When I turned it back on, I couldn't get the LVM working again. All that happens is that a tiny device "/dev/vg1/syno_vg_reserved_area" is created.

From my first trial I remember that when I read data from one of the volumes, only the corresponding LED from one drive of the USB dock flashed, from which I conclude that I definetely don't have any kind of "real" RAID on those disks. Note however the output of vgchange (below) which mentions something about a degraded RAID.

I tried re-installing the disks into the NAS. One of the disks is now reported as "Crashed", and nothing is mounted. As far as I can see all LVM metadata is intact on the disks. I also think that the data must be largely intact because so far I only did reading operations on the disks (but didn't mount them read-only the first time round).

Fortunately the data on the disks is not really essential, but a huge amount of work archiving a large CD and DVD collection... is there any way to rescure this stuff?

Here's what I tried on the Linux box so far:

root@dotcom:/home/dh# mdadm --assemble --scan

mdadm: /dev/md/3 has been started with 1 drive.
mdadm: /dev/md/2 has been started with 1 drive.
root@dotcom:/home/dh# lvmdiskscan
  /dev/loop0 [     213.51 MiB]
  /dev/loop1 [     208.05 MiB]
  /dev/sda1  [      30.00 GiB]
  /dev/loop2 [     220.89 MiB]
  /dev/md2   [     926.91 GiB] LVM physical volume
  /dev/loop3 [     206.55 MiB]
  /dev/md3   [     926.91 GiB] LVM physical volume
  /dev/sda5  [       2.00 GiB]
  /dev/sda6  [      30.00 GiB]
  /dev/sda7  [     200.00 GiB]
  /dev/sda8  [     203.76 GiB]
  /dev/sdb1  [     465.76 GiB]
  /dev/sdc1  [     149.05 GiB]
  /dev/sdd1  [       2.37 GiB]
  /dev/sdd2  [       2.00 GiB]
  /dev/sde1  [       2.37 GiB]
  /dev/sde2  [       2.00 GiB]
  0 disks
  15 partitions
  0 LVM physical volume whole disks
  2 LVM physical volumes

root@dotcom:/home/dh# vgdisplay
  --- Volume group ---
  VG Name               vg1000
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               926.90 GiB
  PE Size               4.00 MiB
  Total PE              237287
  Alloc PE / Size       0 / 0  
  Free  PE / Size       237287 / 926.90 GiB
  VG UUID               9PQXmK-0dqN-3I11-1CbR-3ND3-okUD-WcySR3
  
  --- Volume group ---
  VG Name               vg1
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               926.91 GiB
  PE Size               4.00 MiB
  Total PE              237290
  Alloc PE / Size       3 / 12.00 MiB
  Free  PE / Size       237287 / 926.90 GiB
  VG UUID               srS6Ku-i7PP-9xoZ-6kFf-IWiG-Uu9J-DcicaM


 root@dotcom:~# vgchange -v -ay vg1000
    DEGRADED MODE. Incomplete RAID LVs will be processed.
    Using volume group(s) on command line
    Finding volume group "vg1000"
  0 logical volume(s) in volume group "vg1000" now active
root@dotcom:~# vgchange -v -ay vg1
    DEGRADED MODE. Incomplete RAID LVs will be processed.
    Using volume group(s) on command line
    Finding volume group "vg1"
    Activating logical volume "syno_vg_reserved_area".
    activation/volume_list configuration setting not defined: Checking only host tags for vg1/syno_vg_reserved_area
    Creating vg1-syno_vg_reserved_area
    Loading vg1-syno_vg_reserved_area table (254:0)
    Resuming vg1-syno_vg_reserved_area (254:0)
    Activated 1 logical volumes in volume group vg1
  1 logical volume(s) in volume group "vg1" now active

root@dotcom:~# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg1/syno_vg_reserved_area
  LV Name                syno_vg_reserved_area
  VG Name                vg1
  LV UUID                ZvVm6T-FDWz-zaF4-7M4P-20i5-gXyB-4M56Hj
  LV Write Access        read/write
  LV Creation host, time ,
  LV Status              available
  # open                 0
  LV Size                12.00 MiB
  Current LE             3
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
  
root@dotcom:~# vgs
  VG     #PV #LV #SN Attr   VSize   VFree 
  vg1      1   1   0 wz--n- 926.91g 926.90g
  vg1000   1   0   0 wz--n- 926.90g 926.90g




Cindy-Sue Causey

unread,
Nov 25, 2016, 2:50:03 PM11/25/16
to
On 11/24/16, Robert Latest <bobl...@gmail.com> wrote:
> Hey all,
>
> I got it to work ONCE, but for the life of me I can't figure out how to do
> it again.
>
> This is what I think I did the first time, but for the second time it just
> doesn't work.
>
> root@dotcom:~# mdadm --assemble --scan
> mdadm: /dev/md/2 has been started with 1 drive.
> mdadm: /dev/md/3 has been started with 1 drive.
>
> ---OK, good so far. Now let's find the LVs
> < snipped for brevity >
>
> ---Still looking good. Now I'm supposed to find the logical volumes,
> ---but lvdisplay simply doesn't show anything.
>
> root@dotcom:~# lvdisplay
> root@dotcom:~#
>
> ---Now I'm stuck. All LVM instructions I find on the Internet say that I
> find the path of the LVM device by using lvdisplay. Also I know that one
> hour ago I had my volumes mounted and was copying data from them. After
> properly syncing and unmounting them, and stopping the LVM and md thingys,
> I'm stuck now.
>
> Any suggestions?

What about hitting your up and down arrows while in your terminal?
Doesn't always work, especially if you open more than one [session] in
your favored terminal. That brings to mind to say that not all
terminal packages may honor that FABULOUS feature, either. The reason
it doesn't always report all recent previous commands under multiple
open tabs/windows is that it appears to cherry pick the commands from
the last window closed at any given point.

For new users: If provided as a terminal's feature, up and down arrows
will present previous commands issued up to some finite point. It will
provide what was issued under the user who is performing that feature,
i.e. my user "elf" cannot search previous terminal commands for user
"root" or "candycane". #TrueStory :D

You could also try grep'ing your system files for those known commands
that are still successful for you. My rationale is that maybe there's
a terminal related log file lurking around.

One very minor caveat (translation: annoyance) to those searches is
that I tried it just now and landed at /var/log/auth.log for that
*that* grep command I was performing *that very second* while using
root access (via sudo). I always get excited when a potentially useful
file is found but then turns out to "only" be the related query I'm
performing at precisely that second.

Hope that maybe helps.. :)

Cindy :)

--
Cindy-Sue Causey
Talking Rock, Pickens County, Georgia, USA

* runs with plastic sporks (too) *

Pascal Hambourg

unread,
Nov 25, 2016, 4:20:03 PM11/25/16
to
Le 25/11/2016 à 20:43, Cindy-Sue Causey a écrit :
>
> For new users: If provided as a terminal's feature, up and down arrows
> will present previous commands issued up to some finite point.

Command history has nothing to do with the terminal. It is a shell
(command interpreter) feature.

Robert Latest

unread,
Nov 25, 2016, 5:00:03 PM11/25/16
to
Hi all,

I solved my problem: Somehow I must have corrupted the metadata in my
volume groups. Scanning through the directory /etc/lvm/archive on the
NAS and my linux box, there were several historical configuration
files for each of my disks. I found the files that represented the
last working setups for my disks, restored these using "vgcfgrestore"
, and was up and running again.

Thanks,
robert

David Wright

unread,
Nov 25, 2016, 11:20:03 PM11/25/16
to
On Fri 25 Nov 2016 at 14:43:34 (-0500), Cindy-Sue Causey wrote:

> The reason it doesn't always report all recent previous commands
> under multiple open tabs/windows is that it appears to cherry pick
> the commands from the last window closed at any given point.

Each time you close a window, its shell (say, bash) appends its
command history list¹ to ~/.bash_history and the new version of this
file will be read by any fresh invocation of bash.

So each instance of a shell will have its own command history list,
consisting of the commands you typed into it, and the contents of
~/.bash_history when it started running.

As for cherry picking, one can control what gets remembered in the
history list (with bash's HIST* variables), but it's not a random
selection as seems to have been implied.

BTW each user has their own history files. Exposing them to other
users would be a security breach, despite the fact that most of the
information contained therein might have been observable at some time
or other with the ps command.

¹ just the commands issued in this session, not including those read
from ~/.bash_history when bash started.

Cheers,
David.
0 new messages