25

Ive been tearing my hair out for about a week now trying to figure out how to do this.

I have two HDD's in my server, both 250gig. They both have ubuntu installed, one is currently booted. I want to mount the second (old) drive to /mnt/external

If I mount through /dev/disk/by-uuid It just mounts the boot partition, and not my actual data.

I also tried vgs-v to determine, but the names are the same, and don't know where to go from here.

root@onlinelabtests:~# vgs -v
Finding all volume groups
Finding volume group "SysVolGroup"
Archiving volume group "SysVolGroup" metadata (seqno 3).
Archiving volume group "SysVolGroup" metadata (seqno 3).
Creating volume group backup "/etc/lvm/backup/SysVolGroup" (seqno 3).
Finding volume group "SysVolGroup"
Archiving volume group "SysVolGroup" metadata (seqno 3).
Archiving volume group "SysVolGroup" metadata (seqno 3).`
Creating volume group backup "/etc/lvm/backup/SysVolGroup" (seqno 3).
VG          Attr   Ext   #PV #LV #SN VSize   VFree VG UUID      
SysVolGroup wz--n- 4.00m   1   2   0 233.72g    0  812dMv-qSf3-xnpP-khlB-mkIf-q64l-Z2Rawf     
SysVolGroup wz--n- 4.00m   1   2   0 233.72g    0  Z3IbWM-FEvq-n6fs-lhm9-5uQq-mdxj-QNfDLJ

and this

root@onlinelabtests:~# vgchange -a y
2 logical volume(s) in volume group "SysVolGroup" now active
2 logical volume(s) in volume group "SysVolGroup" now active

But /dev/disk/by-uuid still doesnt show anything else.
Any help appreciated.

3 Answers 3

23

I had a similar issue on my system. I just renamed the external logical volume group.

Beware that this probably makes the renamed drive unbootable! I don't know which files you have to change so you can boot again afterwards.

First get UUID of group to rename. I used

$ sudo vgdisplay

  --- Volume group ---
  VG Name               mint-vg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               119,00 GiB
  PE Size               4,00 MiB
  Total PE              30464
  Alloc PE / Size       30464 / 119,00 GiB
  Free  PE / Size       0 / 0   
  VG UUID               jWIQCX-uxUT-aG1x-1tpc-1Ixk-pxw2-gL6mlJ

  --- Volume group ---
  VG Name               mint-vg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               238,23 GiB
  PE Size               4,00 MiB
  Total PE              60987
  Alloc PE / Size       60987 / 238,23 GiB
  Free  PE / Size       0 / 0   
  VG UUID               TZus4Q-JQKU-eyyl-kkEv-liM4-mUXd-e19TcT

I want to rename the first one. Because this is my thumb drive.

Now I know the UUID and can execute a rename. Maybe a mount could also work with the UUID but I didn't care about it.

   $ sudo vgrename -v jWIQCX-uxUT-aG1x-1tpc-1Ixk-pxw2-gL6mlJ mint-stick

   Checking for existing volume group "jWIQCX-uxUT-aG1x-1tpc-1Ixk-pxw2-gL6mlJ"
    Checking for new volume group "mint-stick"
    Archiving volume group "mint-vg" metadata (seqno 3).
    Writing out updated volume group
    Renaming "/dev/mint-vg" to "/dev/mint-stick"
    Creating volume group backup "/etc/lvm/backup/mint-stick" (seqno 4).
  Volume group "mint-vg" successfully renamed to "mint-stick"
    Wiping cache of LVM-capable devices
    Wiping internal VG cache
1
  • To restore the ability to boot: mount /dev/mapper/vg-mint-stick-root /mnt; mount /dev/mapper/vg-mint-stick-boot /mnt/boot; sudo nano /etc/fstab; # edit the volume group names for the mounts; cd /mnt ; for i in proc sys dev; do mount -o bind /$i $i; done; chroot /mnt; grub-install --boot-dir=/boot /dev/sdX; # select the correct drive; sync; sync; reboot -f now; # note that grub-install will repair the /boot/grub/grub.cfg entries for you, but if that fails you can rename the volume groups there too.
    – Wil
    May 10, 2018 at 9:04
6

To mount an external hard-disk (LVM2 and EXT4 partitions):

  1. Check the UID number of the hard-disk

    sudo vgdisplay
    
  2. Mount your hard-disk:

    sudo vgrename <UID> volgroup
    
  3. Activate the mount volume:

    sudo vgchange -a y
    
0

Take a look at /dev/SysVolGroup and/or dev/mapper

ls /dev/SysVolGroup

Now mount the partitions listed there

sudo mkdir /media/LVM{1,2}
sudo mount /dev/SysVolGroup/first_lvm /media/LVM1
sudo mount /dev/SysVolGroup/second_lvm /media/LVM2

Please take care, Volume groups with the same name can cause problems, I would change the name of one of the two.

3
  • all that is in /dev/SysVolGroup is root and swap_1. I tried that before and if I mount root, its just mounting itself again! Mar 5, 2012 at 18:07
  • 1
    Disconnect one of the hard drives, boot a live (desktop) cd , and change the name of the volume group.
    – Panther
    Mar 5, 2012 at 18:20
  • 1
    FWIW /dev/SysVolGroup doesn't exist on ubuntu 18.04
    – Catskul
    Mar 16, 2020 at 17:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .