Re: [gentoo-user] Trying to loopback mount partition from a disk image

2009-11-23 Thread Volker Armin Hemmann
On Montag 23 November 2009, Stroller wrote:
 Hi there,
 
 With reference to a couple of previous threads:
http://thread.gmane.org/gmane.linux.gentoo.user/193263
http://thread.gmane.org/gmane.linux.gentoo.user/197120
 
 Here's what I'm trying:
 
 $ ls -lh sda.dd.img
 -rw-r--r-- 1 stroller users 77G 2009-11-22 03:51 sda.dd.img
 $ file sda.dd.img
 sda.dd.img: x86 boot sector, Microsoft Windows XP MBR, Serial
 0x1890189; partition 1: ID=0x7, active, starthead 1, startsector 63,
 160810587 sectors, code offset 0xc0
 $ parted sda.dd.img p
 WARNING: You are not superuser.  Watch out for permissions.
 Model:  (file)
 Disk /path/to/sda.dd.img: 82.3GB
 Sector size (logical/physical): 512B/512B
 Partition Table: msdos
 
 Number  Start   End SizeType File system  Flags
   1  32.3kB  82.3GB  82.3GB  primary  ntfs boot
 
 $ fdisk -l sda.dd.img
 You must set cylinders.
 You can do this from the extra functions menu.
 
 Disk sda.dd.img: 0 MB, 0 bytes
 255 heads, 63 sectors/track, 0 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
 Disk identifier: 0x01890189
 
   Device Boot  Start End  Blocks   Id  System
 sda.dd.img1   *   1   1001080405293+   7  HPFS/NTFS
 Partition 1 has different physical/logical endings:
   phys=(1023, 254, 63) logical=(10009, 254, 63)
 $
 $ sudo losetup -o 8225280 /dev/loop0 sda.dd.img
 $ sudo mount -v /dev/loop0 /mnt/floppy/
 mount: you didn't specify a filesystem type for /dev/loop0
 I will try all types mentioned in /etc/filesystems or /proc/
 filesystems
 Trying #
 Trying #vfat
 Trying fuseblk
 mount: you must specify the filesystem type
 $
 
 
 If I format a USB stick as NTFS I can mount and read it fine, so NTFS
 driver modules are correctly compiled into the kernel.
 
 I can `losetup` to a loop device and then `fdisk -l` or `parted /dev/
 loop0 p` and see the partitions.
 
 I've tried with an offset of 512 bytes instead of 8225280 with the
 same results - I guess I'm getting a little confused about what the
 correct offset should be. Thinking about this now it seems obvious
 that 512 should be correct, but anyway, that isn't working.
 
 I get the same as Pat trying this:
  http://article.gmane.org/gmane.linux.gentoo.user/197123
 
 But:
 
 $ sudo losetup -d /dev/loop0
 $ sudo losetup  /dev/loop0 sda.dd.img
 $ sudo fdisk -l  /dev/loop0
 
 Disk /dev/loop0: 82.3 GB, 82348277760 bytes
 255 heads, 63 sectors/track, 10011 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
 Disk identifier: 0x01890189
 
Device Boot  Start End  Blocks   Id  System
 /dev/loop0p1   *   1   1001080405293+   7  HPFS/NTFS
 $
 
 /dev/loop0p1 seems inaccessible to me.
 
 Really, any suggestions on how to access this virtual partition
 would be great. Oh, I've also tried to run ntfsclone on it, because
 that can produce images which can be loopback mounted (as per `man
 ntfsclone`) but again, ntfsclone need to be pointed at a partition of
 a hard-drive in order to produce the loopback-mountable image in the
 first place.
 
 Any thoughts?
 
 Stroller.
 

yeah, you don't need to use losetup. I mounted a lot of images over the years 
and I never used losetup.



Re: [gentoo-user] Trying to loopback mount partition from a disk image

2009-11-23 Thread Stroller


On 23 Nov 2009, at 18:50, Volker Armin Hemmann wrote:

On Montag 23 November 2009, Stroller wrote:

Hi there,

With reference to a couple of previous threads:
  http://thread.gmane.org/gmane.linux.gentoo.user/193263
  http://thread.gmane.org/gmane.linux.gentoo.user/197120

Here's what I'm trying:

$ ls -lh sda.dd.img
-rw-r--r-- 1 stroller users 77G 2009-11-22 03:51 sda.dd.img
$ file sda.dd.img
sda.dd.img: x86 boot sector, Microsoft Windows XP MBR, Serial
0x1890189; partition 1: ID=0x7, active, starthead 1, startsector 63,
160810587 sectors, code offset 0xc0
...


yeah, you don't need to use losetup. I mounted a lot of images over  
the years

and I never used losetup.


How do I do it then, please?

Note, it's an image of an entire hard-drive, imaged using `dd` or GNU  
`ddrescue`, so it also includes the MBR  partition table. It's not  
just a partition or an .iso optical disk image.


Stroller.




Re: [gentoo-user] Trying to loopback mount partition from a disk image

2009-11-23 Thread Alex Schuster
Volker Armin Hemmann writes:

 On Montag 23 November 2009, Stroller wrote:

  $ fdisk -l sda.dd.img
  You must set cylinders.
  You can do this from the extra functions menu.
 
  Disk sda.dd.img: 0 MB, 0 bytes
  255 heads, 63 sectors/track, 0 cylinders
  Units = cylinders of 16065 * 512 = 8225280 bytes
  Disk identifier: 0x01890189
 
Device Boot  Start End  Blocks   Id  System
  sda.dd.img1   *   1   1001080405293+   7  HPFS/NTFS
  Partition 1 has different physical/logical endings:
phys=(1023, 254, 63) logical=(10009, 254, 63)
  $
  $ sudo losetup -o 8225280 /dev/loop0 sda.dd.img

Try -o $(( 63*512 )). 63 is the start sector, you see this when you enter 
the U command in fdisk in order to change the units.

 yeah, you don't need to use losetup. I mounted a lot of images over the
 years and I never used losetup.

Um, even if the partition does not start at the beginning? I tried this a 
while ago, giving the offset directly as mount option, but it did not work 
at all. But when I also tried it manually with losetup, I succeeded.

Wonko



Re: [gentoo-user] Trying to loopback mount partition from a disk image

2009-11-23 Thread Volker Armin Hemmann
On Montag 23 November 2009, Stroller wrote:
 On 23 Nov 2009, at 18:50, Volker Armin Hemmann wrote:
  On Montag 23 November 2009, Stroller wrote:
  Hi there,
 
  With reference to a couple of previous threads:
http://thread.gmane.org/gmane.linux.gentoo.user/193263
http://thread.gmane.org/gmane.linux.gentoo.user/197120
 
  Here's what I'm trying:
 
  $ ls -lh sda.dd.img
  -rw-r--r-- 1 stroller users 77G 2009-11-22 03:51 sda.dd.img
  $ file sda.dd.img
  sda.dd.img: x86 boot sector, Microsoft Windows XP MBR, Serial
  0x1890189; partition 1: ID=0x7, active, starthead 1, startsector 63,
  160810587 sectors, code offset 0xc0
  ...
 
  yeah, you don't need to use losetup. I mounted a lot of images over
  the years
  and I never used losetup.
 
 How do I do it then, please?
 
 Note, it's an image of an entire hard-drive, imaged using `dd` or GNU
 `ddrescue`, so it also includes the MBR  partition table. It's not
 just a partition or an .iso optical disk image.
 
 Stroller.
 

modprobe loop
mount -o loop /image /pfad



Re: [gentoo-user] Trying to loopback mount partition from a disk image

2009-11-23 Thread Stroller


On 23 Nov 2009, at 19:11, Alex Schuster wrote:


Volker Armin Hemmann writes:


On Montag 23 November 2009, Stroller wrote:



$ fdisk -l sda.dd.img
You must set cylinders.
You can do this from the extra functions menu.

Disk sda.dd.img: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x01890189

 Device Boot  Start End  Blocks   Id  System
sda.dd.img1   *   1   1001080405293+   7  HPFS/NTFS
Partition 1 has different physical/logical endings:
 phys=(1023, 254, 63) logical=(10009, 254, 63)
$
$ sudo losetup -o 8225280 /dev/loop0 sda.dd.img


Try -o $(( 63*512 )). 63 is the start sector, you see this when you  
enter

the U command in fdisk in order to change the units.


Brilliant! That's it!

Many thanks.

Stroller.