slice-table / partition-table

gs_stoller at juno.com gs_stoller at juno.com
Thu Dec 22 11:25:14 PST 2005


	I have 2 hard drives on my system.  One (my main drive) has an
 MS-DOS  slice (naturally the first slice) and  3  FreeBSD  slices.
The other drive had 1  OS2  slice (just because an  OS2 CDROM  was used
to slice it up) and 1  MS-DOS  slice.  At one time, I was thinking of
putting the boot program on the second hard drive, and may have done
it with the  CDROM  of  FreeBSD 4.7 .  Recently, while I was running
 MS-DOS  and processing e-mail (trying to remove an attachment from
a letter in order to save it in the  MS-DOS  slice on the second hard
drive) through  juno.com , I discovered that the  MS-DOS  slice on this
second hard drive was hosed (naturally, that discovery could only be
made while running  MS-DOS ), and verified that fact by trying to go to a directory on that second drive.   MS-DOS  didn't go there but complained, and following that I couldn't see anything on that second drive.
	To investigate this, I rebooted into my  FreeBSD 4.3  slice and
found that the  slice-table  (often called "partition-table") on the second drive was identical to that of the first drive.  In fact, when I tried  fdisk  on each drive, I found the results identical except for the size (# of cylinders) of the drives.  Originally, the second drive's  fdisk  results stated 3 heads and some sectors per cylinder (but I don't recall how many).  I conclude that there is a strong possibility that only the  slice-table  sector has been copied (from the first drive), though I have no idea how this could have happened (though I consider the possible putting of the boot program on the second hard drive as possibly contributory).  Does anyone have any idea of how this can happen?  Has anyone seen this or the like before?
	I also conclude that there is a strong possibility that the rest of the second disk (i.e., my data on it) is okay, and if I can rebuild the  slice-table  then I can recover the rest of the disk and all my data.  I think I can do this if I can get the following things/information:
		1)	is there a duplicate of the  slice-table 
			somewhere on the disk, and if so, where is it, 				and how can I examine it rather than the 				primary  slice-table ,
			and is there a way to have its contents replace
			the contents of the primary  slice-table ,
		2)	is there a program that can look at a(n entire) 			disk and break it up into contiguous sectors 				that belong to particular systems (in my case  				OS2  or  MS-DOS ), {I would be willing to write 			such a program if someone would tell me how to 				read sectors without a  slice-table  [say with 				just an  LBA  number] and how to recognize 				whether a sector belongs to  OS2  or  MS-DOS , 				and any timing constraints for reading/writing 				cylinders [e.g., usual timing for getting a 				read/write head to cylinder  0 , the time
			to move between cylinders, etc.], if such 				constraints exist [maybe we have fixed heads 				and so no timing constraints]},
		3)	 FreeBSD  programs (or  Linux  programs or  				 MS-DOS  programs if  FreeBSD  programs aren't 				available) that can read any sector given its  				 LBA  number or the like [somewhat like  fdisk  			reads/writes of sector  0 ], what could be 				really useful [if I have to rebuild files] is a 			program that reads a range of sectors and  				greps  its contents, reporting the  LBA 
			number [and some contents] of those sectors 				that pass the  grep  test,
		4)	the structure of the  slice-table's  sector and 
			of the  slice-table  and  FreeBSD  programs 				that can write specific values (given as 				arguments [say in structures]) into the  				 slice-table  without affecting the contents of 			any other sector on that disk,
		5)	how to mark a  slice  "<UNUSED>",
		6)	 FreeBSD  programs (or  Linux  programs or				 MS-DOS  programs if  FreeBSD  programs aren't 				available) other than  fdisk  that can write 				the  slice-table's  sector (including its magic 			number and boot code) without affecting the 				contents of any other sectoron that disk,
		7)	how can I recognize sectors that were in a 				slice assigned for  MS-DOS  usage, and/or is 				there a way of finding the "first" (i.e., one 				with lowest  LBA ) and "last" sector assigned 				for  MS-DOS  usage or used by  MS-DOS ,
		8)	 FreeBSD  programs (or  Linux  programs or				 MS-DOS  programs if  FreeBSD  programs aren't 				available) software to rebuild files and 				[Windows-98] directories from fragments (with 				human direction) [this is just in case there is 			more damage than I suspect at present,
			I'm hoping not to need this one],
		9)	any caveats or information that would prove 				useful in this endeavor.
	If I have to rebuild the  slice-table  from scratch, I presume that I can make any entries I wish in the  slice-table  and then look at the contents of the  slices  to see if they are what I would like to find there and appropriately change the  slice-table  until I find it set up as it was before.  Anything wrong with my presumption?
	If I succeed in this, I'm thinking of publishing an article on how to recover from this sort of problem.

         uname -a  for my system gives:
FreeBSD  4.3-RELEASE FreeBSD 4.3-RELEASE #0: Sat Apr 21 10:54:49 GMT 2001 jkh at narf.osd.bsdi.com:/usr/src/sys/compile/GENERIC  i386




More information about the freebsd-questions mailing list