From:     Digestifier <Linux-Development-Request@senator-bedfellow.mit.edu>
To:       Linux-Development@senator-bedfellow.mit.edu
Reply-To: Linux-Development@senator-bedfellow.mit.edu
Date:     Sat, 2 Oct 93 03:13:19 EDT
Subject:  Linux-Development Digest #138

Linux-Development Digest #138, Volume #1          Sat, 2 Oct 93 03:13:19 EDT

Contents:
  Shattering -- good or bad? (Russell Nelson)
  [SUMMARY] ftape 0.9.6 and SLS 1.03 (Frank ODwyer)
  [Q/PROPOSAL] re-use windows swap for Linux? (Frank ODwyer)
  [Q]:Page allocation and cloning (Peter Andersson)
  Re: Terminals off Serial Port (Ian McCloghrie)
  Re: [Q/PROPOSAL] re-use windows swap for Linux? (James S. Vera)

----------------------------------------------------------------------------

From: nelson@crynwr.com (Russell Nelson)
Crossposted-To: gnu.misc.discuss,comp.emacs
Subject: Shattering -- good or bad?
Date: Fri, 01 Oct 93 17:45:00 GMT

We've all seen it.  You distribute a system in source form, and
multiple revisions result, each with a different feature set.  John
Gilmore coined the term ``shattering'' for this phenomenon. With
public domain software, the different fragments may have their own
copyrights, so there's no hope of merging back into a single
distribution.  But with GPL software, you can always get the source.

So, is the competition resulting from shattering a good thing?  Or is
it bad because people could have been cooperating?  But cooperating
requires some compromising.

Emacs: Lucid Emacs, GNU Emacs, Epoch
Linux: SLS, MCC, Slackware, Yggdrasil
NCSA Telnet: CUTCP, QVT/Net

-russ <nelson@crynwr.com> What canst *thou* say?
Crynwr Software           Crynwr Software sells packet driver support.
11 Grant St.              315-268-1925 Voice  |  LPF member - ask me about
Potsdam, NY 13676         315-268-9201 FAX    |  the harm software patents do.

------------------------------

Crossposted-To: comp.os.linux.help
From: odwyer@nixdub.sse.ie (Frank ODwyer)
Subject: [SUMMARY] ftape 0.9.6 and SLS 1.03
Date: Sat, 2 Oct 1993 00:07:14 GMT

A while back I posted some questions about getting ftape 0.9.6 into
SLS 1.03.  Here's where I got to:

1.    Don't try to do it on the SLS kernel.  It has a version of modules
      installed and a few other surprises.  Get a clean 0.99.12 kernel
      from somewhere and use it instead.  [This also allowed me to
      configure out all the CD-ROMs and CD-ROM filesystems.  Hurrah!]

2.    No problems installing the ftape 0.9.6 modules patches, and
      the kernel compiled and worked just fine.  'insmod' put the
      driver in with no complaints, and my tape drive was correctly
      recognised as a Colorado 120M.

In use, I found the driver to be a pretty good alpha release, but
not reliable enough for full-scale backup yet.  I'm looking forward
to the beta version!  

For what it's worth, here's what I tested and what happened:

(a)   After I'd played around for a while, I decided to back up my HD.
      Changed my mind about the backup command, and CTRL-C'd it early on.
      Result was that I had to get out to DOS and reformat the tape.
      Even the DOS s/w was confused at this time, and it took several
      attempts including a reboot to get it to format correctly.  I
      don't believe this to be a fault on the tape, which is brand new.  
      I wonder how stateful the drive is, and whether the UNIX driver
      left it in a funny state that required a power cycle to fix?

(b)   I piped 'yes' to dd -obs 32k >/dev/ftape via a program I wrote to 
      count the number of bytes going through - this worked fine but 
      reported 60M!  Is something along the line doing compression or 
      RLE here?  It should have been 40M if I have it right.

