Problems with properly loading device partitions, and LVM devices
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Problems with properly loading device partitions, and LVM devices
I have fedora 20, 64-bit installed on an LVM. (separate logical volumes for /, /home, /swap, and /boot, one Volume Group, two Disks: One 1TB Seagate 7200rpm hdd and one 250G Samsung 840EVO SSD) I have GRUB installed on both disks, and was previously able to boot into the system off of either. I have Windows 7 installed on the SSD, and an NTFS partition for windows storage on the HDD. My /boot, /, and /swap are all on the SDD's LVM partition (sda1) and /home is on the HDD (sdb1). I have a third, unused, hard drive plugged in as sdc. Using SeaTools on Windows, I have tried upgrading firmware, running disk self-checks, etc. and the disks are in working order. My problem is that, when booting, my system hangs at the process
/dev/disk-by-UUID \x2(UUID of disk)\.device
and sits there for a minute, until I get a recovery console. fdisk -l lists both disks and all of their partitions just fine. But if I were to attempt to use
fdisk /dev/sdb1
it would say "error, no device /dev/sdb1" which is odd, since
fdisk /dev/sdb
lists 3 partitions. If I then run
sfdisk -R
then attempt to run
fdisk /dev/sdb1
again, it works just fine. I have my /etc/fstab set to use the partitions' UUIDs to boot the system. So I see why the boot fails- LVM does not see /dev/sdb1 on boot, so it does not load that part of the LVM (it gives me errors about a missing disk when running any commands, such as pvdisplay) my question is why my system is not loading /dev/sdb[1-3. Ive had this system for several years, and do not wish to do any type of reinstall. Also, i noticed that my /dev/sdb disk is named ST31000528AS in the BIOS, and blkid shows that ST31000528AS
and ST31000528ASp1
and ST31000528AS p2
are listed as dm-0, dm-1, etc. Is the device manager somehow "stealing" the hard drive?
fdisk -l lists both disks and all of their partitions just fine. But if I were to attempt to use
fdisk /dev/sdb1
it would say "error, no device /dev/sdb1" which is odd, since
fdisk /dev/sdb
lists 3 partitions. If I then run
sfdisk -R
then attempt to run
fdisk /dev/sdb1
again, it works just fine.
Did you really mean to say "fdisk" in those two places? fdisk is run on the whole drive, not on a partition. If you somehow did manage to install another partition table inside partition sdb1, all bets are off regarding what, if anything, will work.
Hello,
my apologies for scattered that post was. And for the long time to reply- only just got access to another computer again. Running fdisk on the single partition was just to show that the device did not exist- I would not have saved the partition table even if the command HAD worked. But I think that this is now beside the point:
I have found that, despite the odd mappings (/dev/mapper/DISKNAMEp3 instead of /dev/sdb3) the devices are still usable by LVM. It appears that what has actually happened is that my lvm metadata has somehow become corrupted. I have done a pvcreate --UUID --restorefile on the drive, and now it is no longer missing. However, LVS -o +devices lists the device for my lv_home as pvmove0. Which is "missing" yet pvdisplay -m shows pvmove0 as being on my /dev/mapper/DISKNAMEp3 partition. However, I have not pvmoved anything in a while, and the extents where pvmove0 is located should really belong to lv_home. I cannot run lvcfgrestore because it says that one PV is missing (despite both of my disks being read now) and I cannot run commands like pvmove because there is one PV missing (which is pvmove0)
I've got no experience with pvmove, but this sounds like either a move that was never completed or else a mix of LVM metadata from while the pvmove was running, perhaps due to a "--restorefile" that referenced the wrong file. Perhaps if you would post the output from
Code:
grep '^description =' /etc/lvm/archive/*
and indicate which file you used for the "pvcreate --restorefile" it would help.
I fear that any "fix" that I suggest now might just make matters worse, but you might just need to run vgcfgrestore with the appropriate file to restore the LVM metadata. The manpage for pvcreate suggests that the "--restorefile" option just ensures that the volume reserves the same space for LVM metadata but does not actually restore that metadata to the drive.
Thank you for the help. I clearly have not had my head about me lately, I should have provided this already. And that first post really should not ahve been made. Anyways,
is what you were looking for. I already tried vgcfgrestore, but get the error
Code:
Cannot restore Volume Group vg_bryan with 1 PVs marked as missing.
which I assume is due to the pv "pvmove0"not being found.
And with those descriptions, at one point I was going to move my /home from the 1tb disk to the 750G disk (750 was /dev/sdb, 1T was /dev/sdc) but I cancelled that operation(numbers 0024 and 0025), and everything appeared normal afterwards... but I am going to guess that was what messed it up. 26 and onwards all failed, as part of lv_home was on the "missing disk".
The output for pvdisplay
Code:
--- Physical volume ---
PV Name /dev/mapper/ST31000528AS_6VPFP747p3
VG Name vg_bryan
PV Size 585.94 GiB / not usable 31.00 MiB
Allocatable yes
PE Size 32.00 MiB
Total PE 18749
Free PE 5949
Allocated PE 12800
PV UUID GGc1Ri-vPNZ-WJ9R-elyk-CdQ9-QGzq-Ce8yLD
--- Physical volume ---
PV Name /dev/sda1
VG Name vg_bryan
PV Size 73.56 GiB / not usable 0
Allocatable yes
PE Size 32.00 MiB
Total PE 2354
Free PE 314
Allocated PE 2040
PV UUID vp59JC-oT9V-QIyE-Heo2-1Xjn-e4kB-JPyt76
--- Physical volume ---
PV Name /dev/mapper/ST3750330AS_9QK23HVG
VG Name vg_bryan
PV Size 698.64 GiB / not usable 11.00 MiB
Allocatable yes
PE Size 32.00 MiB
Total PE 22356
Free PE 9556
Allocated PE 12800
PV UUID 3qj5FD-zXt1-9q2V-aHc0-WbNd-3AnC-3n19B3
and pvdisplay -m
Code:
PV Name /dev/mapper/ST31000528AS_6VPFP747p3
VG Name vg_bryan
PV Size 585.94 GiB / not usable 31.00 MiB
Allocatable yes
PE Size 32.00 MiB
Total PE 18749
Free PE 5949
Allocated PE 12800
PV UUID GGc1Ri-vPNZ-WJ9R-elyk-CdQ9-QGzq-Ce8yLD
--- Physical Segments ---
Physical extent 0 to 439:
FREE
Physical extent 440 to 13239:
Logical volume /dev/vg_bryan/pvmove0
Logical extents 0 to 12799
Physical extent 13240 to 18748:
FREE
--- Physical volume ---
PV Name /dev/sda1
VG Name vg_bryan
PV Size 73.56 GiB / not usable 0
Allocatable yes
PE Size 32.00 MiB
Total PE 2354
Free PE 314
Allocated PE 2040
PV UUID vp59JC-oT9V-QIyE-Heo2-1Xjn-e4kB-JPyt76
--- Physical Segments ---
Physical extent 0 to 1975:
Logical volume /dev/vg_bryan/lv_root
Logical extents 0 to 1975
Physical extent 1976 to 2289:
FREE
Physical extent 2290 to 2321:
Logical volume /dev/vg_bryan/lv_boot
Logical extents 0 to 31
Physical extent 2322 to 2353:
Logical volume /dev/vg_bryan/lv_swap
Logical extents 0 to 31
--- Physical volume ---
PV Name /dev/mapper/ST3750330AS_9QK23HVG
VG Name vg_bryan
PV Size 698.64 GiB / not usable 11.00 MiB
Allocatable yes
PE Size 32.00 MiB
Total PE 22356
Free PE 9556
Allocated PE 12800
PV UUID 3qj5FD-zXt1-9q2V-aHc0-WbNd-3AnC-3n19B3
--- Physical Segments ---
Physical extent 0 to 12799:
Logical volume /dev/vg_bryan/pvmove0
Logical extents 0 to 12799
Physical extent 12800 to 22355:
FREE
and pvdisplay -v
Code:
Scanning for physical volume names
There are 1 physical volumes missing.
There are 1 physical volumes missing.
There are 1 physical volumes missing.
--- Physical volume ---
PV Name /dev/mapper/ST31000528AS_6VPFP747p3
VG Name vg_bryan
PV Size 585.94 GiB / not usable 31.00 MiB
Allocatable yes
PE Size 32.00 MiB
Total PE 18749
Free PE 5949
Allocated PE 12800
PV UUID GGc1Ri-vPNZ-WJ9R-elyk-CdQ9-QGzq-Ce8yLD
There are 1 physical volumes missing.
There are 1 physical volumes missing.
--- Physical volume ---
PV Name /dev/sda1
VG Name vg_bryan
PV Size 73.56 GiB / not usable 0
Allocatable yes
PE Size 32.00 MiB
Total PE 2354
Free PE 314
Allocated PE 2040
PV UUID vp59JC-oT9V-QIyE-Heo2-1Xjn-e4kB-JPyt76
There are 1 physical volumes missing.
There are 1 physical volumes missing.
--- Physical volume ---
PV Name /dev/mapper/ST3750330AS_9QK23HVG
VG Name vg_bryan
PV Size 698.64 GiB / not usable 11.00 MiB
Allocatable yes
PE Size 32.00 MiB
Total PE 22356
Free PE 9556
Allocated PE 12800
PV UUID 3qj5FD-zXt1-9q2V-aHc0-WbNd-3AnC-3n19B3
Thank you again for the help
p.s.- I commented out my /home entry is /etc/fstab, which allowed me to boot into my system and now post this log information correctly.
It's going to take me a while to digest that. I think the contents of /etc/lvm/backup/vg_bryan would be helpful.
When you cancelled that pvmove, did you run "pvmove --abort" to abort the operation, or just kill the process? Note that I do not recommend trying to do the "--abort" now.
Have you done anything on the 1TB drive that might have affected the LVM metadata there after aborting the move?
well dang. I just used ctrl^c to abort. I knew pvmove copied the data to the new location before erasing the original, so I figured that it would have been fine. Stupid, stupid mistake on my part. I do not believe that I have done anything that would have affected the metadata. I'll post the backup in a bit.
That explains a lot. pvmove can be continued after being interrupted. The correct action would have been to interrupt with ctrl-c and then run "pvmove --abort" to clean up the partially completed operation. Since stuff has happened since then, I'll need to take a look at that metadata backup file to see if it looks safe to run "pvmove --abort" now.
The good news is that the file shows that no extents were moved. The first thing I would do is back up the current LVM metadata from each of the 3 PVs. It is the first 2048 sectors of each PV.
You should put those files somewhere outside of the LVM structure, perhaps on a USB flash drive, so that you have a way to restore to the current state without relying on LVM commands or even the current OS.
Next, I would try running "pvmove --abort". That might be enough.
If that fails, I would look at /etc/lvm/archive/vg_bryan_00025-1636259526.vg (the file stored just before the interrupted pvmove) and verify that the stripes shown for lv_home were
Code:
stripes = {
"pv0", 440
}
matching the first mirror shown for LV pvmove0 in the current metadata backup, and that the data for lv_swap, lv_root, and lv_boot match what is in the current metadata backup file. If those match, then you should be able to run
pvmove --abort
Missing device /dev/mapper/ST3750330AS_9QK23HVG reappeared, updating metadata for VG vg_bryan to version 56.
Device still marked missing because of allocated data on it, remove volumes and consider vgreduce --removemissing.
Cannot change VG vg_bryan while PVs are missing.
Consider vgreduce --removemissing.
Skipping volume group vg_bryan
the sripes, etc, is all correct, so
Code:
vgcfgrestore -f /etc/lvm/archive/vg_bryan_00025-1636259526.vg vg_bryan
Restored volume group vg_bryan
On a side note:
I still do not have /dev/sdb# and /dev/sdc# partitions, it is now /dev/mapper/(disk ID)p# instead. I noticed that I used to do that with SOME USB drives, now it appears to be doing so with all devcies (except /dev/sda)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.