On 2010-06-29 20:22, Eberhard Moenkeberg wrote: > On Tue, 29 Jun 2010, Jefferson Ogata wrote: >> You should be able to use dmsetup to create device nodes with offset >> into /dev/sda if you want to do this. But you should be able to find >> your filesystem headers with dd and xxd (or any hexdump program). > > A very good idea, to avoid the reboot.
Well, apparently using dmsetup doesn't work because the kernel refuses to set up new mappings directly on /dev/sda, possibly because there's an existing lock on the device due to the partition table being loaded. >> Where to look: >> >> - The first partition starts one track into the disk; typically that's >> 63 512-byte sectors. >> >> - The second, third, and fourth partitions are usually on cylinder >> boundaries, with a cylinder typically being 63 * 255 512-byte sectors. >> >> - If you had more than four partitions, then the last physical partition >> has a partition table at the beginning. The first logical partition will >> begin one track into that physical partition. >> >> What to look for: >> >> - For ext3 filesystems, a superblock begins 1024 bytes into the >> partition. At offset 0x38 in the superblock you should find the magic >> number 0x53ef (big-endian). >> >> - For swap partitions, look at the first 4096 bytes. At the end of that >> page you should find the string SWAPSPACE2. >> >> - For LVM physical volumes you should see an LVM label 512 bytes from >> the beginning of the partition. > > A nice collection. Thanks, I will keep it in case i get into partition > table trouble. A little more info: - For ext3 filesystems, the superblock begins with a series of uint32_ts in little-endian format. The second uint32_t is the number of filesystem blocks in the filesystem. The seventh uint32_t is the block size, expressed as the number of bits to shift 1024 left. (So 0 for 1024-byte blocks, 1 for 2048-byte blocks, 2 for 4096-byte blocks). From this you can calculate the offset to the next partition--multiply the number of blocks by the actual blocksize and round up to a cylinder boundary. _______________________________________________ Linux-PowerEdge mailing list [email protected] https://lists.us.dell.com/mailman/listinfo/linux-poweredge Please read the FAQ at http://lists.us.dell.com/faq
