49

After upgrading from 14.04 to 16.06 my system failed.

I have done a fresh install on a new drive, but that failed too...

I have done another install but now when trying to mount my original drive with all my files on I get this message:

pst007x@Home-Server:~$ sudo mount /dev/sdb5 /media/newhd
[sudo] password for pst007x: 
mount: unknown filesystem type 'LVM2_member'
pst007x@Home-Server:~$ 

I have installed 'lvm2' from the repos and gparted sees the drive, however Nautilus does not see the drive and therefore not mounted.

Any advise?

EDIT:

I tried this:

pst007x@Home-Server:~$ sudo apt-get install lvm2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
lvm2 is already the newest version (2.02.133-1ubuntu10).
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
pst007x@Home-Server:~$ sudo vgs
  VG        #PV #LV #SN Attr   VSize   VFree 
  ubuntu-vg   1   2   0 wz--n- 465.28g     0 
  ubuntu-vg   1   2   0 wz--n- 465.52g 52.00m
pst007x@Home-Server:~$ sudo vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "ubuntu-vg" using metadata type lvm2
  Found volume group "ubuntu-vg" using metadata type lvm2
pst007x@Home-Server:~$ sudo lvs
  LV     VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   ubuntu-vg -wi-ao---- 461.28g                                                    
  root   ubuntu-vg -wi------- 461.47g                                                    
  swap_1 ubuntu-vg -wi-------   4.00g                                                    
  swap_1 ubuntu-vg -wi-ao----   4.00g                                                    
pst007x@Home-Server:~$ sudo modprobe dm-mod
pst007x@Home-Server:~$ sudo vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "ubuntu-vg" using metadata type lvm2
  Found volume group "ubuntu-vg" using metadata type lvm2
pst007x@Home-Server:~$ sudo vgchange -ay ubuntu-vg
  device-mapper: create ioctl on ubuntu--vg-rootLVM-xhGIrhlZUAJeJA3fWJOOSvuTUO3vZOH9tqZgBj8dGOLHoYzCStcE02NcX8UGpglD failed: Device or resource busy
  1 logical volume(s) in volume group "ubuntu-vg" now active
pst007x@Home-Server:~$ ls /mnt/
fcroot
pst007x@Home-Server:~$ ls /dev/mapper
control  ubuntu--vg-root  ubuntu--vg-swap_1
pst007x@Home-Server:~$ sudo vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "ubuntu-vg" using metadata type lvm2
  Found volume group "ubuntu-vg" using metadata type lvm2
pst007x@Home-Server:~$ sudo lvscan
  ACTIVE            '/dev/ubuntu-vg/root' [461.28 GiB] inherit
  inactive          '/dev/ubuntu-vg/swap_1' [4.00 GiB] inherit
  inactive          '/dev/ubuntu-vg/root' [461.47 GiB] inherit
  ACTIVE            '/dev/ubuntu-vg/swap_1' [4.00 GiB] inherit
pst007x@Home-Server:~$ 
pst007x
  • 8,052

8 Answers8

76

Not to detract from the accepted answer, but wanted to offer a more complete solution that hasn't failed me yet.

udisksctl unlock -b /dev/sdb5
sudo mkdir /mnt/data
sudo mount /dev/dm-1 /mnt/data

run into mount: unknown filesystem type 'LVM2_member' do the commands below

sudo bash
vgdisplay
vgrename <VG UUID> new_name
modprobe dm-mod
vgchange -ay
lvscan
mount /dev/new_name/root /mnt/data/
15

You used the exact same name (ubuntu-vg) for your new volume group as the old volume group. You must give them unique names. You can rename one of the groups using vgrename and its UUID.

Find the UUID with vgdisplay and then rename the volume group:

vgrename <VG UUID> new_name
fsimon
  • 3
psusi
  • 37,551
7

Try the following steps from the shell:

sudo cryptsetup isLuks /dev/sdb5 -v
sudo cryptsetup luksOpen /dev/sdb5 newhd
sudo lvscan # Check if LVs are active.
sudo vgchange -ay # Activate LVs if not active.
sudo lvdisplay # List logical volumes (note the LV Path).
sudo mount /dev/ubuntu-vg/root /mnt
mount # List mounted filesystems.
xdg-open /mnt # Open in file explorer
kenorb
  • 10,347
  • simply mount showed me a way through here. After using the vgimportclone instructions above to rename the dupe vg, I got the same error when I tried to mount it, even after closing the crypt and reopening again. I ran mount after that found it had already been mounted to /media/user/ with some sort of uid. – markling Feb 15 '22 at 23:35
7

I just recently installed Ubuntu 16.04 using LVM. I have just done this once, so I won't claim to be an authority on this. My quick take, you are using incorrect syntax. Below is a copy of my "fstab" file. Note the syntax for mounting a logical volume.

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>                    <type>        <options>            <dump>  <pass>
/dev/mapper/ubuntu--vg-root /                     ext4         errors=remount-ro       0       1

# Logical volume for home
/dev/mapper/ubuntu--vg-newhome /home        ext4         errors=remount-ro       0       2


# /boot was on /dev/sda1 during installation
# Boot volume (partition) Not part of Logical Volume Management (LVM)
UUID=ed575497-3e49-43ae-aaf6-2f482b516a2b /boot   ext2         defaults                0       2

# Swap volume (partition)  Uses Logical Volume Management (LVM)
/dev/mapper/ubuntu--vg-swap_1 none                 swap        sw                      0       0

#Mount Western Digital Passport Drive On Router  - Not part of Logical Volume Management (LVM)
//rt-n56u/sda1 /media/My_Passport cifs file_mode=0777,dir_mode=0777,rw,guest,sec=ntlm,uid=1000,forceuid,gid=34,forcegid,nofail 0      0

