Re: Slightly OT: Building with a VM

2011-04-25 Thread me,apporc
Hi
Is there a book or someting like which i can refer to for these knowledge
about disks , images files and partitions .
I don't know how to mount a partition in a image file with offset .I want to
know detailed knowledge about this . I hope you can give me an advice.

Thanks.
On Fri, Apr 22, 2011 at 1:06 PM, Neal Murphy neal.p.mur...@alum.wpi.eduwrote:

 On Friday 22 April 2011 00:34:42 Mike McCarty wrote:
  Neal Murphy wrote:
   Bother! Clicked the wrong button!
 
  [nice stuff snipped]
 
  I very much appreciate the suggestions for PT editors. Thanks!
 
  However, I'd like to get an answer to the question about the
  offsets within the file to get to the starts of the file systems.
 
  Am I missing something, like I need to allow for the BPB at the
  beginning of some of the partitions? Something like that? If so,
  then why does volume 2 mount w/o problem, based upon the computed
  offsets. What does fdisk mean when it says that the physical and
  logical start/end of a volume are not the same? I understand the
  usual layout of an MBR and the PT, and I'm not sure what
  inconsistency there can be, unless the BPB and the PT disagree
  in some way.

 Oh, duh. Out! Out, demons of stupidity! I inwardly sneer at others who
 don't
 answer the posed question. Then I go and do it myself.

 To answer your question, your VM system probably has some stuff at the
 beginning of the image, which is another offset to account for. Your fdisk
 output looks like this is the case.

 The difference between physical and logical start/end is most likely the
 difference between CHS/sector counting and LBA counting; fdisk is saying
 they
 don't line up. You probably don't have the correct offset(s). When you get
 it
 right, fdisk won't know it's not looking at a hard drive.

 Make a fresh, small-ish image file for your VM system, boot something, make
 a
 partition at the beginning, put EXT3 on it, then 'od -c|head' that node and
 remember the byte pattern at the beginning. Then put a known unique-ish
 data
 pattern in the boot sector. Close and exit the VM and look for those byte
 patterns. That'll give you the offset for the VM system and the offset for
 the
 boot sectors/partition table/multi-disk info. Yes, you can probably find
 the
 info on the web somewhere, but it's much more gratifying to find it
 yourself
 eh.
 --
 http://linuxfromscratch.org/mailman/listinfo/lfs-support
 FAQ: http://www.linuxfromscratch.org/lfs/faq.html
 Unsubscribe: See the above information page

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page


Re: Slightly OT: Building with a VM

2011-04-25 Thread Neal Murphy
On Tuesday 26 April 2011 00:25:52 me,apporc wrote:
 Hi
 Is there a book or someting like which i can refer to for these knowledge
 about disks , images files and partitions .
 I don't know how to mount a partition in a image file with offset .I want
 to know detailed knowledge about this . I hope you can give me an advice.

Point one: the block stream in an image file is very much like the block 
(sector) stream on a hard drive.

Point two: the man pages are your friend; 'man mount' and 'man losetup' will 
tell you what you need to know about mounting image files and using offsets 
into those images. Here is a very simple, generic example of mounting file 
disk.image onto mount point '/mnt' with an offset 234 bytes into the file:
  mount disk.image /mnt -o loop,offset=234

As to determining the actual offsets to use, you will have to read up on the 
particular VM technology used, be it QEMU, VMware, Xen, VirtualBox or any 
other system. I expect they will all be different. You will also have to 
research the various partition format available (MSDOS, PC98, GPT, Apple, SCO, 
BSD, etc.); they're all different.

You should even find information via Google or Wikipedia about specific image 
file formats, but this takes time and persistence.

I've learned what I know about the subject from the man pages, Google, 
Wikipedia and plenty of plain, dogged experimentation using dd, od and other 
shell tools to dissect image files in order to figure out what is where in the 
files.

N
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page