Web lists-archives.com

virtual device both is and isn't a valid file system [complete]




[Sorry: original sent before complete; ignore earlier message]

I am trying to read some files off of a virtual disk without running
the entire virtual machine.
(Running a VM would involve at least using a later version of the
VirtualBox, or a switch to KVM,
and I already have enough complexity).

When I attempt to mount a logical volume from that virtual disk, I get
the error:
---------------------------------
root@barley:~/tempserver-check# date; mount /dev/stretch-vg/boot stretch_boot
Mon 13 May 2019 11:42:15 PM PDT
mount: /root/tempserver-check/stretch_boot: can't read superblock on
/dev/mapper/stretch--vg-boot.
---------------------------------------------
Same error if I add -t ext2, 3, or 4.  The /dev/mapper entry is present.

But when I check the block device, there don't seem to be any complaints:
================================
root@barley:~/tempserver-check# date; e2fsck -n /dev/stretch-vg/boot
Mon 13 May 2019 11:45:49 PM PDT
e2fsck 1.44.5 (15-Dec-2018)
/dev/stretch-vg/boot: clean, 345/97536 files, 116077/389120 blocks
==============================
I also tried e2fsck using the /dev/mapper/... path. It was happy with that too.
See below for more info from dumpe2fs.  The only thing that struck me as odd
was the mount count of -1,  but I'm no extN expert.

I suspect this is some problem with my use of qemu-nbd.

Running on buster.  The virtual disks I'm trying to
read were created under wheezy with VBox 4.3.

Any ideas?

The stack is pretty complex:
/dev/stretch-vg/boot is an LVM logical volume
from a volume group (stretch-vg) based on an LVM "physical volume"
which is a partition (3) of a virtual disk served up by qemu-nbd
which is based on a virtual disk file, stretch vdi
which sits on a trivial RAID array (RAID1 with only one member) md/media5
whose only member is a partition sdf2
That partition was created by ddrescue from a disk that was failing;
all but one 4k sector were recovered.  The start and end sectors on
the new disk are the same
as the start and end sectors on the old one.

FWIW this particular virtual machine seemed to be operating OK even
after the disk error.

File systems and devices were opened read only where possible.
My real target is some logical volumes that are encrypted, and so involves one
more layer.  But I figure if I can't handle an unencrypted partition
my chances of reading an encrypted one are slim.

Thanks.
Ross Boylan

EVEN MORE DETAILED DETAILS
Key commands and results, working from the bottom of the previous
stack up.  dumpe2fs just before the last command:
mdadm -v --assemble --readonly /dev/md/media5 /dev/sdf2
Mon 13 May 2019 08:12:09 PM PDT
mdadm: looking for devices for /dev/md/media5
mdadm: /dev/sdf2 is identified as a member of /dev/md/media5, slot 0.
mdadm: added /dev/sdf2 to /dev/md/media5 as 0
mdadm: /dev/md/media5 has been started with 1 drive.
root@barley:~/tempserver-check# mount -r -t ext4 /dev/md/media5 spare
root@barley:~/tempserver-check# df spare
Filesystem      1K-blocks       Used Available Use% Mounted on
/dev/md127     3905540432 3781174980  46211380  99% /root/tempserver-check/spare
# hmm I don't think the original was that full.
# failed initial attempt to use qemu-nbd omitted.  I closed all
devices and unloaded the nbd module
#
root@barley:~/tempserver-check# date; modprobe -v nbd
Mon 13 May 2019 11:33:07 PM PDT
insmod /lib/modules/4.19.0-4-amd64/kernel/drivers/block/nbd.ko
root@barley:~/tempserver-check# date; qemu-nbd -v -r --fork -c
/dev/nbd3 spare/stretch/stretch.vdi
Mon 13 May 2019 11:36:36 PM PDT
root@barley:~/tempserver-check# parted /dev/nbd3 p
Model: Unknown (unknown)
Disk /dev/nbd3: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name   Flags
 1      1049kB  200MB   199MB                       bios_grub
 2      200MB   1201MB  1000MB               spare
 3      1201MB  21.5GB  20.3GB               big    lvm
# pvdisplay of /dev/ndb3p3 looks good, as do other lvm indicators
# next command was probably unnecessary
root@barley:~/tempserver-check# lvchange -ay stretch-vg/boot
root@barley:~/tempserver-check# date; mount /dev/stretch-vg/boot stretch_boot
Mon 13 May 2019 11:42:15 PM PDT
mount: /root/tempserver-check/stretch_boot: can't read superblock on
/dev/mapper/stretch--vg-boot.
root@barley:~/tempserver-check# date; mount -t ext2
/dev/stretch-vg/boot stretch_boot
Mon 13 May 2019 11:42:36 PM PDT
mount: /root/tempserver-check/stretch_boot: wrong fs type, bad option,
bad superblock on /dev/mapper/stretch--vg-boot, missing codepage or
helper program, or other error.
root@barley:~/tempserver-check# date; mount -t ext3
/dev/stretch-vg/boot stretch_boot
Mon 13 May 2019 11:42:45 PM PDT
mount: /root/tempserver-check/stretch_boot: wrong fs type, bad option,
bad superblock on /dev/mapper/stretch--vg-boot, missing codepage or
helper program, or other error.
root@barley:~/tempserver-check# date; mount -t ext4
/dev/stretch-vg/boot stretch_boot
Mon 13 May 2019 11:42:51 PM PDT
mount: /root/tempserver-check/stretch_boot: can't read superblock on
/dev/mapper/stretch--vg-boot.
root@barley:~/tempserver-check# dumpe2fs -h /dev/stretch-vg/boot
dumpe2fs 1.44.5 (15-Dec-2018)
Filesystem volume name:   <none>
Last mounted on:          /boot
Filesystem UUID:          e288f277-27a6-4500-9631-e17c3b661c68
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index
filetype extent 64bit flex_bg sparse_super large_file huge_file
dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              97536
Block count:              389120
Reserved block count:     19456
Free blocks:              273043
Free inodes:              97191
First block:              1
Block size:               1024
Fragment size:            1024
Group descriptor size:    64
Reserved GDT blocks:      256
Blocks per group:         8192
Fragments per group:      8192
Inodes per group:         2032
Inode blocks per group:   254
Flex block group size:    16
Filesystem created:       Tue May  8 12:50:24 2018
Last mount time:          Tue May  7 08:42:06 2019
Last write time:          Wed May  8 02:32:53 2019
Mount count:              17
Maximum mount count:      -1
Last checked:             Thu Feb 21 07:09:31 2019
Check interval:           0 (<none>)
Lifetime writes:          802 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:              128
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      84ad0f32-1fe8-4b7a-8d1a-353028e247fa
Journal backup:           inode blocks
Checksum type:            crc32c
Checksum:                 0xd26b1d66
Journal features:         journal_64bit journal_checksum_v3
Journal size:             8M
Journal length:           8192
Journal sequence:         0x00000347
Journal start:            0
Journal checksum type:    crc32c
Journal checksum:         0xe13c80a9

root@barley:~/tempserver-check# date; e2fsck -n /dev/stretch-vg/boot
Mon 13 May 2019 11:45:49 PM PDT
e2fsck 1.44.5 (15-Dec-2018)
/dev/stretch-vg/boot: clean, 345/97536 files, 116077/389120 blocks