home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / sun / admin / 9457 < prev    next >
Encoding:
Text File  |  1992-12-15  |  2.7 KB  |  86 lines

  1. Path: sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!informatik.tu-muenchen.de!lrz-muenchen.de!regent!svb
  2. From: svb@svb.guug.de (Sebastian v. Bomhard)
  3. Newsgroups: comp.sys.sun.admin
  4. Subject: Re: tunefs on /usr
  5. Message-ID: <193@svb.guug.de>
  6. Date: 15 Dec 92 16:00:24 GMT
  7. References: <ByG0ny.KK1@uxa.ecn.bgu.edu> <1992Dec6.000641.3438@nic.csu.net>
  8. Organization: v. Bomhard Unternehmensberatung
  9. Lines: 75
  10.  
  11. >In article <ByG0ny.KK1@uxa.ecn.bgu.edu> mflll@uxa.ecn.bgu.edu (Dr. Laurence Leff) writes:
  12. >>I am trying to run tunefs on the /usr file system.  Of course this
  13. >>is part of the two file systems (/root and /usr) that are brought up
  14. >>on bootup.
  15. >>
  16. >>Thus, we can't dismount it to run tunefs.  This is even true when we
  17. >>come up single user (boot with -s option)
  18. >>
  19. >>We are on 4.1.1 operating system on Sun III's.
  20. >>
  21. >>Does anyone know a method of running tunefs on the /usr file system.
  22. >>We want to reduce the disk space allocated to root on this file system.
  23. >>
  24.  
  25. Well, the easiest way is to just just unmount /usr. The problem are
  26. the shared libraries, so all you have to do is to write a staticaly linked
  27. umount of your own (I assume you don't have the sources) and put it
  28. into /sbin, then boot single user and umount /usr, no problem at all!
  29.  
  30. And, you don't have to write your own umount, here it comes (without
  31. warranty, but it works for me since I wrote it). Please ignore the
  32. german comments :-). The /etc/mtab part is sort of an ugly hack, you
  33. perhaps might want to edit it, but the unmount(2) syscall doesn't keep
  34. track of that file. And YES, I will use symbolic constants next time :-)
  35.  
  36.  
  37. HTH, 
  38.  
  39.   -svb.
  40.  
  41. ----------------------------cut here----------------------------------
  42. /* unmount_usr -- Umount /usr, is to be linked statically
  43.  * Synopsis: unmount_usr, no args provided
  44.  * May 1992 svb
  45.  * Works if / is on /dev/sd3a. Change, if wrong.
  46.  * OS 4.1.1
  47.  */
  48.  
  49. #include <stdio.h>
  50.  
  51. main()
  52. {
  53.     FILE *mtab;
  54.     switch(unmount("/usr")) {
  55.     case 0:
  56.         break;
  57.     case -1:
  58.         fprintf(stderr,"Cannot unmount /usr\n");
  59.         perror("unmount()");
  60.         return 1;
  61.     default:
  62.         fprintf(stderr, "Unexpected Returncode from umount!\n");
  63.         perror("unmount()");
  64.         return 2;
  65.     }
  66.     mtab = fopen("/etc/mtab", "w");
  67.     if(!mtab) {
  68.         fprintf(stderr, "%s\nDas sollte drinstehen: %s\n",
  69.               "Peinlich, peinlich, Deine /etc/mtab ist wahrscheinlich weg!",
  70.                "/dev/sd3a / 4.2 rw,dev=0718 1 1" );
  71.         perror("/etc/mtab");
  72.         return 3;
  73.     }
  74.  
  75.     fprintf(mtab, "/dev/sd3a / 4.2 rw,dev=0718 1 1\n");
  76.     fclose(mtab);
  77.     printf("/usr unmounted\n");
  78.     return 0;
  79. }
  80. ----------------------------cut here----------------------------------
  81.  
  82. -- 
  83. Sebastian v. Bomhard                               <svb@svb.guug.de>
  84. St.-Anna-Str. 13, D-W-8000 Muenchen 22 (Lehel),     +49-89-298934
  85. >>>>>>>>>>>     A neat desk is a sign of a sick mind.      <<<<<<<<<<<<<
  86.