8000 [BUG] `mfsbdev` versus `losetup`: can't work with existing disk image · Issue #643 · moosefs/moosefs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[BUG] mfsbdev versus losetup: can't work with existing disk image #643
Open
@onlyjob

Description

@onlyjob

I can't manipulate existing disk image with mfsbdev due to bug(s). First, let's have a look at losetup where things work as expected (this is important for comparison and illustration of the problem):

# stat thinkpad_disk.raw
  File: thinkpad__disk.raw
  Size: 128035676160    Blocks: 250069680  IO Block: 65536  regular file

# losetup -v /dev/loop0 \
    /mnt/mfs/HDD_RAW/thinkpad_disk.raw

# lsblk
loop0        7:0    0 119.2G  0 loop

# partprobe /dev/loop0        ## this is needed to read partitions of the disk image.

# lsblk
loop0        7:0    0 119.2G  0 loop
├─loop0p1  259:1    0   100M  0 part
└─loop0p2  259:2    0 119.1G  0 part

## Note: disk is ready to use.
## `ntfswipe -v -v --unused --pagefile /dev/loop0p2` works, etc.

# parted /dev/loop0
GNU Parted 3.5
Using /dev/loop0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: Loopback device (loopback)
Disk /dev/loop0: 128GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  106MB  105MB  primary  ntfs         boot
 2      106MB   128GB  128GB  primary  ntfs

###############################

# lsblk -b        ## get disk and partitions' size in bytes.
NAME       MAJ:MIN RM          SIZE RO TYPE  MOUNTPOINTS
loop0        7:0    0  128035676160  0 loop
├─loop0p1  259:1    0     104857600  0 part
└─loop0p2  259:2    0  127928369152  0 part

Now I'm trying to do the same using mfsbdev:

# modprobe -v nbd
insmod /lib/modules/6.12.9+bpo-rt-amd64/kernel/drivers/block/nbd.ko.xz

# mfsbdev start
mfsmaster accepted connection with parameters: read-write,restricted_ip,admin ; root mapped to root:root

# sudo mfsbdev map -f /HDD_RAW/thinkpad_disk.raw -n loop
## Note: absolute path did not work so `/mnt/mfs` had to be removed from the path.

# lsblk
nbd0        43:0    0 119.2G  0 disk
├─nbd0p1    43:1    0   800M  0 part
└─nbd0p2    43:2    0 118.5G  0 part

# Note: I didn't have to run `partprobe` to notify kernel of partitions. But if I do...
# (Note the problem: first partition should be `100M`, not `800M`.)

# partprobe /dev/nbd0
Error: Can't have a partition outside the disk!

# parted /dev/nbd0
GNU Parted 3.5
Using /dev/nbd0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Error: Can't have a partition outside the disk!
Ignore/Cancel?

# lsblk -b
nbd0        43:0    0  128035676160  0 disk
├─nbd0p1    43:1    0     838860800  0 part
└─nbd0p2    43:2    0  127188426752  0 part

So mbsbdev got the size of the disk properly but somehow first partition is 800M instead of 100M and the second partition (i.e. end of the disk) is cropped, being smaller than it should be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0