home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / amiga / 2406 < prev    next >
Encoding:
Text File  |  1992-11-13  |  4.7 KB  |  102 lines

  1. Newsgroups: comp.unix.amiga
  2. Path: sparky!uunet!sybus.sybus.com!myrddin!tct!ckctpa!crash
  3. From: crash@ckctpa.UUCP (Frank "Crash" Edwards)
  4. Subject: Re: Help!!
  5. Message-ID: <1992Nov13.041138.8476@ckctpa.UUCP>
  6. Date: Fri, 13 Nov 1992 04:11:38 GMT
  7. Reply-To: crash%ckctpa@tct.com (Frank "Crash" Edwards)
  8. References: <BxKyz5.80u@csugrad.cs.vt.edu>
  9. Organization: Edwards & Edwards Consulting
  10. Lines: 90
  11.  
  12. keven@csugrad.cs.vt.edu (Keven Ring) writes:
  13. >1)  I have shrunk the partition by 2 meg (without optimizing), used the new
  14. >    space on amiga dos, booted up unix, and shut it down, went back onto
  15. >    amiga dos, and everything was intact.
  16.  
  17. Wow!  Was that dangerous or what!!???
  18.  
  19. >  Do I have a chance in ???? of getting this to work?  Basically, is there
  20. >such a thing as an "optimizer" for UNIX that just reorganizes the files to the
  21. >front of the partition.  If so, where can I get such a program?  If you
  22.  
  23. There's not a free one that I know of, and the commercial versions are
  24. targeted at the 386 market.
  25.  
  26. >hesitate in answering because I might destroy UNIX, well, don't worry.  As I
  27. >said, I am basically beta testing it, and I can get it RECLONED (basically
  28. >reinstalled in about 15 minutes free of charge).  Please, any help would be
  29. >greatly appreciated.  If I get this to work, I should be able to "steal"
  30. >about 25 megs!!  
  31.  
  32. Alright, here's what I would do.  I'm assuming the filesystem is ufs,
  33. since that's the trickier one.
  34.  
  35. [Kids, don't try this at home.  This gentleman said he wants to blow
  36. away his root partition so that's why I'm writing this here!]
  37.  
  38. I would edit the first superblock in the filesystem (fsck can tell you
  39. where that is, or you may have to run a fake mkfs to get the numbers
  40. -- see a previous post of about 2 weeks ago) and change the
  41. filesystem's idea of how many blocks are available.  This may take
  42. some perusal of /usr/include/sys/fs/ufs_fs.h but I think it may be the
  43. fs_size field.
  44.  
  45. After that's done, run "fsck -F ufs -b# -n /dev/dsk/..." where the
  46. pound sign ("#") is the block number where the superblock is located,
  47. and the "..." is the rest of the disk device name.
  48.  
  49. The "-n" says "don't fix any problems", but fsck will still report any
  50. inodes that contain data blocks beyond the 50MB point or whatever
  51. maximum block size you put into the superblock.  This will tell you
  52. which files would be destroyed.  (I'd back them up to tape instead of
  53. just copying -- if you copy them then you have to run fsck again and
  54. possibly copy them again, etc, until they fit inside the smaller
  55. size.)  [Only do this with an unmounted filesystem.]
  56.  
  57. Change the number in the superblock fs_size field back to what it was
  58. and after the files are backed up, delete them using "rm".  Now there
  59. shouldn't be any blocks in use beyond the 50MB point.  The filesystem
  60. will have to mounted for the backup and delete operations, of course.
  61. Unmount it again.  Now put your 50MB value into the fs_size field and
  62. run "fsck -F ufs ..." just like before, but take out the "-n" option.
  63. Fsck will read through the filesystem and check for the inode
  64. situation again.  There shouldn't be any problem there.  It *WILL*
  65. complain that there are blocks in the freelist that shouldn't be
  66. there.  It will ask if it should salvage the free list.  Answer with
  67. yes -- that will cause fsck to fix the partition.  When it is done, it
  68. will update the other superblocks as well, so that the entire
  69. filesystem is back in sync.
  70.  
  71. The above method should work for both shrinking and expanding a
  72. filesystem.  I would wait a week or so and see if anyone posts a
  73. followup and points out any details that I may have forgotten.  Or, if
  74. you're lucky, I'll get a chance to try this myself.  It's the first
  75. time I've ever given real consideration to this problem and I'm
  76. somewhat intrigued by the simplicity of this solution.  Therefore, I
  77. can't believe that's all there is to it.  But if I find the time, I'll
  78. create a small partition and try to shrink it.  Stay tuned for the
  79. results.
  80.  
  81. >Thanks in advance.  It is greatly appreciated.  The whole university will 
  82. >"thank" you (at least those using UNIX and wanting more room on AMIGA DOS!)
  83. >
  84. >Once again, thanks...
  85.  
  86. No problem.  Perhaps the University could use some consulting in some
  87. area where I could be of assistance?!  I'm always willing to trade
  88. some experience/talent for cold, hard cash...
  89.  
  90. [Yeah, that's a bit commercial, but what the hey.  Look what he just
  91. got for free!]
  92.  
  93. >|Keven Ring        |your mission is a failure. Your lifesyle's too extreme
  94. >|keven@csugrad.cs.vt.edu|I'm your new commander - You are now my prisoner
  95. >|VPI & SU        |We return to Transylvania.
  96.  
  97. -- 
  98. Frank "Crash" Edwards            Edwards & Edwards Consulting
  99. Fax:  813/786-6526               Home:  813/786-3675
  100.  
  101. "I'd love to go out with you, but I want to spend more time with my blender."
  102.