(c)   While I had no problems writing or reading tapes at constant,
      fast, data rates (cf. above), using something more chuggy
      like tar | gzip | dd seemed to fall over after maybe 20M on the
      tape, and dd with large block sizes (up to 512k) fell over after 
      maybe 4M.  It doesn't always fail at the same point, so once again I 
      don't suspect the tape.

(d)   The tracing of "write result" is at a very low level (-1).
      I had to turn off all tracing since I didn't want to flood 
      logfiles/screens with those messages during tape use.

My config:  486sx/25 w. 4M, 120M disk, 120M Colorado tape drive, 10M swap.
            SLS 1.03 with kernel replaced by clean 0.99.12, & ftape 0.9.6

            All my tests were run with nothing else happening (other
            than an occasional 'cron' job kicking in - but this wasn't 
            correlated with the tape failures), and I usually wrote 
            through dd with obs=32k (since that's the buffer size the
            driver uses).

Thanks to all who responded, and to the driver writer for getting it
this far (I'll be happy to supply you with some logs if it's useful).  
Keep up the good work!

--
Frank O'Dwyer      "We are asked to enter their intellectual wasteland where 
odwyer@sse.ie       there are two just premises:  abortion is murder and 
PGP key on server   abortion is not murder" - MichaeLoomis on t.a

------------------------------

From: odwyer@nixdub.sse.ie (Frank ODwyer)
Subject: [Q/PROPOSAL] re-use windows swap for Linux?
Date: Sat, 2 Oct 1993 00:25:36 GMT

Just a thought:  

I have ~10M swap for Windows and ~10M for Linux.  Since only one is active 
at a time, it's in principle possible to use the same chunk of disk for
both, thus giving me back 10M of my disk.

What would it take to do this?  Can a dos partition be used as Linux 
swap, and is it possible to reformat it as DOS on shutdown, then create 
a large file for windows to use?   Better yet, can Linux swap to a DOS
file?   Do the tools already exist to do this?

I could live with having to do do mkswap on Linux boot up, and/or
Windows complaining that its swap file was corrupt when it starts
(I've seen this happen - you just click OK and windows quietly fixes
things up).  10M means a lot when you've 4M free :-)

--
Frank O'Dwyer      "We are asked to enter their intellectual wasteland where 
odwyer@sse.ie       there are two just premises:  abortion is murder and 
PGP key on server   abortion is not murder" - MichaeLoomis on t.a

------------------------------

From: pand@kullmar.se (Peter Andersson)
Subject: [Q]:Page allocation and cloning
Date: Sat, 2 Oct 1993 00:38:51 GMT

