Skip to contentSkip to conversation

Identifying Unused VG

linux-lvm Annamalai Gurusami 2 participants 6 messages Oct 15, 2020 – Nov 3, 2020

lore
Share & tools
lore
#0 lore raw

Hi All,

I am new user of LVM. At home, in a desktop machine, I installed Ubuntu 20.04 LTS and while doing so I opted for LVM. This desktop computer has 2 hard disks. I want to remove 1 hard disk and use it for another computer. But I need to remove the hard disk without loss of data. The problem now is that there are two VG listed, while I think it should be only one. How to identify the unwanted VG? Maybe this is because of multiple attempts at installation. Any help on this is much appreciated.

Here are some of the output of the commands in that desktop:

root@desktop02:~# lsblk --scsi
NAME HCTL       TYPE VENDOR   MODEL                 REV TRAN
sda  2:0:0:0    disk ATA      ST2000DM005-2CW102   0001 sata
sdb  8:0:0:0    disk ATA      WDC_WD20EZAZ-00GGJB0 0A80 sata
root@desktop02:~# vgs
  VG       #PV #LV #SN Attr   VSize  VFree
  vgubuntu   1   2   0 wz--n- <1.82t    0 
  vgubuntu   1   2   0 wz--n- <1.82t    0 
root@desktop02:~# pvs
  PV         VG       Fmt  Attr PSize  PFree
  /dev/sda2  vgubuntu lvm2 a--  <1.82t    0 
  /dev/sdb5  vgubuntu lvm2 a--  <1.82t    0 
root@desktop02:~# lvs
  LV     VG       Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   vgubuntu -wi-ao----  <1.82t                                                    
  root   vgubuntu -wi-------  <1.82t                                                    
  swap_1 vgubuntu -wi-ao---- 976.00m                                                    
  swap_1 vgubuntu -wi------- 976.00m                                                    
root@desktop02:~# lsblk
NAME                MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0                 7:0    0    55M  1 loop /snap/core18/1880
loop1                 7:1    0   251M  1 loop /snap/gimp/292
loop2                 7:2    0 161.4M  1 loop /snap/gnome-3-28-1804/128
loop3                 7:3    0   251M  1 loop /snap/gimp/297
loop4                 7:4    0 162.9M  1 loop /snap/gnome-3-28-1804/145
loop5                 7:5    0  55.3M  1 loop /snap/core18/1885
loop6                 7:6    0 255.6M  1 loop /snap/gnome-3-34-1804/36
loop7                 7:7    0 217.9M  1 loop /snap/gnome-3-34-1804/60
loop8                 7:8    0  62.1M  1 loop /snap/gtk-common-themes/1506
loop9                 7:9    0 138.4M  1 loop /snap/inkscape/7947
loop10                7:10   0 260.7M  1 loop /snap/kde-frameworks-5-core18/32
loop11                7:11   0  43.2M  1 loop /snap/snap-store/415
loop12                7:12   0  50.7M  1 loop /snap/snap-store/481
loop13                7:13   0  30.3M  1 loop /snap/snapd/9279
loop14                7:14   0    31M  1 loop /snap/snapd/9607
loop15                7:15   0 217.5M  1 loop /snap/supertux/229
loop16                7:16   0 290.4M  1 loop /snap/vlc/1700
sda                   8:0    0   1.8T  0 disk 
����sda1                8:1    0   512M  0 part 
����sda2                8:2    0   1.8T  0 part 
sdb                   8:16   0   1.8T  0 disk 
����sdb1                8:17   0   512M  0 part /boot/efi
����sdb2                8:18   0     1K  0 part 
����sdb5                8:21   0   1.8T  0 part 
  ����vgubuntu-root   253:0    0   1.8T  0 lvm  /
  ����vgubuntu-swap_1 253:1    0   976M  0 lvm  [SWAP]
root@desktop02:~# 

Since both the VG is named as "vgubuntu", I am wondering how to identify the unused or unwanted VG. And I need to identify which hard disk (sda or sdb) I can remove. And what I need to do before unplugging it.

I would appreciate if you people can point me in the right direction. Thank you.

Rgds,
anna

Signature · 8 lines
mysql> help year data type;
Name: 'YEAR DATA TYPE'
Description:
YEAR[(4)]

A year in 4-digit format. MySQL displays YEAR values in YYYY format,
but permits assignment of values to YEAR columns using either strings
or numbers. Values display as 1901 to 2155, or 0000.
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Annamalai" == Annamalai Gurusami <[email protected]> writes:

Annamalai> I am new user of LVM. At home, in a desktop machine, I Annamalai> installed Ubuntu 20.04 LTS and while doing so I opted for Annamalai> LVM. This desktop computer has 2 hard disks. I want to Annamalai> remove 1 hard disk and use it for another computer. But I Annamalai> need to remove the hard disk without loss of data. The Annamalai> problem now is that there are two VG listed, while I think Annamalai> it should be only one. How to identify the unwanted VG? Annamalai> Maybe this is because of multiple attempts at installation. Annamalai> Any help on this is much appreciated.

Ugh! How did you do this? Did you clone one disk on top of another?

Can you boot off a liveCD and do the same command again please? Also
please run the 'blkid' command show that output as well. And show the output of 'cat /proc/partitions' and /proc/mdstat as well. Are you running RAID on this system? Or did you try to do that?

Annamalai> Here are some of the output of the commands in that desktop:

Looking at your 'lsblk' output, I suspect you can remove drive sda, the Seagate. So I'd probably try to shutdown cleanly, then remove that drive and boot up again.

Annamalai> root@desktop02:~# lsblk --scsi

Annamalai> NAME HCTL       TYPE VENDOR   MODEL                 REV TRAN
Annamalai> sda  2:0:0:0    disk ATA      ST2000DM005-2CW102   0001 sata
Annamalai> sdb  8:0:0:0    disk ATA      WDC_WD20EZAZ-00GGJB0 0A80 sata
Annamalai> root@desktop02:~# vgs
Annamalai>   VG       #PV #LV #SN Attr   VSize  VFree
Annamalai>   vgubuntu   1   2   0 wz--n- <1.82t    0 
Annamalai>   vgubuntu   1   2   0 wz--n- <1.82t    0 
Annamalai> root@desktop02:~# pvs
Annamalai>   PV         VG       Fmt  Attr PSize  PFree
Annamalai>   /dev/sda2  vgubuntu lvm2 a--  <1.82t    0 
Annamalai>   /dev/sdb5  vgubuntu lvm2 a--  <1.82t    0 
Annamalai> root@desktop02:~# lvs
Annamalai>   LV     VG       Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
Annamalai>   root   vgubuntu -wi-ao----  <1.82t                                                    
Annamalai>   root   vgubuntu -wi-------  <1.82t                                                    
Annamalai>   swap_1 vgubuntu -wi-ao---- 976.00m                                                    
Annamalai>   swap_1 vgubuntu -wi------- 976.00m                                                    
Annamalai> root@desktop02:~# lsblk
Annamalai> NAME                MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
Annamalai> loop0                 7:0    0    55M  1 loop /snap/core18/1880
Annamalai> loop1                 7:1    0   251M  1 loop /snap/gimp/292
Annamalai> loop2                 7:2    0 161.4M  1 loop /snap/gnome-3-28-1804/128
Annamalai> loop3                 7:3    0   251M  1 loop /snap/gimp/297
Annamalai> loop4                 7:4    0 162.9M  1 loop /snap/gnome-3-28-1804/145
Annamalai> loop5                 7:5    0  55.3M  1 loop /snap/core18/1885
Annamalai> loop6                 7:6    0 255.6M  1 loop /snap/gnome-3-34-1804/36
Annamalai> loop7                 7:7    0 217.9M  1 loop /snap/gnome-3-34-1804/60
Annamalai> loop8                 7:8    0  62.1M  1 loop /snap/gtk-common-themes/1506
Annamalai> loop9                 7:9    0 138.4M  1 loop /snap/inkscape/7947
Annamalai> loop10                7:10   0 260.7M  1 loop /snap/kde-frameworks-5-core18/32
Annamalai> loop11                7:11   0  43.2M  1 loop /snap/snap-store/415
Annamalai> loop12                7:12   0  50.7M  1 loop /snap/snap-store/481
Annamalai> loop13                7:13   0  30.3M  1 loop /snap/snapd/9279
Annamalai> loop14                7:14   0    31M  1 loop /snap/snapd/9607
Annamalai> loop15                7:15   0 217.5M  1 loop /snap/supertux/229
Annamalai> loop16                7:16   0 290.4M  1 loop /snap/vlc/1700
Annamalai> sda                   8:0    0   1.8T  0 disk 
Annamalai> ├─sda1                8:1    0   512M  0 part 
Annamalai> └─sda2                8:2    0   1.8T  0 part 
Annamalai> sdb                   8:16   0   1.8T  0 disk 
Annamalai> ├─sdb1                8:17   0   512M  0 part /boot/efi
Annamalai> ├─sdb2                8:18   0     1K  0 part 
Annamalai> └─sdb5                8:21   0   1.8T  0 part 
Annamalai>   ├─vgubuntu-root   253:0    0   1.8T  0 lvm  /
Annamalai>   └─vgubuntu-swap_1 253:1    0   976M  0 lvm  [SWAP]

