I used the AWS import service to import a large (2TB) drive, and they dropped two .bin files in my S3 account. Their instructions say to stripe together to EBS volumes to make a drive large enough to hold the image and then to just use that.

Well I've got everything striped and whatnot, but I don't know what to do with this .bin image. Doesn't seem to work with mount, or at least, not without any options, and I don't know what options to put.

>file -k image-NPX7P-0000.bin
image-NPX7P-0000.bin: x86 boot sector; partition 1: ID=0xb, starthead 1, startsector 63, 3907024821 sectors, extended partition table (last)\011, code offset 0x0

>file -k image-NPX7P-0001.bin
image-NPX7P-0001.bin: data

EDIT: I appended the file info, and from the looks of it, I'd assume the reason I can't mount just 0000 is because 0001 is an extension of it (which tracks with how I assume they did this). But how would I merge the two and mount that?

EDIT2: Using osgx's answer, I was able to get the two bin files catted together, and used kpartx to read the partition table.

> file-sk: /dev/dm-2: x86 boot sector, code offset 0x58, OEM-ID "BSD 4.4", sectors/cluster 64, heads 255, sectors 3907024821 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 476816, reserved3 0x1000000, reserved 0x1, serial number 0x5cb415f7, label: "SOURCE-PSE " DOS executable (COM), boot code –

This still will not mount however. It says it requires a filesystem type, and nothing I've used helps. Also posted to a pastebin because it's long is my kernal config of the relevant (maybe) values:

http://pastebin.com/j7iS7RF3

link|improve this question
try to run a file -k on your bin file and post results here. – osgx Jul 30 '11 at 21:54
added in the file -k info – UltimateBrent Aug 2 '11 at 23:34
and what are sizes (ls -l image*)? – osgx Aug 2 '11 at 23:56
kpartx can read partition table from the image file and remap every partition to separate device. – osgx Aug 3 '11 at 0:06
feedback

migrated from stackoverflow.com Aug 1 '11 at 4:45

This question came from our site for professional and enthusiast programmers.

3 Answers

up vote 3 down vote accepted

According to file -k, you have a disk image (may be it is splitted into two volumes); the disk image has partition table of one 2TB (39G sectors of 512 = 2TB) and of type FAT32 (0x0b).

Do a cat to concatenate both images into one

cat image*bin > image.iso

OR (carefull! this will modify first file)

cat image*0001* >> image*0000*

Run a kpartx to read partition table over image.iso via loop1 device (now you will need a root; replace image.iso with image*0000* if you did a second way of catting)

losetup /dev/loop1 image.iso; kpartx -av /dev/loop1;

Output will be like add map loop1p1 ...

Then find the loop1p1 in /dev/mapper

ls -l /dev/mapper
file -sk /dev/mapper/*   # finally check that it is a FAT32

And mount it:

mount -o ro -t auto /dev/mapper/loop1p1 /where/to/mount

Work with fs; umount it; run a kpartx -d -v /dev/loop1; ; unmap loop1 with losetup

(manual used http://nfolamp.wordpress.com/2010/08/16/mounting-raw-image-files-and-kpartx/ )

link|improve this answer
I hope you have 6 TB of disk space (2TB for original files; 2TB for image.iso; 2 TB for recovered data). In the similar situation (recover a 2 TB) I had no such disk space and still have no. – osgx Aug 3 '11 at 0:17
1  
Well my genius knows no bounds. I did the second method, thinking I wouldn't need the extra space at least for that part, but didn't think about it catting to the other file and needing 3TB total. So I gotta regrab the files. That'll take a while then I'll post my results. – UltimateBrent Aug 3 '11 at 0:44
No dice: losetup /dev/loop1 image-NPX7P-0000.bin; kpartx -av /dev/loop1; /dev/loop1: Permission denied /dev/mapper/control: open failed: Permission denied Failure to communicate with kernel device-mapper driver. device mapper prerequisites not met – UltimateBrent Aug 6 '11 at 0:43
you can't mount an image without dev-mapper. Are you root? What is OS? – osgx Aug 6 '11 at 0:50
1  
Thought I would post here to complete the loop. I just ended that ec2 instance and found a suse pre-made that had vfat ready to go, and your mount option worked like a charm. I owe you big time osgx! – UltimateBrent Aug 8 '11 at 5:33
show 8 more comments
feedback

Try to mount it with the -o loop option.

link|improve this answer
This will only work for ISO9660 files. – cartman Jul 30 '11 at 21:16
3  
@Ismail: no, it will work for any image file with a filesystem that can be recognized by mount. – ninjalj Jul 30 '11 at 21:28
Tells me I must specifiy a filesystem type, but I have no idea what to put. ntfs and iso9660 did not work – UltimateBrent Aug 2 '11 at 23:36
feedback

use bchunk and convert into iso then you can easily mount http://goinggnu.wordpress.com/2007/05/08/howto-mount-bincue-files-in-linux/

link|improve this answer
There's no cue file, just the bin – UltimateBrent Jul 30 '11 at 19:34
If you have a bin file without cue you can always try creating new text file with this content: FILE “yourbinfilenamehere.bin” BINARY TRACK 01 MODE1/2352 INDEX 01 00:00:00 But I think osgx's solution is the correct answer. – Krzysztof Hasiński Aug 3 '11 at 3:26
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.