Hi!

  I have developed some programs under DOS (sorry :) and I want to
  convert them to Linux.  I wonder if there is a possibility to
  allocate a page and use the page mechanism to clone the page
  to many places in memory still using the same memory?
  Eg. The program allocates a 4Kb block and that block can be accessed
  at many memory addresses. Under DOS I have used a VCPI interface to
  accomplish it.

  (Sorry if this looks a bit messy but I'm in a hurry...)

- Peter Andersson, pand@kullmar.se - Sweden (so don't ask me where to find
                                     ^^^^^^  cheap computer equipment! =)



  

------------------------------

From: imcclogh@cs.ucsd.edu (Ian McCloghrie)
Subject: Re: Terminals off Serial Port
Date: 2 Oct 93 04:37:30 GMT

kunze@informatik.uni-hannover.de (Richard Kunze) writes:

>In article 18138@pat.uwe.ac.uk, mj_smith@onion.uwe.ac.uk ([Mark Smith]) writes:
>> Does anybody know how to, or know of a program that will enable me to plug
>> a dumb terminal (or my friends Linux running PC) into the serial or any
>> other port (I don't have and cannot afford a network card) of my machine,
>> and have it work as a terminal, (just VT100 or some such not X)

>Just plug it in and start getty on that port.

        You can also run SLIP over a serial port, with no more hardware
than is necessary for a terminal.  It's somewhat trickier to set up, but
not excessively so.  Or, if both systems are using linux, and you've got
a spare parallel port on each machine, you could use PLIP with around
$10-$20 worth of hardware, probably.

--
 /~> Ian McCloghrie      | Commandant of Secret Police - Cal Animage Beta.
< <  /~\ |~\ |~> |  | <~ | email: ian@ucsd.edu               Net/2, USL 0!
 \_> \_/ |_/ |~\ |__| _> | Card Carrying Member, UCSD Secret Islandia Club

------------------------------

From: vera@anna.Stanford.EDU (James S. Vera)
Subject: Re: [Q/PROPOSAL] re-use windows swap for Linux?
Date:  2 Oct 93 05:27:25 GMT

odwyer@nixdub.sse.ie (Frank ODwyer) writes:

>Just a thought:  

>I have ~10M swap for Windows and ~10M for Linux.  Since only one is active 
>at a time, it's in principle possible to use the same chunk of disk for
>both, thus giving me back 10M of my disk.

>What would it take to do this?  Can a dos partition be used as Linux 
>swap, and is it possible to reformat it as DOS on shutdown, then create 
>a large file for windows to use?   Better yet, can Linux swap to a DOS
>file?   Do the tools already exist to do this?

>I could live with having to do do mkswap on Linux boot up, and/or
>Windows complaining that its swap file was corrupt when it starts
>(I've seen this happen - you just click OK and windows quietly fixes
>things up).  10M means a lot when you've 4M free :-)

Random order, but here's my collection of notes on the matter.  Hope
it helps.

Path: nntp.Stanford.EDU!headwall.Stanford.EDU!agate!howland.reston.ans.net!noc.near.net!uunet!olivea!hal.com!darkstar.UCSC.EDU!cats.ucsc.edu!msb
From: msb@cats.ucsc.edu (Maurice S Barnum)
Newsgroups: comp.os.linux
Subject: update:  using a partition for both linux and Windows swap
Date: 22 May 1993 22:56:11 GMT
Organization: University of California, Santa Cruz
Lines: 130
Message-ID: <1tmb2bINNjl2@darkstar.UCSC.EDU>
NNTP-Posting-Host: am.ucsc.edu
Keywords: dual-use swap


After following the long thread about the best way to utilize a
single partition for both linux and Windoze, I have finally
reached what I think is a near ideal situation.  Thanks especially
to Joerg Prust both via c.o.l. and email.

The basic idea that Joerg suggested is what I'm using:  create the
windows swap file taking the whole partition, figure out how many
sectors are used up by the fat and the first entry in it and save
those to a file.  Boot linux, run mkswap, and save the same number
of sectors.  

Now, what needs to be done is a way to install the
proper set of sectors to the partition at boot time.  This is
where we differ.  The debug script that he suggested did not work
for me, because DOS refused to do anything except format the drive
after it had been used by linux.  Instead, I decided to make the
restoration of the sectors the job of linux (the owner of the
computer is a dos weenie anyway, and we often don't use the
autoexec.bat on boot).  Then I "modified" /etc/shutdown and
/etc/rc to handle everything.

Here's a by-the-numbers explanation of what I did:

1) on an empty, dos formatted partition (this one created using fips,
    a safe partition splitter), create a "permanent" swap file for
    Windoze.

2) determine the number of sectors that need to be saved.  From an
    email message from Joerg:  (joerg: hope you don't mind...)

    >The tricky part is the number of sectors you want to write, or want
    >to read if you create your sector files in the first place.
    >You have to know how many FAT-sectors (FileAllocationTable) your disk
    >uses, 'cos following those comes the Root (\) directory sector, up to
    >which you have to save the sectors.

    >There are utilities which can give you this information for your disk,
    >i.e. 'InfoPlus' or 'Fat' which you can obtain from wuarchive.wustl.edu.

    >In InfoPlus on Page 16 (Boot & DOS drive parameters) you are
    >told your 'Root directory sector' of your disks, this is the offset of
    >that sector (i.e. 13 for my disk).
    >'Fat' calls that 'First dir sector'. This number, incremented by one,
    >is the number of sectors you have to save from your swap partition.

    I used "fat d: /i" to get the information.  for me it was 26 

3) boot linux and save the sectors in /etc/dos.sec (season to taste) using
    dd.  For me, it was
        dd if=/dev/hdb2 of=/etc/dos.sec bs=512 count=26
    change count to the number of sectors det. above, if to the device
    that will be your swap partition