I would also suggest obtaining "Logical Volume Management" from the Ubuntu Software Center" and studying the graphical image display. Use that image to ascertain your mount points with VLM. You can also see your disk drive layout under LVM by using the command below:

sudo lvdisplay

I also wrote a short tutorial (based on my one and only experience), which may be of some use: Create Logical "Home" Volume When Using Logical Volume Management (VLM)

PS: If you do a clean install of Ubuntu, there is a checkbox for using LVM (in my case), so there is no need to actually install LVM should you see that checkbox and check it.

Steve R.
  • 418
  • Don't give-up so soon. Try a clean install using the "old" style partitions. So far Ubuntu 16.04 seems very good. – Steve R. May 02 '16 at 00:13
  • Thanks... I was just having a very frustrating time of it... the info you gave has helped, plus it seems because I was trying to access an old installation @psusi pointed out the volume groups had the same name.... Thanks again – pst007x May 02 '16 at 10:13
6

Here is a solution that also works for cloned disks, unlike the accepted answer.

I have done another install but now when trying to mount my original drive … I get this message: mount: unknown filesystem type 'LVM2_member'

This happens because both your old and new installation use LVM, probably because you enabled hard disk encryption. Ubuntu will use ubuntu-vg as the volume group name (similar to a disk name) for the installation, and this causes a problem because LVM can only access one of the volume groups in case two or more have the same volume group name. In your case, one is already in use since booting the system, so trying to access the other installation fails.

This is pretty identical to the issue when you want to use LVM to access both a disk and its clone. The LVM system provides the vgimportclone command for this purpose. Compared to the currently accepted answer, this has the advantage that it allows renaming the inaccessible volume group, which is not possible with vgrename for cases where you cannot find out the VG UUID, for example because it is the same as an existing one, as in cases of cloned disks.

Instructions:

  1. If the LVM volume group is on an encrypted partition, first open the encrypted partition to make it visible to LVM commands:

    sudo cryptsetup luksOpen /dev/sdb5 sdb5_crypt
    
  2. Then use vgimportclone to rename the volume group:

    sudo vgimportclone --basevgname ubuntu-vg-old /dev/mapper/sdb5_crypt
    

    In case of an unencrypted LVM volume group, use /dev/sdb5 in place of /dev/mapper/sdb5_crypt as the device identifier.

  3. The devices in the volume group now named ubuntu-vg-old should now be available for mounting by clicking on the corresponding device in a file manager, or for manual mounting with:

    sudo mkdir /media/username/ubuntu-vg-old-root
    sudo mount /dev/mapper/sdb5_crypt /media/username/ubuntu-vg-old-root
    
  4. If mounting does not yet work, you might have to disconnect and reconnect the encrypted partition to let Ubuntu recognize the changed volume group name:

    sudo dmsetup remove /dev/mapper/sdb5_crypt
    sudo cryptsetup luksOpen /dev/sdb5 sdb5_crypt
    
tanius
  • 6,303
  • 1
  • 39
  • 49
  • The 'sudo mount' command above should be based on what 'sudo lvdisplay' shows for LV Path. So the mount command is something like: 'sudo mount /dev/ubuntu-vg-old/root /media/username/ubuntu-vg-old-root' – user603749 May 05 '23 at 19:49
2

I got the same error message, but in my case I was trying to mount what I thought was my root partition, but when I found @Pascal's answer to a related question on SuperUser - linked by @Tisaconundrum and ran lsblk, I found that it was a logical volume group that contained swap and root logical volumes.

With that information and @SteveR's answer here, I mounted it by using: mount /dev/mapper/<logicalVolumeName> /mnt/<mountPoint> where <logicalVolumeName> was gleaned from lsblk output.

mdmay74
  • 46
  • Thank you! This helped tremendously. I would add that the may look similar to <VGname+LVname> if attaching to a Raid1 configuration accessed through mdadm. My situation was that I had to recover data from a downed Qnap Ts251+ that was used to store the only copy. My fault for not making the user aware of this. Regardless, thanks again. Edit: Found via sudo vgdisplay -l to get the correct lv for the large disk (1.8 TB in my case) and ls -la /dev/mapper get get the proper . – jetimms Mar 12 '23 at 15:52
0

sudo bash vgdisplay vgrename new_name modprobe dm-mod vgchange -ay lvscan mount /dev/new_name/root /mnt

After renaming will I be lost any data. (As we have migrated disk from one server to another and we are getting same error. Just to make sure before making changes prod environment )

Geek
  • 1
  • If you have a new question, you should ask another question here, not ask your question in the context of someone else's question. – lemoana Mar 01 '23 at 01:07
-3

This is another way of doing it, however

CAUTION: This will format data prior to mounting

After creating the Logical Volume (LV) that belongs to a Volume Group (VG) that's part of one or more Physical Volume/s (PV), you need to find the path to the volume.

You can do that by lvdisplay and you'll see something like

LV Path /dev/books-vg/books_volume

You're going to copy this path, and create a Filesystem (because it's not a Filesystem yet, it's just a Partition - and that's why you can't mount it). So you need to format this Partition and create the Filesystem:

mkfs.ext4 /dev/books-vg/books_volume

the output will look something like

mke2fs 1.42.13 (17-May-2015)                                                   
Creating filesystem with 13107200 4k blocks and 3276800 inodes                 
Filesystem UUID: f00a7051-6203-4c18-9d95-b589aae48606                          
Superblock backups stored on blocks:                                           
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

And now, finally, you can mount the volume:

mount /dev/books-vg/books_volume /mnt