fsck: How to reduce memory usage - to avoid out of swap on boot ?

Julian Stacey jhs at berklix.org
Wed Oct 6 07:45:07 PDT 2004


On 4.10-RELEASE with real memory  = 10485760 (10240K bytes)
& big disc partition:	 disklabel ad0s1 sectors/unit: 160071597
#        size   offset    fstype   [fsize bsize bps/cpg]
  h: 156613309  3458288    4.2BSD     2048 16384    89  # (Cyl.  215*- 9963*)

On a dirty reboot, fsck hangs single user saying: out of swap space.
This on an embedded headless host, delivered to remote sites.  Plugging in a
monitor card is problematic, so it needs to come up multi user & net reachable.

Options:
- Split the partition in several. - Ugly, Maybe I could remerge them with 
  ccd or vinum?] not tried those before, but still an ugly solution.

- More memory: Mainboard has 2M & just 1 slot, currently with an 8M RAM, but
  I'm looking for a 16M slice & will see if mboard accepts it & if fsck
  considers that enough.
	( After forcing it multiuser I saw:
#  UID   PID  PPID CPU PRI NI   VSZ  RSS WCHAN  STAT  TT       TIME COMMAND
#   0   455   419 113  42  0  7064 1820 -      R+    p1    2:42.52 fsck -y /usr1& for comparison on another 4.10-RELEASE box with an 18G drive it grew to
#   0   625   553   0  -6  0  7580 7448 physst DL+   p0    0:12.50 fsck -y /usr3
  (Could man fsck document roughly how much ram needed for what size disc ? )

- Add ,noato to /etc/fstab & manually fsck & mount /usr1 from rc.local 
  (I imagine swapinfo by then reports more swap available) - ugly.
  & I think Ive tried that before somewhere else recently, (on 5-current
  admittedly) I recall no clean bit caused a hang, even thouth ,noauto

- /usr/src/sbin/fsck/fsck.h, maybe I could eg halve one or both of these:
  #define MAXBUFSPACE     40*1024 /* maximum space to allocate to buffers */
  #define INOBUFSIZE      56*1024 /* size of buffer to read inodes in pass1 */
  I quickly paged through all of /usr/src/sbin/fsck/ but didnt see
  much else likely.  Any suggestion what to hack ? Must be some
  define type `take so much RAM' lines in there :-)

PS I think it's pass1 that's running out of swap, but maybe pass2,
I can't check till backup complete.

Ideas ?

-
Julian Stacey.  Unix,C,Net & Sys. Eng. Consultant, Munich.  http://berklix.com
 Mail Ascii; Html deleted as Spam.  Ihr Rauch = mein allergischer Kopfschmerz.


More information about the freebsd-hackers mailing list