tpm@wdl58.wdl.fac.com (Tim P McNerney) (10/11/90)
We have a hard disk in which the partition size and the file size do not correspond. To be more specific, our 156MB A/UX partition was made into a 78MB file system (using mkfs) and was not caught for some time. Is there some way in which to non-destructively remake the file system so as to regain the missing 78MB? If not, any suggestions on how to save the missing 78MB? tpm@wdl1.wdl.fac.com
urlichs@smurf.sub.org (Matthias Urlichs) (10/12/90)
In comp.unix.aux, article <1990Oct11.162202.17099@wdl1.wdl.fac.com>,
tpm@wdl58.wdl.fac.com (Tim P McNerney) writes:
<
< [...] our 156MB A/UX partition was made into
< a 78MB file system (using mkfs) and was not caught for some time.
< Is there some way in which to non-destructively remake the file system so
< as to regain the missing 78MB? If not, any suggestions on how to save the
< missing 78MB?
Make the partition smaller, preferably with dp, and add a second 78 MB
partition.
It may make sense to back up your data before doing this, just to be safe...
--
Matthias Urlichs -- urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de /(o\
Humboldtstrasse 7 - 7500 Karlsruhe 1 - FRG -- +49+721+621127(0700-2330) \o)/
paul@taniwha.UUCP (Paul Campbell) (10/18/90)
In article <1990Oct11.162202.17099@wdl1.wdl.fac.com> tpm@wdl58.wdl.fac.com (Tim P McNerney) writes: > >We have a hard disk in which the partition size and the file size do not >correspond. To be more specific, our 156MB A/UX partition was made into >a 78MB file system (using mkfs) and was not caught for some time. > >Is there some way in which to non-destructively remake the file system so >as to regain the missing 78MB? If not, any suggestions on how to save the >missing 78MB? The following trick can be used to do this - be warned, if done wrong it can trash your disk!! I'm assuming that you really did make the file system with mkfs or mkfs1b and NOT with newfs (ie it's a System V file systems and not a Berkeley Fast File System - if you are running 2.0, now might be a good time to back everything up, build a FFS and do the conversion). Before you start un mount the file system Anyway, you have to figure out how big the new file system will be in LOGICAL blocks (if you used mkfs to build your disk a logical block is 2 physical blocks, if you used mkfs1b the relationship is 1 to 1). As root you can find out how big the file system thinks it is, try as root: adb -k /dev/dsk/c1d0s0 < or what ever you disk partition is 202?D ^D The second line should print out the number of LOGICAL blocks, if you used mkfs then for 78Mb it's going to be something around 78000, if you used mkfs1b it will be near 156000. Figure out how many LOGICAL blocks you really want the file system to have (in your case you probably just double the number - check out the partition table using dp to get the number of physical blocks [the term 'logical' blocks in dp is different from LOGICAL blocks referenced by filesystems so don't get confused]). Assuming you got a number of 12345 for the new size (in LOGICAL blocks) for your filesystem here's how you change it (the dangerous part), as root type: adb -k -w /dev/dsk/c1d0s0 < or what ever your disk partition is 202?W 0d12345 < or your LOGICAL block count ^D Now you have hacked the super-block on the file system, to repair the free block list enter: fsck /dev/rdsk/c1d0s0 < or what ever your disk partition is It will tell you that there are blocks missing from your free block list and ask if you want to rebuild it, answer 'y' to this question. After the free block list has been rebuilt you are done and can mount your new bigger filesystem again. BTW: if you have a system where you take it down often and always check the (System V filesystem only) disks on the way back up enter '-s' to the fsck line, this forces the filesystem's free list to be re-ordered - something that is worth doing on a filesystem fairly often to give you a small increment in performance. Paul Campbell Taniwha Systems -- Paul Campbell UUCP: ..!mtxinu!taniwha!paul AppleLink: CAMPBELL.P What most people don't realize is that those plastic cover slips that your 3 inch floppies come in are actually condoms for protecting your computer from harmfull computer viruses - practice safe computing ..... :-)