Annamalai> root@desktop02:~#

Annamalai> Since both the VG is named as "vgubuntu", I am wondering how to identify Annamalai> the unused or unwanted VG. And I need to identify which hard disk (sda Annamalai> or sdb) I can remove. And what I need to do before unplugging it.

Annamalai> I would appreciate if you people can point me in the right Annamalai> direction. Thank you.

Annamalai> Rgds,
Annamalai> anna

Annamalai> --
mysql> help year data type;
Annamalai> Name: 'YEAR DATA TYPE'
Annamalai> Description:
Annamalai> YEAR[(4)]

Annamalai> A year in 4-digit format. MySQL displays YEAR values in YYYY format, Annamalai> but permits assignment of values to YEAR columns using either strings Annamalai> or numbers. Values display as 1901 to 2155, or 0000.

Annamalai> _______________________________________________ Annamalai> linux-lvm mailing list
Annamalai> [email protected]
Annamalai> https://www.redhat.com/mailman/listinfo/linux-lvm
Annamalai> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#2 lore raw
Quoted 12 lines · John Stoffel
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Annamalai" == Annamalai Gurusami <[email protected]> writes:

Annamalai> I am new user of LVM. At home, in a desktop machine, I Annamalai> installed Ubuntu 20.04 LTS and while doing so I opted for Annamalai> LVM. This desktop computer has 2 hard disks. I want to Annamalai> remove 1 hard disk and use it for another computer. But I Annamalai> need to remove the hard disk without loss of data. The Annamalai> problem now is that there are two VG listed, while I think Annamalai> it should be only one. How to identify the unwanted VG? Annamalai> Maybe this is because of multiple attempts at installation. Annamalai> Any help on this is much appreciated.

Quoted 1 line

Ugh! How did you do this? Did you clone one disk on top of another?

I did installation two times. My first installation attempt failed and I repeated the process. I don't remember what exactly failed in the first attempt. In the two attempts, I guess I might have given different hard disk for the root file system. In each attempt, I told Ubuntu to use both the hard disks with LVM.

Suppose Ubuntu is installed on both the hard disks, then I should be able to boot Ubuntu from either of them. But currently I can boot from only one of them.

Quoted 4 lines

Can you boot off a liveCD and do the same command again please? Also
please run the 'blkid' command show that output as well. And show the output of 'cat /proc/partitions' and /proc/mdstat as well. Are you running RAID on this system? Or did you try to do that?

I don't have a live CD ready with me. I'll try the other simpler option (below) first and will come back to this if that didn't work.

Quoted 5 lines

Annamalai> Here are some of the output of the commands in that desktop:

Looking at your 'lsblk' output, I suspect you can remove drive sda, the Seagate. So I'd probably try to shutdown cleanly, then remove that drive and boot up again.

I'll try this first and let you know how it goes.

Thanks.

Rgds,
anna

Signature · 8 lines
mysql> help year data type;
Name: 'YEAR DATA TYPE'
Description:
YEAR[(4)]

A year in 4-digit format. MySQL displays YEAR values in YYYY format,
but permits assignment of values to YEAR columns using either strings
or numbers. Values display as 1901 to 2155, or 0000.
#3 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Annamalai" == Annamalai Gurusami <[email protected]> writes:

