From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,3118fb7a65935858 X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1993-10-07 14:28:09 PST Path: gmd.de!newsserver.jvnc.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!decwrl!pa.dec.com!netnews.alf.dec.com!ryhope.alf.dec.com!jlf From: jlf@ryhope.alf.dec.com (Jeff Finkelstein) Newsgroups: comp.unix.osf.osf1 Subject: Re: swapdefault: How to hose a filesystem Date: 7 Oct 1993 20:57:37 GMT Organization: digital equipment corporation Distribution: world Message-ID: <291vs1$ock@netnews.alf.dec.com> References: Reply-To: jlf@alf.dec.com NNTP-Posting-Host: ryhope.alf.dec.com X-Newsreader: mxrn 6.18-5 This is a warning to people who are considering changing the SCSI address of your root device. Even though you do not need to rebuild the kernel when you change disk addresses, you do need to change the symlink for /sbin/swapdefault. For example, on a given system the /sbin/swapdefault is a symbolic link to /dev/rz3b. If you change your disk address to SCSI 0, the symlink still points to /dev/rz3b. Now, lets say you add your second disk and by chance install it at SCSI address 3. You decide to use the 'c' partition to get the whole disk. Now you newfs it, and mount it to /mnt so you can copy data to it. After spending hours working on it you now decide to reboot and have it mount under the new mount point. What will happen is the following: 1. During system initialization, the boot process looks for the file /sbin/swapdefault. If the file exists, the symlink is followed to the device partition and it is mapped as the initial swap space. If it does not exist, the lazy swap mechanism is installed. Since the /sbin/swapdefault is pointing to the /dev/rz3b device, it is installed as the default paging space. 2. When the bcheckrc script is run, it fsck's and mounts the user partitions that are specified in /etc/fstab. In this case, the /dev/rz3c partition is mounted as /mnt. 3. When the S05paging script is run in rc2.d, it does a '/sbin/swapon -a', which connects the vm system to the paging devices listed in /etc/fstab. Now, if you do a /etc/swapon -s you will see the following: [ryhope] /sbin/swapon -s Total swap allocation: Allocated space: 32768 pages (256MB) Reserved space: 6373 pages ( 19%) Available space: 26395 pages ( 80%) Swap partition /dev/rz3b: Allocated space: 16384 pages (128MB) In-use space: 1808 pages ( 11%) Free space: 14576 pages ( 88%) Swap partition /dev/rz0b: Allocated space: 16384 pages (128MB) In-use space: 1812 pages ( 11%) Free space: 14572 pages ( 88%) And a 'df -t ufs' shows something like the following: [ryhope] df -t ufs Filesystem 512-blks used avail capacity Mounted on /dev/rz0a 100764 64854 25832 72% / /dev/rz0g 1629224 727784 738516 50% /usr /dev/rz3c 11629224 240062 1226238 2% /home At this point the /dev/rz3b is being used as a swap device. When you look at the partition table for /dev/rz3a you see the following: 8 partitions: # size offset fstype [fsize bsize cpg] a: 104542 0 unused 1024 8192 # (Cyl. 0 - 131*) b: 262144 104542 unused 1024 8192 # (Cyl. 131*- 459*) c: 2050860 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 2569) d: 262144 104542 unused 1024 8192 # (Cyl. 131*- 459*) e: 262144 104542 unused 1024 8192 # (Cyl. 131*- 459*) f: 262144 104542 unused 1024 8192 # (Cyl. 131*- 459*) g: 1684174 366686 unused 1024 8192 # (Cyl. 459*- 2569*) h: 262144 104542 unused 1024 8192 # (Cyl. 131*- 459*) In other words, you are now using cylinders 131-459 of your /home partition as swap space. Bottom Line ----------- You need to remember that when you change your root devices SCSI address you must change the /sbin/swapdefault for the root device to avoid this situation. -- jeff finkelstein | "Imagination is more important than jlf@alf.dec.com | knowledge." digital equipment corporation | - Albert Einstein customer support center |