Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Greetings
Being an advocate for LVM, I was called upon to help "fix things", and I soon realized I'm in over my head on this one.
User has already Opensuse (w/LVM) running and tried to install Windows on a unused hard drive as dual-boot. Install failed and LVM disappeared from boot. The system now just partly boots. Booting fails and stops when VG is not found and three LVs are not mounted. There is one VG, vg00, on one PV with three LVs. System has three hard drives.
I suspect the failed installation messed up partitioning badly. Such that a /dev/sda4 partition is missing. (System is temporarily running on liveCD)
Alas this is a very poorly documented system. Backup is way outdated. User accepts the risk of loosing all data. But thinks it's worth a try to exploit any chances of getting any data off the disk...
Here's the fdisk print out.
Code:
$ sudo fdisk -l
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c33e1
Device Boot Start End Blocks Id System
/dev/sda1 1 10 71680 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 * 10 1577 12587008 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3 1577 1838 2096128 82 Linux swap / Solaris
Partition 3 does not end on cylinder boundary.
Disk /dev/sdb: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d461c
Device Boot Start End Blocks Id System
Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005095f
Device Boot Start End Blocks Id System
Disk /dev/sdd: 16.2 GB, 16240345088 bytes
114 heads, 40 sectors/track, 6956 cylinders
Units = cylinders of 4560 * 512 = 2334720 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc3072e18
Device Boot Start End Blocks Id System
/dev/sdd1 * 1 6957 15859692 c W95 FAT32 (LBA)
mint@mint ~ $
To my knowledge /dev/sda1 is /boot and /dev/sda2 is /<root>.
mint ~ # fdisk -lu /dev/sda
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c33e1
Device Boot Start End Blocks Id System
/dev/sda1 2048 145407 71680 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 * 145408 25319423 12587008 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3 25319424 29511679 2096128 82 Linux swap / Solaris
Partition 3 does not end on cylinder boundary.
mint ~ #
Alternatively
Code:
mint ~ # sfdisk -uS -l /dev/sda
Disk /dev/sda: 9729 cylinders, 255 heads, 63 sectors/track
Units = sectors of 512 bytes, counting from 0
Device Boot Start End #sectors Id System
/dev/sda1 2048 145407 143360 83 Linux
end: (c,h,s) expected (9,13,4) found (9,148,4)
/dev/sda2 * 145408 25319423 25174016 83 Linux
start: (c,h,s) expected (9,13,5) found (9,148,5)
end: (c,h,s) expected (1023,254,63) found (1023,135,39)
/dev/sda3 25319424 29511679 4192256 82 Linux swap / Solaris
start: (c,h,s) expected (1023,254,63) found (1023,135,40)
end: (c,h,s) expected (1023,254,63) found (1023,199,23)
/dev/sda4 0 - 0 0 Empty
mint ~ #
The space following partition 4 on the disk (156301488-29511679 = 126789809 sectors) is just a little larger than the size of pv0 (dev_size = 126789632). I was hoping to see an exact match, but I would try running "fdisk -u /dev/sda" and creating, in sector address mode, a partition starting right after sda3 (sector 29511680) and extending to the end of the disk. (Note that creating/deleting primary partitions with fdisk is 100% safe. The only writes that occur are to the partition table in the MBR.) Set the partition type to 8e "Linux LVM" (not that it really matters), and see if then running pvscan doesn't make your volume group reappear.
Failing that, I would download one of the live CDs that includes testdisk (my own favorite is System Rescue CD) and see if testdisk can locate your LVM Physical Volume.
Excellent. I will try that later today. I suspect the reason for no exact match in sectors is due to rounding of numbers. It might me that the partition is created using rounded GigaBytes.
I've used testdisk some time ago for fixing Grub/MBR. If it comes to recovering partitions I hope I can get some pointers? Should I then continue this thread or start a new?
If you have questions about testdisk in general, it's probably best to start a new thread. For details about solving this particular problem, keep it here to keep the thread together. My own experience with testdisk is very limited as I've never had to use it for a real problem, but it looks like a fair number of people are following this thread so you'll probably get some answers right here.
mint ~ # fdisk -u /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c').
Command (m for help):n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First sector (63-156301487, default 63): 29511680
Last sector, +sectors or +size{K,M,G} (29511680-156301487, default 156301487):
Using default value 156301487
Command (m for help):
t
Partition number (1-4): 4
Hex code (type L to list codes): 8e
Changed system type of partition 4 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c33e1
Device Boot Start End Blocks Id System
/dev/sda1 2048 145407 71680 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 * 145408 25319423 12587008 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3 25319424 29511679 2096128 82 Linux swap / Solaris
Partition 3 does not end on cylinder boundary.
/dev/sda4 29511680 156301487 63394904 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
mint ~ # pvscan
No matching physical volumes found
I then did a shutdown, removed LiveCD, rebooted, and everything worked strait off.
The VG was found, the lV's was found (and fsck-ed; no bugs) and mount.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.