4) run mkswap

5) save the same number of sectors into a different file (/etc/linux.sec)
    ex:
        dd if=/dev/hdb2 of=/etc/linux.sec bs=512 count=26

Now, the trick is to make sure that the correct sectors are there on
startup, and that the Windoze files are restored at shutdown.  The
first part is trivial.  From my /etc/rc:

---begin rc excerpt---
/bin/echo restoring swap partition...
/bin/dd if=/etc/linux.sec of=/dev/hdb2 bs=512 count=26 ||
    /bin/echo restoration failed

/etc/swapon -a
---end rc excerpt

    note that the if= and of= are switched from when we were
    saving sectors.  This is of course obvious, but strikes me as
    a rather simple "silly mistake" that can make life
    difficult.

Shutdown provided a tougher problem.  What I eventually decided to
do was move /etc/shutdown to /etc/.shutdown (/etc/shutdown.exe is
another reasonable alternative) and replace /etc/shutdown with a
sh script.  The sh script simply restores the Windoze sectors to
the swap device, after checking the argument number to see if
possibly the intent is to go single user.  Then /etc/.shutdown is
called.  Two notes here:  make sure that the script has perms 500
or maybe 550; also, I'm using the sysvinit package, so I don't
know if the way I check arguments is valid for other shutdowns.
Here's my /etc/shutdown:

---begin shutdown
#!/bin/sh

if test $# -ge 2
then
    echo restoring Windoze swap file...
    /bin/dd if=/etc/dos.sec of=/dev/hdb2 bs=512 count=26
fi

exec /etc/.shutdown $*
---end shutdown

In my inittab there's an entry to deal with "power fail."  It
didn't need any changes at all, because I decided to call my
script shutdown rather than something like "quit."  If you use
halt or reboot directly, obviously things don't get restored.  But
if you habitually use them, then I don't feel any sympathy for you
:)

For os/2, I'm sure something similar could be done.  The main
decision would be to determine:  what state should we be in 
when the power is off.  I chose dos, both because it's not my
computer, and things worked easier that way.  If os/2 can
configure the shutdown procedure and has something like dd, then I
would suggest that it be responsible for restoring things it's way
when done.

I have had no problems at all with the above set-up.  To protect
myself, though, I have a boot/root floppy that does the following:
fsck all partitions, restore Windoze swap partition from it's own
copy of dos.sec, re-install lilo (my MBR), reboot.  Any better
suggestions would be great, although this strikes me as quite
clean as is.

Thanks again to Joerg, and anyone else who contributed useful
ideas to the net...

-- 
Maurice S. Barnum --- I consult, therefore I am:
        Ask me, and I shall answer.  
        Believe me, and I shall laugh.
msb@cats.ucsc.edu, mbarnum@eis.calstate.edu, mbarnum@nyx.cs.du.edu
In article <CDCEr7.1BB@bt-sys.bt.co.uk> cbeauch@xenon (Chris Beauchamp) writes:
> I am about to install SLS (latest version) on a Dell 486sx25, but I'm
> only using half the hard disk,the other half being used for DOS and Windows. 
> 
> I have a 12Mb Linux swap partition - is this possible to be used as both a
> Linux and a Windows swapfile? What does Linux do to this partition? Does it 
> put anything corruptable on it?
 
  OK, here we go again: 'windows-linux swap in common?'. Perhaps time for 
