home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / misc / fips.doc < prev    next >
Text File  |  1994-01-11  |  20KB  |  448 lines

  1.                   Welcome to FIPS
  2.     The First nondestructive Interactive Partition Splitting program
  3.  
  4.                  Version 0.9 beta
  5.                  November 7, 1993
  6.  
  7.              Copyright 1993 by Arno Schaefer
  8.  
  9.  
  10. 0. What you need to use FIPS
  11. 1. Introduction
  12. 2. Safety
  13. 3. Restrictions
  14. 4. Before you start
  15. 5. Use with Stacker/SuperStor/Doublespace
  16. 6. Using FIPS
  17. 7. After splitting the partition
  18. 8. Commandline Switches
  19. 9. Troubleshooting
  20. 10. Credits
  21.  
  22.  
  23. FIPS is a program designed to split an existing DOS partition without deleting
  24. the data on it.
  25.  
  26. FIPS is free software; you can redistribute it and/or modify
  27. it under the terms of the GNU General Public License as published by
  28. the Free Software Foundation; either version 1, or (at your option)
  29. any later version.
  30.  
  31. FIPS is distributed in the hope that it will be useful,
  32. but WITHOUT ANY WARRANTY; without even the implied warranty of
  33. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  34. GNU General Public License for more details.
  35.  
  36. You should have received a copy of the GNU General Public License
  37. along with FIPS; see the file COPYING.  If not, write to
  38. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  39.  
  40. Report problems and direct all questions to:
  41.  
  42.     schaefer@rbg.informatik.th-darmstadt.de
  43.  
  44.  
  45. 0. What you need to use FIPS
  46.  
  47. You need a defragmentation program in order to move all data to the beginning
  48. of the hard disk. FIPS will only split your partition if you have enough free
  49. space at the end. Suitable programs are Norton's Speedisk, PCTools' Compress,
  50. or the Shareware programs ORG, DOG or SAFPAK (available by anonymous FTP from
  51. any simtel mirror in the <msdos.dskutl> directory). I did not test these how-
  52. ever, so don't blame me if they don't work for you.
  53. You may also want to use a program like Norton Disk Doctor to check your
  54. harddisk before and after using FIPS.
  55.  
  56. FIPS was developed under DOS 5.0. It should work fine with anything above
  57. 3.0, perhaps even with 2.0. However it will not be of much use with older
  58. DOS versions, since the large partition sizes are only available since DOS 4.
  59. It should also work under DR-DOS (never tested it, though). It has been
  60. reported to work with DOS 6.0.
  61.  
  62. Don't use FIPS in multitasking environments like OS/2, Desqview, Windows or
  63. the Linux DOS-Emulator. I don't know what will happen, but I would not like
  64. to take any chances. FIPS does not (yet ?) attempt to detect these, so be
  65. careful! Better boot from a DOS disk and then run FIPS.
  66.  
  67.  
  68. 1. Introduction
  69.  
  70. The program was inspired by the Linux Project. When installing Linux on a
  71. PC that was used for DOS / Windows, many people want to retain a smaller
  72. partition for their DOS software. However, since most Harddisks contain
  73. only one large partition, you would normally be required to do a complete
  74. backup, erase the partition and build two (or more) new partitions. Then you
  75. would restore the backup to one of the new partitions.
  76. This is a very time consuming activity and requires lots of diskettes (why
  77. buy 50+ disks only to once backup and restore your HD?).
  78. FIPS was written to remedy this problem. You can now split a partition
  79. without losing any data, provided there is enough free space for the new
  80. partition at the end of the old one.
  81.  
  82.  
  83. 2. Safety
  84.  
  85. FIPS was specifically designed to provide a maximum of safety. On startup
  86. it checks the Partition Table, Boot Sector and FAT for any inconsistencies.
  87. If it finds anything suspicious, it will tell you so. If there are errors,
  88. FIPS will not proceed.
  89. You have the possibility to write backup copies of your root- and bootsector
  90. to a floppy disk before proceeding. If something goes wrong, you may restore
  91. these with the program 'restorrb.exe' (see section 4).
  92. After you have entered the start cylinder for the new partition, FIPS will
  93. check if the new partition is completely empty by examining the FAT of the
  94. old one. If it is not, FIPS will stop.
  95. After having calculated the new Partition Table and Bootsector, FIPS will
  96. check them again, so that eventual bugs in the calculation may be detected.
  97. Only if everything is ok, FIPS will ask for permission to write the new
  98. Root- and Bootsector.
  99.  
  100.  
  101. 3. Restrictions
  102.  
  103. FIPS will only work with Hard Disk BIOSes that use interrupt 13h for low
  104. level harddisk access. I don't know if there exist others, but if you happen
  105. to have one (large SCSI disks, perhaps?), FIPS will most certainly not find
  106. any meaningful data and thus will exit without attempting to write anything.
  107.  
  108. FIPS will only work on disks with a sector size of 512 bytes.
  109. It seems that DOS is prepared to deal with different sector sizes, but so
  110. far I did not hear of formatting programs that use this possibility.
  111. If anybody can tell me anything about it, I may incorporate this in a later
  112. release.
  113.  
  114. FIPS will not split partitions with 12-bit FATs (you would not want to split
  115. partitions with less than 10 MB, would you?).
  116.  
  117. FIPS will only split DOS partitions. Partition Table and Bootsector must
  118. conform to the MSDOS 3.0+ conventions. This is marked by the system
  119. indicator byte in the partition table, it must have the value 4 (16-bit
  120. sector number) or 6 (32-bit sector number).
  121. It will especially *not* split Linux-partitions.
  122.  
  123. FIPS does not yet work on extended DOS partitions.
  124.  
  125. FIPS will not work if you already have four partitions, since it needs one
  126. free partition entry.
  127.  
  128. FIPS will not reduce the original partition to a size with less than 4085
  129. clusters, because this would imply rewriting the 16-bit FAT to a 12-bit FAT.
  130.  
  131. 4. Before you start
  132.  
  133. Run CHKDSK on the partition you want to split. If you have Norton Disk Doctor
  134. or something similar, you may use it also. Make sure there remain no 'dead'
  135. clusters on the disk.
  136. Prepare a bootable floppy disk in drive A:. If you need a device driver to
  137. access your harddisk, install it on the floppy (see your Hard Disk Controller
  138. manual for details). Copy the file RESTORRB.EXE to this disk. When starting
  139. FIPS, you will be given the opportunity to write backup copies of your root-
  140. and bootsector to a file on drive A: called ROOTBOOT.00x (where x stands
  141. for a digit from 0 to 9).
  142. If anything goes wrong while using FIPS, you can restore the original infor-
  143. mation by booting from the floppy and running RESTORRB.
  144.  
  145. In addition to this you *must* now defragment your Harddisk. All of the space
  146. that will be used for the new partition must be free. Be aware that the
  147. Windows Swapfile will not be moved by most defragmentation programs. You must
  148. uninstall it (in the 386enhanced part of the Windows Control Panel) and rein-
  149. stall it after using FIPS. 
  150. If you use IMAGE or MIRROR, the last sector of the hard disks contains a
  151. hidden system file with a pointer to your mirror files. You must delete this
  152. file before using FIPS (it will be recreated the next time you run mirror).
  153. Do 'attrib -r -s -h image.idx' or 'attrib -r -s -h mirorsav.fil' in the root-
  154. directory, then delete the file.
  155. If FIPS still complains about the new partition not being empty after defrag-
  156. mentation, this may mean
  157.  
  158. a. You still have too much data in the remaining partition. Consider making
  159.    the new partition smaller or deleting some of the data.
  160.  
  161. b. There are hidden files in the space of the new partition that have not
  162.    been moved by the defragmentation program. Make sure to which program
  163.    they belong. If a file is a swap file of some program (for example NDOS)
  164.    it is possible that it can be safely deleted (and will be recreated
  165.    automatically later when the need arises). See your manual for details.
  166.    
  167.    If the file belongs to some sort of copy protection, you must uninstall
  168.    the program to which it belongs and reinstall it after repartitioning.
  169.    
  170.    I can't give you more aid in this - if you really can't figure out what
  171.    to do, contact me directly.
  172.  
  173. Attention! If you use a DOS-version lower than DOS 5.0 do *not* try to move
  174. DOS' hidden system files (ibmbio.com & ibmdos.com or something similar). You
  175. will end up with a harddisk that won't boot any more. Since these files are
  176. already in the first sectors of the partition, it is not necessary to move
  177. them.
  178.  
  179. Be aware that the location of your DOS partitions in the partition table may
  180. change. If you use the new partition under DOS *and* you have an extended
  181. partition and/or two drives, this means that the names of the partitions may
  182. change (D: may become E: for example). I have taken care that C: always re-
  183. mains C:,  so that you will still be able to boot.
  184.  
  185. For Linux users:
  186. This also means that the number of the DOS partition under Linux may change
  187. (/dev/hda3 may become /dev/hda1). Any existing Linux partitions will not
  188. change, so that you will have no trouble booting (this was corrected in ver-
  189. sion 0.2.2). You just need to edit your /etc/fstab file if you mount your DOS
  190. partition on bootup.
  191.  
  192.  
  193. 5. Use with Stacker/SuperStor/Doublespace 
  194.  
  195. I received reports that the following scheme works with Stacker, it may also
  196. work with the other programs. I can't confirm this, since I don't use any of
  197. these programs.
  198.  
  199. a. Make sure that there is enough space on the compressed partition to be
  200.    split.
  201. b. Use the Checkdisk program that comes with the compression software.
  202. c. Remove the Windows swapfile (if you have one).
  203. d. Decrease the size of the compressed volume with the utilities that come
  204.    with the compression software.
  205. e. Boot without the compression device driver.
  206. f. Look at the directory listing to see how much space is available for the
  207.    new partition.
  208. i. use FIPS as described below.
  209.  
  210. If the compressed volume is fragmented (I don't know if this is possible),
  211. FIPS will complain about the partition not being empty. You may need to add
  212. the following steps. Attention: I can not guarantee that this will not cor-
  213. rupt the compression scheme, see your manual for details. It seems to work
  214. with Stacker, but I have no reports about the other programs.
  215.  
  216. g. Remove Hidden, Readonly and System attributes from compressed volume.
  217. h. Defragment the partition.
  218.  
  219. j. Reset Hidden, Readonly and System attributes on compressed volume.
  220.  
  221. Please let me know if this scheme works for you, so that I can include this
  222. info in later releases.
  223.  
  224.  
  225. 6. Using FIPS
  226.  
  227. You start FIPS by typing FIPS at the DOS prompt, followed by <ENTER>.
  228. You may exit from the program at any time by pressing <CTRL-C>.
  229.  
  230. FIPS will first detect you hard disks, if you have more than one, it will
  231. ask you which one you want to work on.
  232. FIPS then reads the rootsector of the hard disk and display the partition
  233. table.
  234.  
  235. Example:
  236.  
  237.      |        |     Start      |      |      End       | Start  |Number of|
  238. Part.|bootable|Head Cyl. Sector|System|Head Cyl. Sector| Sector |Sectors  |  MB
  239. -----+--------+----------------+------+----------------+--------+---------+----
  240. 1    |    yes |   0  148      1|   83h|  15  295     63|  149184|   149184|  72
  241. 2    |     no |   1    0      1|   06h|  15  139     63|      63|   141057|  68
  242. 3    |     no |   0  140      1|   06h|  15  147     63|  141120|     8064|   3
  243. 4    |     no |   0    0      0|   00h|   0    0      0|       0|        0|   0
  244.  
  245.  
  246. If you don't know what to make of this, don't worry too much. You may just use
  247. the number of Megabytes to identify your partitions.
  248.  
  249. The rootsector is then checked for errors.
  250.  
  251. If you have more than one partition on the disk, you will be asked which one
  252. you want to split.
  253.  
  254. The bootsector of the chosen partition is read and some information is dis-
  255. played.
  256.  
  257. Example:
  258.  
  259. Bytes per sector: 512
  260. Sectors per cluster: 8
  261. Reserved sectors: 1
  262. Number of FATs: 2
  263. Number of rootdirectory entries: 512
  264. Number of sectors (short): 0
  265. Media descriptor byte: f8h
  266. Sectors per FAT: 145
  267. Sectors per track: 63
  268. Drive heads: 16
  269. Hidden sectors: 63
  270. Number of sectors (long): 141057
  271. Physical drive number: 80h
  272. Signature: 29h
  273.  
  274.  
  275. FIPS checks if this information is consistent with the partition table and
  276. tries to detect other errors.
  277.  
  278. It then verifies if the two copies of the FAT are identical, if they are not,
  279. FIPS will exit with an error message.
  280.  
  281. If everything checks out ok, you may now enter on which cylinder the new par-
  282. tition should start. The calculation is the following: The size of one cylin-
  283. der in KB is: number of heads * number of sectors per track / 2 (in the above 
  284. case 504 KByte). The new starting cylinder is: start cylinder of partition
  285. (from the partition table) + (desired size of reduced partition in KB / size 
  286. of one cylinder in KB).
  287.  
  288. Example:
  289. If I want to reduce partition 2 in the above example to 50 MB, I calculate: 
  290. 0 + ((50 * 1024) / 504) = 101. This is the number I would enter, which would
  291. result in a 50 MB and a new 18 MB partition.
  292.  
  293. FIPS will look if the space for the new partition is empty, if not it will
  294. stop.
  295.  
  296. After this, FIPS will calculate the changes to the rootsector, check the
  297. changes and display the new partition table. You may now choose to reedit the
  298. partition table (this will return you to the point where you select the par-
  299. tition) or to continue. If you type 'c', FIPS will calculate the changed
  300. bootsector, check it again and prompt you if you want to proceed. If you type
  301. 'y' then, FIPS will write the changes to the disk and exit.
  302.  
  303.  
  304. 7. After splitting the partition
  305.  
  306. Your new partition will be recognized by DOS after your first reboot. Make
  307. sure to disable all programs that write to your disk in config.sys and
  308. autoexec.bat before rebooting. Your best bet is to rename these two files
  309. or to boot from floppy. You should especially disable MIRROR or IMAGE.
  310. After rebooting, use CHKDSK or Norton Disk Doctor to make sure your old (now
  311. smaller) partition is ok. If you don't find any errors, you may now reboot
  312. with your normal config.sys and autoexec.bat. Start some programs and make
  313. sure you can still read your data.
  314.  
  315. If you want to use your new partition under DOS, you must format it. If you
  316. have multiple partitions, make sure to format the right one, the drive names
  317. may have changed!
  318. If you want to use the partition under Linux, you may now change the system
  319. indicator byte with Linux' fdisk, then use MKFS.
  320.  
  321. If you want to split the new partition again in two smaller ones, you must
  322. first format it under DOS, otherwise FIPS will complain (btw. since the
  323. new partition does not yet contain any data, you could as well use fdisk
  324. to delete it and create two new ones).
  325.  
  326.  
  327. 8. Commandline Switches
  328.  
  329. Since version 0.2 there are commandline switches to use FIPS non-interactively
  330. and to override some of the error messages. If you prefer the DOS style, you
  331. may use '/' instead of '-' as the switch character. The switches may be arbi-
  332. trarily combined. Type 'FIPS -help' to get a list of the switches.
  333. Here is a more detailed explanation:
  334.  
  335. -q or -quiet : quiet mode
  336.  
  337. The program only displays the prompts for input, nothing else. If you have
  338. selected drive,partition, start cylinder and save/nosave on the commandline,
  339. the program will run completely silent. Attention: no write confirmation is
  340. requested. Like this, you can use the program in a batch file (I don't think
  341. anybody will ever need this feature - you don't change your partition size
  342. every day - but here it is :-). Perhaps it could be useful in a network
  343. environment with many identical workstations.
  344.  
  345. -t or -test : test mode (no writes to disk)
  346.  
  347. This doesn't need much explanation.
  348.  
  349. -d or -debug : debug mode
  350.  
  351. In this mode, a complete transcript of your session along with some additio-
  352. nal information is written to the file FIPSINFO.DBG in the current directory.
  353. You can send this file to me in case of trouble (see below).
  354. This switch does not interfere with the -d<num> switch.
  355.  
  356. -h or -help or -? : help page
  357.  
  358. A short summary of the switches
  359.  
  360. -d<num>   : select drive <num>
  361.  
  362. Preselect the drive number with this switch. Valid numbers are 128 to 255.
  363. This may also be used to override the automatic drive detection - if for any
  364. reason the drive is not found by FIPS, you may try this switch.
  365.  
  366. -p<num>   : select partition <num>
  367.  
  368. Preselect the partition number (1-4). Only valid partitions are accepted.
  369.  
  370. -c<num>   : new start cylinder = <num>
  371.  
  372. Preselect the new start cylinder - only valid cylinder numbers are accepted.
  373.  
  374. -s+       : save rootsector and bootsector to floppy without prompting
  375. -s-       : do not save rootsector and bootsector to floppy
  376.  
  377. These switches skip the question if you want to save the root- and bootsector.
  378. Insert a floppy disk before starting FIPS when using -s+.
  379.  
  380. -omb      : override 'More than one bootable Partition'
  381.  
  382. There are some bootprograms that do not complain about more than one bootable
  383. partition - they will just use the first one. If you have such a program in
  384. your rootsector and the PC boots normally, you may use this switch to skip
  385. the error message. I would recommend however to delete the wrong flags, if
  386. you have a suitable program.
  387.  
  388. -obf      : override 'Invalid bootable-flag'
  389.  
  390. By modifying the bootable flag and the bootprogram it is theoretically pos-
  391. sible to boot from the second harddrive. If you happen to have such a confi-
  392. guration, use this switch to skip the error message.
  393.  
  394. -ore      : override 'Number of Rootdir entries must be multiple of 16'
  395.  
  396. An invalid number of Rootdir entries is accepted by DOS. If you have no other
  397. means to correct the entry, you may use this switch to skip the error message.
  398.  
  399. -olf      : override 'FAT too large'
  400.  
  401. Since the number of sectors per FAT is a 2-byte number, it is theoretically
  402. possible to have up to 65535 sectors per FAT. This is accepted by DOS, but a
  403. number greater than 256 is not useful, since the largest possible FAT has 256
  404. sectors.
  405.  
  406. -osf      : override 'FAT too small'
  407.  
  408. If the number of clusters in the partition is larger than there are entries
  409. in the FAT, DOS uses only part of the partition. Something has gone *very*
  410. wrong with this partition, but all is not lost - use this switch and reduce
  411. the new partition to a size that can be properly managed.
  412.  
  413. -omd      : override 'Wrong Media Descriptor Byte in FAT/Bootsector'
  414.  
  415. The media descriptor byte should be F8h for a harddisk, but other values like
  416. FCh are accepted by DOS (perhaps used for removable media ?), so you can
  417. override the error message with this switch.
  418.  
  419.  
  420. 9. Troubleshooting
  421.  
  422. FIPS is still very experimental, and when in doubt I usually decided to stay
  423. safe and display error messages when encountering suspicious configurations.
  424. For some of the minor errors I added override switches (see section 8).
  425. If you can't resolve a problem yourself, or have a configuration not sup-
  426. ported by FIPS, or if you suspect a bug in FIPS, make a transcript of your
  427. session using the -d switch and send the file FIPSINFO.DBG along with a
  428. short comment to schaefer@rbg.informatik.th-darmstadt.de. Possibly your
  429. problem has already been solved.
  430.  
  431.  
  432. 10. Credits
  433.  
  434. FIPS is based on the procedure described by Drew Eckhardt in Linux digest132.
  435. Most of what I know about Harddisk structures comes from the excellent german
  436. book 'Scheibenkleister II' by Claus Brod and Anton Stepper. It is for the
  437. Atari ST, but much of it applies to PCs also.
  438. Information on the Harddisk Interrupts was drawn from Ralf Brown's Interrupt
  439. List. Thanks to Hamish Coleman for some useful info and to Paul Smith for
  440. his good suggestions. Gunnar Hilmarsson suggested the procedure for stacked
  441. drives, and Miguel Alvarez helped me improve the partition ordering. Chetan
  442. Patil, Rand Phares and Eric Jung pointed me at bugs in the program and
  443. documentation. Thanks to all others who sent me feedback.
  444.  
  445.  
  446. Arno Schaefer
  447. schaefer@rbg.informatik.th-darmstadt.de
  448.