Quoted 2 lines · Annamalai> "John Stoffel" <[email protected]> writes:
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Annamalai" == Annamalai Gurusami <[email protected]> writes:

Annamalai> I am new user of LVM. At home, in a desktop machine, I Annamalai> installed Ubuntu 20.04 LTS and while doing so I opted for Annamalai> LVM. This desktop computer has 2 hard disks. I want to Annamalai> remove 1 hard disk and use it for another computer. But I Annamalai> need to remove the hard disk without loss of data. The Annamalai> problem now is that there are two VG listed, while I think Annamalai> it should be only one. How to identify the unwanted VG? Annamalai> Maybe this is because of multiple attempts at installation. Annamalai> Any help on this is much appreciated.

Quoted 2 lines
Quoted 2 lines

Ugh! How did you do this? Did you clone one disk on top of another?

Annamalai> I did installation two times. My first installation Annamalai> attempt failed and I repeated the process. I don't Annamalai> remember what exactly failed in the first attempt. In the Annamalai> two attempts, I guess I might have given different hard Annamalai> disk for the root file system. In each attempt, I told Annamalai> Ubuntu to use both the hard disks with LVM.

So once you find out which disk boots Linux ok, note down the partition layout. Then reboot with the second disk attached and make sure you do something like:

dd if=/dev/zero bs=64k count=512 /dev/sd<second disk>

which will be either sda or sdb. This 'dd' command will wipe the partition table and all the LVM data as well, so you can install windows on it.

Good luck.

Annamalai> Suppose Ubuntu is installed on both the hard disks, then I should be Annamalai> able to boot Ubuntu from either of them. But currently I can boot from Annamalai> only one of them.

Quoted 4 lines
Quoted 4 lines

Can you boot off a liveCD and do the same command again please? Also
please run the 'blkid' command show that output as well. And show the output of 'cat /proc/partitions' and /proc/mdstat as well. Are you running RAID on this system? Or did you try to do that?

Annamalai> I don't have a live CD ready with me. I'll try the other simpler option Annamalai> (below) first and will come back to this if that didn't work.

Annamalai> Here are some of the output of the commands in that desktop:

Quoted 4 lines
Quoted 4 lines

Looking at your 'lsblk' output, I suspect you can remove drive sda, the Seagate. So I'd probably try to shutdown cleanly, then remove that drive and boot up again.

Annamalai> I'll try this first and let you know how it goes.

Annamalai> Thanks.

Annamalai> Rgds,
Annamalai> anna

Annamalai> --
mysql> help year data type;
Annamalai> Name: 'YEAR DATA TYPE'
Annamalai> Description:
Annamalai> YEAR[(4)]

Annamalai> A year in 4-digit format. MySQL displays YEAR values in YYYY format, Annamalai> but permits assignment of values to YEAR columns using either strings Annamalai> or numbers. Values display as 1901 to 2155, or 0000.

#4 lore raw
In reply to John Stoffel
Quoted 3 lines · John Stoffel

Looking at your 'lsblk' output, I suspect you can remove drive sda, the Seagate. So I'd probably try to shutdown cleanly, then remove that drive and boot up again.

Finally I was able to spend sometime doing this. And you are correct. I shutdown the computer and removed the Seagate HDD and started the computer. Everything went smooth.

Thanks for helping me.

Rgds,
anna

#5 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Annamalai" == Annamalai Gurusami <[email protected]> writes:

Quoted 3 lines · Annamalai> "John Stoffel" <[email protected]> writes:
Quoted 3 lines

Looking at your 'lsblk' output, I suspect you can remove drive sda, the Seagate. So I'd probably try to shutdown cleanly, then remove that drive and boot up again.

Annamalai> Finally I was able to spend sometime doing this. And you are correct. Annamalai> I shutdown the computer and removed the Seagate HDD and started the Annamalai> computer. Everything went smooth.

Annamalai> Thanks for helping me.

Great! Gald to help. Now what I would do is re-install the Seagte drive, boot up and then once you've identified it properly, I would wipe the beginning of the disk with:

dd if=/dev/zero of=/dev/sd<letter> count=10000

where <letter> would *probably* be 'b' without quotes. But confirm!

Then just reboot the system and you should see only the boot disk, along with a new blank disk. Then you can do what you want with it.

John