Other Mount img file with several partitions

Hello,
I'm trying to mount an image file (raspbian SD card image).
Under Linux I should use -o option of mount to define the offset of the second partition (ext2fs). As I understand, under FreeBSD I should use mdconfig to create a device from img file and gnop to create a second device with the offset needed.
So I got the first device:
Code:
# gpart list md0
Geom name: md0
modified: false
state: OK
fwheads: 128
fwsectors: 43
last: 3788799
first: 1
entries: 4
scheme: MBR
Providers:
1. Name: md0s1
  Mediasize: 58720256 (56M)
  Sectorsize: 512
  Stripesize: 0
  Stripeoffset: 4194304
  Mode: r0w0e0
  rawtype: 12
  length: 58720256
  offset: 4194304
  type: !12
  index: 1
  end: 122879
  start: 8192
2. Name: md0s2
  Mediasize: 1876951040 (1.7G)
  Sectorsize: 512
  Stripesize: 0
  Stripeoffset: 62914560
  Mode: r0w0e0
  rawtype: 131
  length: 1876951040
  offset: 62914560
  type: linux-data
  index: 2
  end: 3788799
  start: 122880
Consumers:
1. Name: md0
  Mediasize: 1939865600 (1.8G)
  Sectorsize: 512
  Mode: r0w0e0

And I created the second device:

Code:
# gnop create -v -o 62914560 md0
Done.
# gnop list
Geom name: md0.nop
WroteBytes: 0
ReadBytes: 75264
Writes: 0
Reads: 24
Error: 5
WriteFailProb: 0
ReadFailProb: 0
Offset: 62914560
Providers:
1. Name: md0.nop
  Mediasize: 1876951040 (1.7G)
  Sectorsize: 512
  Mode: r0w0e0
Consumers:
1. Name: md0
  Mediasize: 1939865600 (1.8G)
  Sectorsize: 512
  Mode: r0w0e0

Now I would like to mount my device to a directory - and I can't:

Code:
# mount -t ext2fs /dev/md0.nop /mnt/img
mount: /dev/md0.nop: Invalid argument
# gpart list md0.nop
gpart: No such geom: md0.nop.

The geom is here:

Code:
# geom nop list
Geom name: md0.nop
WroteBytes: 0
ReadBytes: 75264
Writes: 0
Reads: 24
Error: 5
WriteFailProb: 0
ReadFailProb: 0
Offset: 62914560
Providers:
1. Name: md0.nop
  Mediasize: 1876951040 (1.7G)
  Sectorsize: 512
  Mode: r0w0e0
Consumers:
1. Name: md0
  Mediasize: 1939865600 (1.8G)
  Sectorsize: 512
  Mode: r0w0e0

I can even dd from it:

Code:
# dd if=/dev/md0.nop of=/dev/null
3665920+0 records in
3665920+0 records out
1876951040 bytes transferred in 35.631983 secs (52676020 bytes/sec)

What did I miss? How can I access this filesystem?
 
What did I miss?
FreeBSD already detected your partitions. Look at the output of geom list md0. md0s2 begins at the offset 62914560 which is the same number you gave to gnop. What I am saying is that you don't need gnop here. Just use /dev/md0s2 as device for mounting. You might need to undo the gnop command first with gnop destroy md0.nop.
 
tobik,
Sure, I've tried already 'the simple way':
Code:
# mount -t ext2fs /dev/md0s2 /mnt/img
mount: /dev/md0s2: Invalid argument
 
Code:
# file -s /dev/md0s2
/dev/md0s2: Linux rev 1.0 ext4 filesystem data, UUID=62ba9ec9-47d9-4421-aaee-71dd6c0f3707 (extents) (large files)
It seems that the ext4 is my problem - I can access the slice in ro mode.
I'm really surprised that ext4 rw access is not available on FreeBSD in native mode, I'll try sysutils/fusefs-ext4fuse...

Update:
ext4fuse is readonly too... :(
No way?
 
Last edited by a moderator:
Back
Top