moving this into the FAQ (I assume it's not there already, havn't checked...)?

  A swap *file* cannot be shared inbetween, as dos can't access the linux file
system and linux can't swap on the dos file system. However a linux swap
partion can be made into a swap file for windows at the cost of a few
seconds longer time to reboot. If you want to do things the same way as I
have done then follow these steps: (remember to subtitute the sizes and
partions to match your computer, else.... bad luck!)

1) Decide how much swap space you need and create a partion to swap on with
fdisk (or any other disk partioning program). I chose to make it about 6M or
to be exact 5967 blocks large and on /dev/hda4. Make the partion a DOS
partion. Mine is a primary 12-bit-fat (id 1) partion.

2) Erase the partion completely so that it will compress to the smallest
possible size. This can be done with :
    dd if=/dev/zero of=/dev/hda4 
while running linux. If you want you can use norton's wipeinfo to
'Wipe the entire drive' but this must be done after step 3). Neither
'format f:' or 'del f:*.*' will erase the data on the disk, they just
delete the information in the directory block(s) and wont work.

3) (Re)Boot dos. The swap partion will show up as a new 'disk letter' in
dos, which dos wont be able to read (dos says something like 'Invalid
media error on drive F'). My swap partion shows up as F:.  Format
the new drive:

c:\>format f:

4) Start windows (if you are running windows 3.0 you must start it in
real mode: c:\>win /r) and create a permanent swap file as large as the new
partion. Ignore the warning that windows won't use more than the recommended
size, it will. In windows 3.0 this is done by closing ALL active applications
excluding the program manager, selecting File/Run and run 'system/swapfile'. 
In windows 3.1 it's in the control panel under '386 Enh' and 'virtual memory'.

5) Reboot your computer into linux immediately after creating the
swapfile. DO NOT start windows.

6) Save and compress the swap partion to a file:

dd if=/dev/hda4 | gzip -9 > /.winswap

Since you erased the whole partion the compressed file will become
very small; from my computer:

23:27-oden:/>ls -l .winswap
-r--------   1 root     root         9431 Apr 10 20:23 .winswap

7) Place the following commands in your /etc/rc:

/bin/mkswap /dev/hda4 5967
/bin/swapon -a 

and a line in /etc/fstab describing your swap partion:

/dev/hda4       none    swap    defaults

8) These commands will destroy the dos partion and the windows swap
file and must be restored before windows can be used. I do this when I
reboot linux automatically with this script which I have named
/etc/reboot and with a link to it from /etc/halt:

----/etc/reboot-----snip-----8<--------
#!/bin/sh -
if [ "root" != "`whoami`" ]
then
  echo "Sorry "`whoami`. You must be root to reboot!. Exiting.
  exit 1
fi
echo `basename $0` in progress. Please standby
swapoff /dev/hda4
/usr/local/bin/gunzip < /.winswap > /dev/hda4
exec /etc/.hidden/`basename $0` $*
----end /etc/reboot-----snip-----8<----

and I have moved the original /etc/reboot and /etc/halt to 
/etc/.hidden/reboot and /etc/.hidden/halt

9) Enjoy.

10) Realize that 6M swap isn't enough. Sigh :-(

I have seen some peolpe suggesting that it is possible to just save
the beginning of the partion (just enough to hold the boot block, the
fat and the root directory), and others saying that you must save the
whole partion but I havn't bothered to investigate this matter, the
solution above works just perfect.


/Kristian

p.s. I hope I havn't mistyped anything but anyway: Be careful when
dealing with the disk partions as you will blame yourself to death
when you have erased your whole dos partion with your five years worth
of work on just because you typed /dev/hda4 instead of /dev/hda3 ;-)
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Kristian Ejvind - krej@it.kth.se         I   The best way of accelerating
The Royal Institute of Technology, KTH   I   a macintosh is by 9.82 m/(s*s)
Stockholm, Sweden                        I
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

In <KREJ.93Sep15232016@eat.electrum.kth.se> krej@electrum.kth.se (Kristian Ejvind) writes:

>6) Save and compress the swap partion to a file:

>dd if=/dev/hda4 | gzip -9 > /.winswap

you don't actually need to save the WHOLE partition.  there are a 
number of DOS utilities that can tell you where the start of the 
data is on a partition.  save all of the sectors up to that one, 
and that one also. (for example: I had a setup where the fat took 
the first 23 sectors, so I saved 24, using
        dd if=/dev/hda4 of=/etc/dos.swp bs=512 count=24
    and
        dd if=/dev/hda4 of=/etc/linux.swp bs=512 count=24

    of course, the first dd was done after setting up the windoze
    swap file, the second, after running "mkswap" on the 
    partition.


>/bin/mkswap /dev/hda4 5967

becuase I also saved the first set of sectors when the partition 
was set up for linux, I restore with

        dd of=/dev/hda4 if=/etc/linux.swp bs=512 count=24
    instead.  faster than mkswap


>8) These commands will destroy the dos partion and the windows swap
>file and must be restored before windows can be used. I do this when I
>reboot linux automatically with this script which I have named
>/etc/reboot and with a link to it from /etc/halt:

>----/etc/reboot-----snip-----8<--------
[...]
>----end /etc/reboot-----snip-----8<----

>and I have moved the original /etc/reboot and /etc/halt to 
>/etc/.hidden/reboot and /etc/.hidden/halt

I did something similar, then realized that, if using the sysvinit 
package, I was being silly.  If I had to do it again (different 
setup now, don't do stuff like above currently), I'd just modify
/etc/brc to look something like:

---
#!/bin/sh

PATH=/bin:/etc
export PATH

dd if=/etc/dos.swp of=/dev/hda4 count=24 bs=512

echo Unmount filesystems...
umount -a
---

NOTE: the "count=24" was for a PARTICULAR situation.  try using 
norton disk editor, or a share/freeware program called "fat", or 
something similar to figuire out what the number for your system 
should be.
-- 
Maurice S. Barnum                       Keeper of a heart
msb@cats.ucsc.edu; mbarnum@nyx.cs.du.edu,eis.calstate.edu
PGP fingerprint:  26 46 7A 02 F0 5C C1 67  76 3D 53 39 79 D3 C9 26 
I use a very simple scheme for sharing the swap partition between
MS-DOS/Windows and Linux. In Linux I do the mkswap and swapon during
boot. This accomplishes making the partition usable as a LINUX swap
space. 

After booting DOS, I format the swap partition. THE FIRST TIME ONLY, I
create a permanent swap file for WINDOWS to fill the partition
completely.

Later on, when I boot DOS, I JUST REFORMAT that partition to make it
usable by DOS. When I successively start WINDOWS, I get a complaint
that the permanent swap file is gone. Windows then offers to recreate
the swap file automatically. Just type 'Y' and you are in business.

Georg-W. Koltermann (gwk@cray.com)

-- 
James S. Vera       |         Internet         | Voice: +1.415.723.1089 
Stanford University |  vera@anna.stanford.edu  | FAX:   +1.415.725.7398
Are these windows going to change my original document?-Time/Life dweeb 

------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: Linux-Development-Request@NEWS-DIGESTS.MIT.EDU

You can send mail to the entire list (and comp.os.linux.development) via:

    Internet: Linux-Development@NEWS-DIGESTS.MIT.EDU

Linux may be obtained via one of these FTP sites:
    nic.funet.fi				pub/OS/Linux
    tsx-11.mit.edu				pub/linux
    sunsite.unc.edu				pub/Linux

End of Linux-Development Digest
******************************
