initial commit

This commit is contained in:
root
2023-06-12 09:14:09 +02:00
commit b4912f303e
2545 changed files with 209350 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
Minixfs is copyright S.N. Henson 1991,1992,1993,1994,1995.
This code may be freely distributed unmodified, provided this copyright notice
is intact. A small copying fee may be charged for redistribution provided this
does not exceed the equivalent of five pounds Sterling (UK currency).
You are free to compile, modify and recompile modified versions of this
program. Modified versions of this source may be redistributed provided:
1. Modified versions are clearly marked as such in each file modified.
2. This copying file is included unmodified in any distribution.
3. An additional startup message is added stating that it is a modified
version after the original startup message.
4. The orginal copyright startup message is not modified in any way.
5. No additional restrictions are placed on the modified version, in particular
full source must still be freely available and freely distributable.
Binaries compiled from this code may also be redistributed. Binaries
compiled from modified versions of this code may also be redistributed provided
this copying file is included intact and conditions 1 to 5 above are met.
This version may not be used for profit or in a commercial environment,
this includes the development of software that requires a registration fee.
If you wish to use Minixfs to develop anything other than free software or use
it in a commercial environment then Minixfs must be registered for a small fee,
please contact me for further details.
Distribution of this program with commercial packages is not allowed
without my written permission, please contact me if you wish to do this,
or indeed if you want a similar filesystem writing for a different purpose
(e.g. TT Unix or Spectre), however I am not in a position to write filesystems
for other commercial packages free of charge.
I reserve the right to modify these conditions at some future date.
Please note that although I believe each release to be stable and
test it thoroughly I offer no guarantee. Therefore, THIS PROGRAM COMES
WITH NO WARANTEE WHATSOEVER AND USE IS ENTIRELY AT YOUR OWN RISK, I WILL
NOT BE LIABLE FOR ANY DAMAGE CAUSED DIRECTLY OR INDIRECTLY FROM ITS USE.

View File

@@ -0,0 +1,13 @@
I can be contacted by email as shenson@nyx.cs.du.edu . Donations or snail
mail should be sent to:
S N Henson.
4 Monaco Place,
Westlands,
Newcastle,
Staffordshire.
ST5 2QT.
ENGLAND.
Phone: (within UK) (0782) 662808
(elsewhere) +44 782 662808

View File

@@ -0,0 +1,45 @@
No this isn't a list of bugs, its a list of what to do when you send a bug
report. I've included this because lots of bug reports I receive are incomplete
and I have to email back asking for more information, and often receive no
reply. It costs me real money to do this which is in very short supply.
Please use one of the following methods:
1. Technical description of bug, basically where it is in the source and/or a
fix.
2. As much information as possible about the bug. You should include:
a. Your hardware and hard disk driver software.
b. Version of MiNT, Minixfs and TOS.
c. As much information as you can about the bug. If I can't recreate the bug
then there isn't much I can do to fix it. Basically some method (as simple
as possible) to recreate the bug is best, also if fsck complains before
or after the problem as well. All relevant alerts or debugging/trace info
would help as well. Note also the output of minit with the '-t' flag should
be sent to me as well; this helps enormously in tracing bugs.
Please remember I have an STE and limited software, so if you say "When
I run x.prg on a minix partition it crashes" and 'x.prg' is commercial software
then I can't really do much to help. If 'x.prg' is free then I may be able to
download it. Alternatively if you know how to recompile minixfs and you don't
mind doing a few tests then I may be able to trace things that way. In any case
you should be prepared to answer a few questions at least.
One more point. Using Minixfs with older versions of MiNT may make bugs
appear which are caused by the MiNT kernel. Please use the latest version
possible. Preferably at least 1.08 . Any bug reports using MiNT versions prior
to 0.95 are untestable. The version of MiNT normally supplied with MultiTOS i.e.
1.04 can be rather unstable when used with Minixfs due to MiNT bugs (if you
try to change a disk with MiNT 1.04 is crashes horribly). A known MiNT 0.95 bug
is that it loads filesystems twice ...
Reports should be addressed to:
shenson@nyx.cs.du.edu
If you send it to Usenet then I may well miss it. In fact I may take a long
time to reply anyway, so mailing the MiNT mailing list may be more productive.

View File

@@ -0,0 +1,3 @@
This is another quick hack program. Useage if flist X: . This will print out
all the inodes of open files on drive X: . You can then run fsck with the -i
option to find out what the files are.

View File

@@ -0,0 +1,150 @@
Fsck is a File System Consistency checKer. It checks Minixfs filesystems for
consistency and optionally repairs them too. It is important that a Minixfs
filesystem is checked for errors when, for example, the system crashes or a
lock up forces a reboot when programs are using the filesystems. This will
occasionally mean that fsck will perform minor repairs which will cause no
damage at all. Using a damaged filesystems can result in much more serious
damage occuring at a later date which require more destructive repairs to
fix.
ADVICE ON USE OF FSCK
fsck cannot perform miracles; a severely damaged filesystem (such as if a lot
of sectors get wiped somehow) may have very little salvageable. However, don't
be overwhelmed by the options available. In practice only fsck -n or fsck on
its own are used, the -p option is useful in shell scripts where non-interactive
repair is needed, but you dont want any attempted destructive repair.
If fsck -n does produce what appear like a lot of serious errors then it might
be an idea to attempt to backup the data before trying repairs; of course if
you have a full backup (you do make regular backups don't you?) available it
might be best to forget about repair altogether and just reinitialize the
filesystem (with minit) and restore from backup.
USING FSCK
Fsck can be used in interactive or non-interactive mode. In interactive mode
you are prompted before each fix. In non-interactive mode, repairs are carried
out automatically or not at all. The option '-y' carries out all repairs that
fsck would suggest, the '-p' (preen) option carries out all repairs if the
Minixfs filesystems is only slighlty damaged and can be repaired without
destroying data, the '-n' option only prints out the damage: it does not
repair anything. The '-y' option is not recommended, unless you are sure it
is what you want.
The options are followed by the drive letter of the partition you want to
check for example,
fsck -p D:
REPAIRS CARRIED OUT
In order to know precisely what repairs are carried out you must know a litle
about the internal structure of a Minixfs filesystem. Each filesystem is
divided into blocks or zones, these are always 1K in size.
Each directory/file/symbolic link has an inode associated with it. This is
a small part of a disk sector which carries all information about a file
except its name. It contains the file access modes (including what kind of
entity the inode refers to) as well as it's size and a list of sectors where
the file can be found. If this list is not large enough then an 'indirection
block' which is a disk block containing a list of further blocks belonging to
the file is used (and recorded in the inode). If this is not enough then a
'double indirection block' is used containing a list of further indirection
blocks. With this information, all the data in a file can be accessed.
A directory is basically identical to a file except it has a different mode
number. The 'data' in this file is a list of 'entries' (or links) each entry
contains a filename and an inode number where that name can be found. The root
directory is always contained in inode 1. A field in the inode called it's
'link count' gives a count of the number directory entries that refer to it.
Every directory has two filenames '.' which refers to itself and '..' which
refers to the parent directory. The only exception is the root directory where
'..' refers to itself as well.
Each used inode/block is referenced in a bitmap. If the filesystem crashes
before this can be written out to disk then it will be inaccurate. Fortunately
fsck can rebuild the bitmaps from the data contained in inodes. This is what
the prompts asking about bitmap repair mean. They are harmless and it is
strongly advised that any bitmap repairs suggested are made.
If you use the filesystem and some used blocks do not have their bits set in
the bitmap then other files can use them, overwriting the original data. These
are called 'multiply allocated blocks'. fsck will give a list of these blocks
and (optionally) allow you to decide which inode is the valid block. Usually
the valid data is contained in the file with the latest modify time: the '-y'
option removes all of the references. By finding the files the inodes
refer to (e.g. with the -i option) you can look to see which file
contains the valid data and then interactively remove the other references.
The other files where the references are removed then have 'holes' in them,
you may want to try to recover them or just delete them after 'fsck' has done
its work. This is why it is important that the bitmaps are accurate and should
be checked regularly.
This is the 'best case' scenario of multiply allocated blocks. If the block
overwritten belongs to a directory then much more trouble is caused. After
deleting the overwritten reference in a directory lots of inodes may no
longer be referenced in a directory, these are called 'orphaned' inodes (they
have no parent directory). fsck has no way of knowing their original names,
but the data is recoverable. fsck makes entries for these inodes in a
directory called lost+found . The name chosen is simply the inode number. You
can then analyse the files/directories in lost+found and delete, rename or move
them to where they were originally.
The worst case is if an indirection block is overwritten. This can cause lots
of spurious messages about bad zone numbers and other multiply allocated blocks.
fsck cannot currently help much under such circumstances: if a certain inode
contains lots of multiple block number or bad zone numbers then it's best to
delete all multiply allocated blocks in that inode; either with fsck or finding
the inode on the disk and deleting the associated file.
Here is a summary of the possible repairs fsck performs:
1. Scan all inodes, allow deletion of multiply allocated blocks, inodes with
bad modes, truncation of inodes which reference too many zones.
2. Scan all directories, check for valid names and the existance of '.' and
'..' entries and allow fixing.
3. Check filesystem conectivity (that each inode has a directory entry) and
allow repair of any problems and reconnection of orphaned inodes.
4. Check bitmaps and repair; check inode link counts and allow repair.
MISCELLANEOUS OPTIONS
If the root directory gets destroyed it must be handled separately because the
lost+found directory will be killed also. If this is the case then the '-R'
option will reform the root directory. Unfortunately the directory increment
is determined from the root directory, so you must manually tell fsck the
directory increment with the '-d' option followed by the increment. If you
get this wrong then a large number of errors about directory entries will
be erroneously reported.
If for some reason the root inode is no longer a directory Minixfs
may get confused and not recognise the filesystem anymore. By asking fsck to
continue it will still check the root inode as though it were a directory: if
it looks OK fsck allows you to make it a directory again. However you will
have to reboot before the filesystem will be recognised by Minixfs again.
The '-i' option followed by a comma separated list of numbers will
print out the pathnames of the corresponding inodes. E.g. fsck -i 1,2,3 D:
This will print out *all* the possible names so e.g. fsck -i 1 d: may
give something like:
\.
\..
\dir\..
\dir2\..
etc.
The '-z' option allows an inode to be zeroed if for example it is
severely trashed and fixing would do more harm than good (e.g. if an
indirection block has been overwritten). -z may be followed by a comma
separated list of inodes to zero. NB use this option with extreme caution,
the data the inode refers to will be effectively deleted (it will still be
on the disk but no longer accessible directly). Using this option will also
cause related "errors" to appear (though all can be fixed) such as inode
and bitmap errors and links a free inode.
The '-e' option tries to find out the filesystem size by reading
as far as it can through a partition: this is an experimental option and
isn't too useful at present.

View File

@@ -0,0 +1,107 @@
This version is mainly a collection of patches for minixfs pl10. Details are
contained below. Many thanks to all concerned!
The only addition I have made is a -z option to fsck to clear troublesome
inodes. See fsck.doc for more details.
**************************************
initial revision
**************************************
makefile fixes
**************************************
increase cache sizes
**************************************
From: inf03@Uni-Trier.de (Sascha Blank)
Message-Id: <9409051059.AA07720@Uni-Trier.De>
Subject: Better personae management for MiNT 1.11beta
use effective instead of real uid for access checking
**************************************
From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Date: Mon, 17 Oct 94 10:46:00 +0100
Message-Id: <9410170946.AA02849@issan.informatik.uni-dortmund.de>
To: mint@atari.archive.umich.edu
Subject: MinixFS: directory creation und symlinks
There are two other places where MinixFS uses the ruid instead of the
euid, that is when it creates a directory or a symlink (although for
the latter it does not matter). Also, the size of a symlink node is
set to the length + 1, but Linux (and probably Minix too) expects it
to be the length without the terminating null. And neither Linux nor
Minix knows anything about drive specifiers, but MiNTlib always adds
U: to an absolute path, making it difficult to, for example, extract
the Linux root filesystem with its symlinks under MiNT. I have fixed
this by always stripping the U: prefix on symlink creation and adding
it back in readlink. This isn't fully backward compatible since
before an absolute link target without drive has been interpreted
relative to the current drive, but i don't thinks this is much of a
problem. Another difference is that the link size reported by
getxattr may be off by two, but MiNT always uses PATH_MAX when reading
a link. If this creates a problem then getxattr will have to check if
the symlink name starts with a slash and add two to the size in this
case.
**************************************
From: Ulrich Kuehn <kuehn@GOEDEL.UNI-MUENSTER.DE>
Message-Id: <9411021016.AA21609@math.uni-muenster.de>
Subject: Re: Sync() and shutdown() system call
config.h, filesys.h, minixfs.c:
use Sync() and Shutdown() system calls
**************************************
From: Juergen Lock <nox@jelal.north.de>
Subject: Re: MinixFS 0.60 PL10 Patch Collection
Message-Id: <9411122007.AA00358@jelal.north.de>
. fix bitmaps Kmalloc calculation for larger filesystems
. a hack for fsck to check for sparse directories
. clear bitmap dirty bits on `unmounts' (Dlock), you'll get warnings
about bitmaps not written out after fsck runs sometimes, don't ask
me why... as long as fsck found no errors you can ignore them
. make sure symlinks always go in the same cache too
**************************************
From: Ulrich Kuehn <kuehn@GOEDEL.UNI-MUENSTER.DE>
Message-Id: <9411180940.AA27680@math.uni-muenster.de>
Subject: Re: sync patch for minixfs pl 10
don't run the update daemon if SYSUPDATE def'd
**************************************
From: scott@telle.dmi.stevens-tech.edu (Scott Kolodzieski)
Message-Id: <9411250353.AA09142@telle.dmi.stevens-tech.edu>
Subject: minor diff for minixfs pl10
really don't run the update daemon if MiNT >= 1.12
**************************************
From: woodford@esca.com (Steven Woodford)
Message-Id: <9411290411.AA05910@flash.esca.com>
Subject: One more patch for MinixFs PL10
don't delete "." or ".." even if dir increment > 1
**************************************
From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Message-Id: <9412160954.AA28843@issan.informatik.uni-dortmund.de>
Subject: MinixFS: completed support for V2 filesystem
add support for v2 triple indirection blocks
------------------------------------------------------------------------------

View File

@@ -0,0 +1,18 @@
The utility mfsconf is a very simple utility to set the filename translation
modes for a given device, or to inquire what they are.
To determine the file translation modes for a given drive (X: say) type:
mfsconf X:
The output is self explanatory.
To set the modes the options -d -s -x or -c are used for directory search
execute or creation translation. The letter is followed by one of the
letters n, a, t or m for neither, all TOS or MiNT scopes respectively finally
the drive is specified.
E.g.
mfsconf -d n -s a X:
sets directory translation to none and search translation to all on drive X:
All other modes remain the same.

View File

@@ -0,0 +1,69 @@
This file is designed as an introduction to minixfs. What it is, what it does
and why you might want to use it.
Minixfs is an alternative filesystem which runs under MiNT. It can
replace the standard TOS MS-DOS like filesystem which is standard on the ST.
So why would you want to replace the standard TOS filesystem? Here are some
of the arguments for and against minixfs:
For:
1. Filenames are no longer limited to 8 characters with an optional 3
character extension, the standard filesystem supports mixed case 14 character
filenames. Alternative filesystems support 30 or even 62 character filenames.
2. The filesystem is much more U*ix like, supporting the standard user/group
ids, 3 access times (well for the V2 filesystem anyway) and so on. If you're
used to Un*x like filesystems then this will certainly make you feel at home!
Symbolic and hard links are supported too as are sparse files and the root
directory can never fill up.
3. The filesystem is compatible with that used by Minix as might be guessed
from its name. If you use Minix then using minixfs under MiNT will allow the
minix partitions to be accessible under TOS, in fact they can be set up to
appear almost indistinguishable from TOS partitions.
4. Because it uses an indirection block Un*x like filesystem it tends to be
somewhat more robust than TOS filesystems.
5. Full source is available, as am I. You find a bug, tell me and I'll fix it.
6. It is possible to make *huge* partitions, theoretically the limit is 4096Gb
if your hardware and software can take it (and I don't know anything that
can!). This is achieved *without* increasing the sector size, unlike the
standard TOS filesystems.
7. It is quite a bit quicker than TOS filesystems. If you don't use
write-caching disk software then the speedup using turbo mode is considerable.
Even if you do use write-caching software (e.g. ICD) the speedup is still
useable.
Against:
1. Programs which depend upon the filesystem format (defraggers consistency
checkers etc) will not work. I have written a consistency checker for Minixfs
however, which is supplied. A port of the Linux defragger is also available.
2. Non MiNT aware programs will not be able to access longer filenames and
some non conforming MiNT aware programs wont either. You can still use the
translated TOS compatible names though.
3. Minixfs is not officially supported by Atari. At least they've never told
me if it is. This has several consequences and some of the more cynical may
consider this should be put in the 'for' group :-)
4. Huge partitions have a few caveats, mainly due to buggy driver software.
Although work arounds exist. Roughly speaking this works in spite of the
driver software rather than because of it :-)
In spite of the above 'againsts' I regard minixfs as a very powerful
and useful addition to the ST (then again I would wouldn't I?). For programmers
it is very useful indeed particularly if you are porting from Un*x, many of
the standard kludges to make filenames fit are no longer necessary nor are
some of the tricks to keep TOS happy (like not unlinking an open file).
If you haven't decided not to try Minixfs by now then you'll want to
know more information. If you're unsure you can always experiment with Minixfs
filesystems on floppy disks first before comitting your hard disk.
The remaining files in this directory give information about minixfs
itself and the various tools for creating and fixing minixfs partitions.

View File

@@ -0,0 +1,181 @@
The program 'minit' creates minixfs filesystems. Then can be created on a
TOS formatted disk or a TOS filesystem, then can also be created to alter
the parameters of an already existing minixfs partition.
WARNING: USING MINIT TO CREATE FILESYSTEMS WILL IRRETRIEVABLY WIPE ALL DATA
ON THAT PARTITION. This includes using it to create a filesystem 'on top' of
an already existing one. Don't say I didn't warn you.
FILESYSTEM VERSIONS.
Before you decide to make a filesystem you must decide which kind of filesystem
you want to make. There are two kinds at present V1 and V2. These are
compatible with the equivalent Minix filesystems. V1 filesystems are the
standard Minix filesystems used with all versions of Minix, they do have a
number of shortcomings, there is only one kind of file access time and V1
filesystems can be at most 64Mb in size. V2 filesystems are newer and are
the same as the V2 filesystems used by Minix 1.6xx (and presumably higher).
They have three access times and can be any size (if you hard disk software
will support it). I would strongly advise the use of V2 filesystems.
If you supply the -V option to minit you will make a V2 filesystem,
otherwise it will be V1.
DIRECTORY INCREMENT
It doesn't quite end there though. There are a couple more parameters
you should know about. Under Minix itself you can have filenames of at most
14 characters in length. Minixfs uses this value by default. However there is
a parameter called 'directory increment' which allows you to use longer
filenames. This parameter must be a power of two between 1 and 8 (inclusive)
in other words it can be 1,2,4 or 8. The maximum filename size is given by
the formula maxlength= increment*16 - 2. Thus increments of 1,2,4,8 will
result in maximum filename lengths of 14,30,62 and 126 respectively. However
be advised that every filename whatever length occupies this space, so if you
set the increment to 8 then a filename of length 1 will still use up the same
space in a directory as a filename of length 126. Setting this too high will
slow down directory operations somewhat. 2 is a reasonable value for this
parameter. NB If you use Minix itself then only the default increment (1) is
accessible to Minix; other values will seriously confuse Minix, so if you want
partitions to be accessible to Minix use increment 1 (the default).
The -n option allows you to set the directory increment, follow it by
the increment you want. If this option is not present then a value of one is
assumed.
PROTECTION
A couple of options deal with 'protection'. This is a somewhat tricky
subject. Basically protection is a method I use to prevent TOS from writing
to a Minixfs partition when MiNT is not running, if TOS did then the partition
would be damaged (possibly irreparably). If you will always use MiNT and
Minixfs, or you are absolutely certain you will never write to a Minixfs
partition without MiNT/Minixfs running then feel free to use no protection at
all.
However this is rather unlikely so you usually will need some form of
protection. There are currently two methods. Null Disk and other partition ID.
A Null disk makes TOS think it's root directory is full so it
can't write to a filesystem because it can't create any files.
If Null disk doesn't work then you can try an alternate partition ID.
This only works if you have software with an XHDI version of 1.10 or higher,
if you use the '-t' option to minit you can find out your XHDI version (if any).
The partition ID is a three character identifier for the partition type. TOS
uses GEM and BGM for its filesystems; you can use other types to ensure TOS
will never access the partition and Minixfs can. There are quite a few problems
though. Not all hard disk software allows the partition ID to be edited. Also
Minixfs can only automatically access other partitions with XHDI compliant
software (see the information provided by the '-t' option).
If you have XHDI compliant software and you can edit the partition ID
then you can use the ID MIX for Minixfs (you can also use RAW, but I wouldn't
advise it). After altering the ID, reboot and use minit as normal and all should
be OK.
OTHER OPTIONS
Normally minit tries to find out the size of a partition by itself,
this can sometimes fail. If it does then you must enter the partition size
(in K) manually with the -b option.
Inodes are part of the filesystem. Every file/directory/symbolic link
on the filesystem uses precisely one inode. If you run out of inodes then you
can't create any more files/directories/symbolic links without first deleting
some already there. The default number of inodes is a third the partition size
in K. If you want to create more then use the '-i' option followed by the number
you want. You can have at most 65535 inodes on a filesystem. The default will
almost always suffice, but you can increase this if you will need more.
The -S option writes out part of the filesystem called the 'super
block' only. If you accidentally wipe out the start of a partition then this
option may allow some data to be salvaged. If the start of a partition is
wiped out then the partition may not be even recognised as minix, so the -S
option can help under these rare circumstances. Note: you must use exactly the
same pararmeters you used to create the fileystem in the first place.
The -t option is a test option. It does almost everything needed to
create a filesystem without writing anything. It also gives a status report
of any options (e.g. XHDI support) the driver software may have. Use of '-t'
is recommended before actually creating the partition; it wont harm anything.
HUGE PARTITIONS
A *huge* partition is a partition where the logical sector size is
bigger than 1K. In practice this means bigger than 64Mb (or 32Mb with some
partitioning software). Unlike TOS filesystems when you create a Minixfs
filesystem bigger than 64Mb the filesystem is still accessed in 1K blocks.
In this sense if you create a 1 byte file when the logical sector size is
e.g. 4K you use up 1K of the disk not the 8K (2 sectors) TOS filesystems
would use.
If the partition you are creating is huge then you may have some
problems. This is basically down to bugs and inconsistencies in driver
software. I've tried to work around these as much as possible, but I can't
guarantee anything. The rules are explained below, which should help if you
want to create such a partition and minit complains. Generally minit will
complain if it can't find a work around for your software.
If the drive letter is A-P (inclusive) you should always be OK. If
you are using software which conforms to XHDI then you should also have no
problems (and you might want to set the partition ID to MIX as well). If
neither is the case then you may need to either obtain XHDI compatible disk
software or repartition/reorder (set the ID's so the large partition is on
the first hard drive) to make the large partition drive A-P.
The A-P restriction may be fixed in future versions of Minixfs if there
is any demand (however it is rather tricky to do).
RECREATING A TOS PARTITION
If you decide you want to turn a Minixfs partition back into a normal
TOS partition then you can use the '-r' option. This will recreate a blank
TOS filesystem on the partition selected. Certain hard disk software may not
recognise the new filesystem, so always reboot after you use this option.
Note: This option only works at present if you created the filesystem with
a newer version of minit. If there is any demand I may add an option for it
to work if the filesystem is older, by 'improvising' a bit.
Some hard disk software (e.g. ICD) and disk tools have an option to
rebuild a single partition without disturbing the others. If you have such
sofware then please use as opposed to the '-r' option. Such software will
probably work under all circumstances (e.g. filesystems made with older minit
versions). The primary reason I added the '-r' option was to allow people
without partition rebuilding software to be saved the effort of reformatting
or repartitioning their hard disks to get a TOS filesystem back.
USING MINIT
After all the options must come a drive letter (either case) followed
by a colon. You will then be given a warning, if you type 'y' or 'Y' then the
process continues, otherwise it is aborted. If you are running Minixfs/MiNT
the partition should be instantly recognisable. To check try using 'mfsconf'
and you should get some status info about translation modes (see minixfs.doc).
If you get the message 'drive X: is not minix' then there may be a problem.
Try rebooting, if that doesn't work try recreating a TOS partition (there
should be an option in you hard disk driver sofware to do this) and using
minit without any protection options. If this still fails then your system
hard disk driver software currently cannot use Minixfs partitions. Send me
a report (see the file 'bugs.doc') and I'll see what I can do.
WARNING: you should not make the partition you boot from or the partition that
you load MiNT and minix.xfs a Minixfs partition. This is because TOS cannot boot
a Minixfs partition or run MiNT/minix.xfs from a Minixfs partition.
EXAMPLES
Create a minixfs filesystem on drive A:
minit A:
Create a V2 filesystem on E:
minit -V E:
Create a V2 filesystem with increment 2 and null disk protection on drive D:
minit -V -d 2 -P D:
Test the disk driver software used to access drive F:
minit -t F:

View File

@@ -0,0 +1,59 @@
MINIX.XFS is the minix filesystem driver. To use it copy MINIX.XFS to
the root directory of whichever partition you start MiNT from. Reboot and
you should get the startup Minixfs message. Any Minixfs partitions should then
be immediately accessible.
If you don't use MultiTOS then you should also copy nohog.acc into your
root directory (or wherever you load accessories from).
There isn't a great deal more to say about it from a normal users point
of view. The only thing which can potentially cause trouble is filename
translation.
The system calls specific to Minixfs are described in syscall.doc.
These are only likely to interest programmers.
FILENAME TRANSLATION
Some programs cannot cope properly with mixed case filenames. In
general a program which is not MiNT aware (and some which are) will only
receive 13 chacacters of a filename. This is not the fault of Minixfs, in
pre-MiNT days there was simply no way to pass more characters to a program.
Some quite common (!) programs have problems, for example the desktop and
the standard file selector. As a result Minixfs has the option to translate
filenames to the standard TOS form, that is 8 characters with 3 character
extension and upper case (this will be referred to as 8+3 format).
Naturally this translation is not ideal and some conflicts may occur.
The normal translation rule is to make the filename upper case and to retain
the original extension. For example FooBARFilename.C becomes FOOBARFI.C. The
basename and extension are cut back to 8 and 3 characters respectively as
would be expected. Periods are replaced by commas in all but the extension.
There are four cases where translation can occur and 4 'scopes'. The
scope determines when a program should receive translation. The scopes are
all, MiNT domain, TOS domain and neither. Usually a program that understands
MiNT will run in MiNT domain; otherwise it will run in TOS domain. Clearly the
'neither' scope means translation will never occur for that case and 'all'
means it will always occur.
The 'cases' are search, directory, creation and executability.
When you attempt to access a file, 'search' is used. For example if the scope
means translations occurs for a specific program then if the file
FooBARFilename.C exists then it can be accessed as FOOBARFI.C. When a directory
is listed 'directory' translation is used, thus FooBARFilename.C will appear
as FOOBARFI.C on e.g. the desktop.
Creation is slightly different. This simply translates all filenames
created to lower case. So a TOS program creating FOOBARFI.C will actually
create foobarf.c . This can be useful for certain programs which translate
filenames to upper case.
Executability refers to creating files as well, if a file is created
with the extensions ttp,gtp,tos,prg (either or mixed case) then the 'x' bit
in the filename is set automatically. This makes sure executable programs
stay executable. This is useful for utilities that copy files but are not
aware of MiNT's extensions.
You can set the translation modes to different values for different
partitions, using the utility 'mfsconf'.

View File

@@ -0,0 +1,44 @@
Welcome to Minixfs! If you are attemting to use Minixfs for the first time
then I would advise you read all the docs in this directory (except
syscall.doc). Otherwise you can just read latest.doc for features added to
the latest version and any bugfixes etc. (for more detailed info read the
'changes' file in the source distribution).
Here is a summary of the contents of the document files:
copying Conditions of use.
address.doc Contact addresses.
mfsdoc.doc introduction to Minixfs and why you may or may not want to
use it.
minit.doc How to use 'minit' to create a Minixfs partition.
minixfs.doc How to install Minixfs and about filename translation.
flist.doc Description of flist utility.
csize.doc Cache resizing utility.
fsck.doc How to use fsck to fix filesystems and a bit of backround
as to their structure.
mfsconf.doc How to use mfsconf to set the filesystem translation modes.
mount.doc How to use the mount program.
bugs.doc How to submit a bug report.
syscall.doc Minixfs specific system calls and special features of standard
system calls. Only really of interest to programmers.
latest.doc Bugfixes and/or features of this version.
NB Read the file bugs.doc before submitting a bug report. I don't have access
to your system so all I know about it is what you tell me, this file tells you
the kind of information I need to have a reasonable chance of fixing a problem.
I waste a great deal of time and money simply asking people to give me the
proper information after an initial report saying "Minixfs doesn't work" or
a nasty post to Usenet. In future I'll ingnore such reports, if you can't be
bothered to read the docs then I can't be bothered to help.

View File

@@ -0,0 +1,212 @@
This file describes some of the syscalls and some special aspects of the
standard syscalls.
STAT (Fxattr)
Almost all the fields are relevant and not 'faked' unlike most of the
standard filesystems. There are a couple of minor exceptions. For V1
filesystems atime/adate and ctime/cdate fields are faked, they are
the same as mtime/mdate; these are not faked for V2 filesystems. The
nblocks field is faked by just assuming the file is continuous, this
will usually be correct; if the file is sparse however this will be
too high.
The 'dev' field is the drive with the standard form 0=A,1=B etc. The
field 'index' is the inode number, this is again valid: if two files
or file descriptors have the same inode and device numbers then they
are the same file, otherwise they are different.
If there are character or block special files on the device then the
field 'rdev' gets filled in appropriately.
DOPENDIR (DREADIR)
In normal mode you never get translated filenames, in addition the
long field is the inode number.
RENAME
You can 'move' directories with this call, as would be expected for
a U*ix like filesystem. This naturally moves all the contents of that
subtree as well. This call will not allow a directory to be moved inside
itself, as this would damage the filesystem (and is illegal anyway).
FDATIME
This is made fairly close to 'utimes', basically setting both atime/mtime
to the value specified and ctime to the current time. It can't change the
times for directories because MiNT blocks opening directories.
FATTR
This is largely faked, the fields aren't really valid for U*ix like
filesystems. Only the DIR/RDONLY bits have any meaning, and RDONLY
can be set as well.
VOLUME NAMES
Basically these don't exist. I suppose I could add support in some way if
there was any demand.
LINK/SYMLINK
As would be expected these are perfectly valid. LINK does not allow hard links
to directories, even by superuser basically because there is no real need since
symbolic links can do this and there would be no way to remove them.
UNLINK
Unlink behaves in a U*ix like manner with regard to open files. Basically you
can unlink() an open file and let all processes with it open read/write as
normal. When all processes close() the file (or exit which closes anyway) the
space used by the file is freed up.
You can *not* unlink directories, this would be too risky and isn't needed
anyway.
FSEEK
Minixfs allows the creation of sparse files in the usual way (seek past EOF and
write).
DCNTL CALLS
The Dcntl syscall has several options for minixfs filesystems. The 'standard'
calls FUTIME (set inode times) and FTRUNCATE (truncate file) exist as do their
Fcntl (ioctl) equivalents. However also inluded are several Minixfs specific
calls.
Opcode 0x100 MFS_VALID
This interprets the value of the additional argument as a long pointer, and
is stores the value MFS_MAGIC there. This is intended so that the path passed
to Dcntl can verified as being on a minixfs filesystem. MFS_MAGIC has the
value 0x1870431. Because of the possibility of other filesystems using the
same numbers for Dcntl functions with different purposes (though none do as
far as I know) MFS_VALID should always be called before using the other Minixfs
specific opcodes and MFS_MAGIC checked.
Opcode 0x101 MFS_SYNC
Synchronise *all* filesystems, basically write out internal buffers to disk.
Currently the filesystem internally sync()'s as well at various points, so
this call is not at present necessary before rebooting the system.
Opcode 0x102 MFS_CINVALID
Invalidate all cache entries for a given drive. This is used mainly internally.
Opcode 0x103 MFS_FINVALID
Invalidate all file descriptors on the given drive.
Opcode 0x104 MFS_INFO
This call basically returns some info about the Minixfs filesystem on which
the path resides. It interprets the value of the additional parameter as a
pointer to an mfs_info structure. This structure has the following form:
long total_inodes,total_zones;
long free_inodes,free_zones;
short version;
short incr;
long res1,res2,res3,res4;
(long=32 bits, short=16bits).
total_inodes and total_zones return the total number of inodes and zones
for the filesystem. Similarly free_inodes and free_zones show how many are
unused. A 'zone' is always 1K. version is 1 for V1 filesystems and 2 for
V2. incr is the directory increment. You can use this to determine the
maximum filename size with the formula incr*16-2. The MiNT syscall Dconf
can also be used for this purpose (see MiNT docs).
Opcode 0x106 MFS_IMODE
The extra paramater is interpreted as a long int. Its value is used to set
the mode of *all* the bits of the file pathname points to. Including the
type fields, thus you can change directories to files, and vice-versa.
This is again root only. Extreme caution is needed with this syscall: it
can do a lot of damage.
Opcode 0x107 MFS_GTRANS
Opcode 0x108 MFS_STRANS
This call gets and sets the translation modes for this device. Only the
superuser can do this. The extra parameter is interpreted as a long
pointer. The scope corresponds to the following values.
#define NONE 0
#define TOS 1
#define MINT 2
#define ALL 3
The 'type' is contained in groups of two bits. Bits 0-1 correspond to
search translation, bits 2-3 are directory translation, bits 4-5 are for
creation translation and bits 6-7 are for execute translation. All other
bits are currently ignored and should be set to zero.
Opcode 0x10a MFS_IADDR
The argument is a long pointer which will have the start address of Minixfs
placed in it. If Minixfs has crashed then using this address along with the
symbol table (or a suitable debugger) allows the precise point of the crash
to be determined.
Opcode 0x10b MFS_UPDATE
This controls the update daemon. If no daemon is running (e.g. not Turbo mode)
then this function returns -1. Otherwise the argument is a long which is
interpreted as follows.
0x0: Return 1 if daemon suspended, 0 if running.
0x1: Suspend execution of the daemon.
0x2: Resume execution of daemon.
0x3: Return the process id (pid) of the daemon (returns -1 if daemon not used)
Opcode 0x10c MFS_MOUNT
This is a bit experimental at present. It is used to mount one Minixfs
filesystem on another and may go away some day if the kernel implements
this (which is where it should really be). 'arg' is a pointer to the
following structure:
unsigned int dev;
long flags;
long reserved[4];
dev is the device to mount (the path to Dcntl gives the path to mount on).
flags is unused at present and should be set to zero. The reserved fields
are also unused at present. The Dcntl path must be a directory other than
the root directory. The filesystem of device 'dev' must not have any filesytems
mounted on it already.
Opcode 0x10d MFS_UMOUNT
The filesystem the Dcntl path is on is umounted.
Opcode 0x10e MFS_LOPEN
arg points to the following structure:
long limit;
unsigned int ilist[SIZE];
The field 'limit' should be set to the value of SIZE (the size of the ilist
array). After this call the inode numbers of all open files on the Dcntl path
filesystem are entered into the ilist array, followed by a zero terminator.
If there isn't enough room in the array, it is truncated and ERANGE returned.
Opcode 0x10f MFS_MKNOD
arg is a long. The low word is a mode parameter which is the full mode of
a character or block special file mode. The high word is the major/minor
device numbers of the file. The Dcntl path is the path to create.
NOTE ON FILENAME TRANSLATION
Using minixfs filesystems you should always use the Dopendir etc. MiNT calls
in normal mode. This way you never get translated filenames. You can use the
Dconf or the MFS_INFO Dcntl syscalls to get the maximum filename length (if
needed).

View File

@@ -0,0 +1,42 @@
mkfatfs, filesystem tool
========================
Here is the first public release of mkfatfs, a filesystem creation tool.
Main reason for this programm is to build TOS and DOS FAT32 partitions also
on ATARI computers.
Sorry, it's a commandline tool. Contact me if you will write
a graphical user interface.
Ok, what is FAT32 you ask now?
FAT32 is a extension of the existing FAT definition. The FAT (File
Allocation Table) on existing partitions is 16 bit wide.
This limits the maximum number of cluster to 65536 (under TOS
to 32768 because of some bugs). So if you need large partitions
you must increase cluster size. But this has a negative side effect.
Large cluster also increase
It requires a harddiskdriver that support at least XHDI level 1.10.
If you start mkfatfs without any parameter, you get the
following output:
------------------------------------------------------------------------------
./mkfatfs 0.2b, 1998-08-01 for TOS and DOS FAT/FAT32-FS
Found XHDI level 1.30.
No drive specified.
Usage: ./mkfatfs [OPTIONS] drv:
-c Check filesystem as is gets built
-f <num> Number of FATs (between 1 and 4)
-F <num> FAT size (12, 16, or 32)
-i <id> Volume ID as hexadecimal number (i.e. 0x0410)
-l <filename> Bad block filename
-m <filename> Boot message filename--text is used as a boot message
-n <name> Volume name
-r <num> Root directory entries (not applicable to FAT32)
-s <num> Sectors per cluster (2, 4, 8, 16, 32, 64, or 128)
-a Create filesystem always (disables partition ID checking)
------------------------------------------------------------------------------

View File

@@ -0,0 +1,36 @@
All files in this archive are Copyright (c) 1993-95 Kay Roemer.
Exceptions are explicitely stated.
I cannot take over any responsibility for any files in this distribution.
Therefore the following disclaimer:
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You are welcome to use, copy, distribute and modify the source code
included in this package for noncommercial purposes as long as the
following conditions are met:
o All the files are kept in the distribution.
o Any modifications on files in the distribution are clearly
marked as such, including a statement that the original author
is not responsible for your modifications and possible damage
resulting in your modifications.
o You may not sell this package or parts of it for more than
double the cost of copying the files onto media, including
the cost of the media, excluding local taxes.
Usage of MintNet or parts of it as part of commercial products requires a
written licence from Kay Roemer.
You have agreed with the above conditions when holding copies of the
distribution in your posession.

View File

@@ -0,0 +1,50 @@
SLINKCTL.TTP
------------
SLINKCTL is a command-line program for controlling SCSILINK.XIF. It
retrieves statistics, clears statistics, and/or resets the device. The
statistics are intended to help in problem determination, so will not be
very meaningful to the end user; however, if you have a problem, we may
ask you to run it and send the results to Anodyne Software. SLINKCTL
has the following syntax:
slinkctl [-c] [-r] [-tN] <interface>
By default (i.e. with no optional parameters) it reports internal statistics
including the trace for the interface named <interface>. If one or more
of the options is set, the appropriate actions are carried out but no
report is created.
Available options:
-c clears the statistics counters
-r resets the interface (useful if it seems to be hung)
-tN sets the number of entries in the trace table to N; N must
be between 0 & 10000 inclusive. NOTE: the trace table is
mostly for use during development, and is not likely to
mean much to the casual user. It's recommended that you
leave the number of entries at zero (the default).
Output is to stdout.
Examples:
slinkctl.ttp en0
writes the statistics for port 'en0' to stdout
slinkctl.ttp -c en0
clears the statistics for port 'en0'
slinkctl.ttp -r en1
resets the SCSI/Link device at port 'en1'
REVISION HISTORY
================
Version
-------
0.50 First public beta release
0.60 . SLINKCTL now displays the MAC address of the device
. SLINKCTL now only writes to stdout (you may of course use
the shell to redirect output to a file)
Roger Burrows
Anodyne Software
20/November/2007

View File

@@ -0,0 +1,53 @@
All files in this archive are Copyright (c) 1993, 1994 by Ulrich Kuehn.
Exceptions are explicitely stated.
I cannot take over any responsibility for any files in this distribution.
Therefore the following disclaimer:
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You are welcome to use, copy, distribute and modify the source code
included in this package as long as the following conditions are met:
o All the files are kept in the distribution.
o Any modifications on files in the distribution are clearly
marked as such, including a statement that the original author
is not responsible for your modifications and possible damage
resulting in your modifications.
o You may not sell this package for more than the cost of copying
the files onto media, including the cost of the media, excluding
local taxes. This does not apply to modified versions, which are
only allowed to be distributed for free (of course you are
allowed to sell the diffs, but not the modified package!).
For exceptions the written consent of the author is necessary.
You have agreed with the above conditions when holding copies of the
distribution in your posession, you can terminate this by destroying
any copy and all modified versions of this software in your possession.
Of course any donations of money in any amount are very wellcome, just send
it to my address or ask for a bank connection...
My address is:
Email:
kuehn@math.uni-muenster.de (preferred)
Snail mail:
Ulrich Kuehn
Geibelstr.9
48161 Muenster
Germany

View File

@@ -0,0 +1,145 @@
This is an early beta version of an networking file system for MiNT.
Copyright 1993, 1994 by Ulrich K<>hn. All rights reserved.
DISCLAIMER:
===========
THIS PROGRAM COMES WITH ABSOLUTELY NO WARRANTY, NOT
EVEN THE IMPLIED WARRANTIES OF MERCHANTIBILITY OR
FITNESS FOR A PARTICULAR PURPOSE. USE AT YOUR OWN
RISK.
See also the file COPYING for further details.
EXPLANATION:
============
A network file system allows computers to access file that are physically
located on another computer transparently. Therefor the must be a means of
data transport between these two computers (see above for the current
situation). The computer accessing the remote file is called the client,
the computer being physically the owner of that file is the server.
On the server, there must be a service program running, that satisfies the
access requests of the client. This program is called nfs daemon, short
named nfsd. Because normally the client does not know which files can be
accessed by it, it must be told so; this is called mounting of a remote
directory or file and done with a program called mount on the client.
On the server side there must run another service program, the mount daemon
called mountd, which serves these mount requests by clients.
So: without nfsd no file access, without mountd no mounts to access files.
Another point is that both server and client can be the same computer!
Then the daemon programs run on that machine, and also the mount program is
executed there. This is the easiest way to test this package.
INSTALLATION:
=============
There are a few things to do (better try first server and client on the
same computer) :
- (both server and client) make sure to have Kay Roemer's mint-net (a socket
device) installed correctly. Version >= 0.30
(eMail: roemer@hera.rbi.informatik.uni-frankfurt.de)
This includes:
- make sure to have a directory u:\etc (make a symbolic link to
your preferred place in mint.cnf)
- place the following files in u:\etc
hostname, hosts, networks, services, resolv.conf
- name your host by writing a name into u:\etc\hostname
- (client) copy the nfs.xfs (the client filesystem driver) to a place where
MiNT can find it at boot time (that is \mint or \multitos on your boot drive)
- (server) install the portmapper daemon from the sun rpc package. Place
the rpc file into u:\etc
The portmapper is essential as both the mount daemon and the mount
command rely on that, but as a temporary hack, they can also work without
the portmapper.
- (server) create a file u:\etc\xtab containing all the exported directories
or files. This file is necessary for both nfsd and mountd (if necessary,
rename them to nfsd.ttp and mountd.ttp). Please look into the bundled
example, as no further docs are availbale at the moment. (or look into
some unix adm doc)
- reboot
Then start the mountd and the nfsd. Now the system is ready to do some
nfs mounts. Here an example: (suppose \etc\xtab contains a line
\f\source ....)
mount hostname:\f\source \nfs\source
where hostname is the name of your host. (all operations done while drive
u: is the current. It should be, as mount treats the ':' as separator
betweeen hostname and directory name)
Another point is that if you are trying to run server and client stuff on
the same machine, the hostname for the mount command must be 'localhost'
or 'loopback' (there should be such a line in \etc\hosts), as the resolver
otherwise does not find the correct host (this behavior might depend on the
version of the mint-net your are using, or on your configuration)
After this operation you should have a directory source in u:\nfs which has
all the contents of the original \f\source
All this can be done within mint.cnf (or better use a shell script which
is started from mint.cnf -- look at the example rc.mup and mint.cnf)
A new feature of the mountd and nfsd is that they can be started by
the inetd and terminate themselfes in this case after a short time, so
there is no need to hold the all the time running in memory. Just install
the inetd and make sure that the mount and nfs lines in u:\etc\inetd.conf
are correct, that means they are active and the paths are correct.
COMPILATION:
============
If you want to rebuild the binaries by yourself, you have first to edit
the paths in the Makevars file, especially the BUILDDIR variable.
Then simply type make all or make install and wait...
BUGS:
=====
- the nfsd is not able to find a file on a TOSFS (in the state of MiNT
<= 1.10) if it has only its nfs handle and no internal information. So
it does not work properly on such a file system, sorry. But it works on
a patched TOSFS with Julian Reschke's crc patch applied and enabled.
This patch is included in MiNT 1.12 (get this anyway, as binaries are
available!), but it seems to be disabled by default (take a look into
tosfs.c in the MiNT source).
- no caching of results for nonidempotent requests. So if the anser of a
file remove request gets lost and the client resends this request, it
will fail because the file is already gone.
- no exportfs command, so you have to edit your \etc\xtab yourself and
cannot use the \etc\exports file.
- several mount options are still not supported by the XFS, such as
hard mounts
MY CONFIGURATION:
=================
I am running this system on a TT030 with 4/4 Mb ram, TOS 3.06, a patched
MiNT 1.12, using both minixfs and the patched tosfs, and it seems to be
quite stable now, but who knows?
THANKS:
=======
Many thanks go to Kay Roemer for his great socket device, which made this
nfs possible. He also constantly supplied me with critics, suggestions,
ideas and bug fixes.
CONTACT ADDRESS:
================
If you have questions, bug reports, suggestions, etc. please contact
me under:
kuehn@math.uni-muenster.de (Ulrich Kuehn) preferred
Ulrich Kuehn, Geibelstr.9, 48161 Muenster, Germany
Have fun
Ulrich

View File

@@ -0,0 +1,264 @@
Examples of the use of sfdisk 3.0 (to partition a disk)
Input lines have fields <start>,<size>,<type>... - see sfdisk.8.
Usually no <start> is given, and input lines start with a comma.
Before doing anything with a disk, make sure it is not in use;
unmount all its file systems, and say swapoff to its swap partitions.
(The final BLKRRPART ioctl will fail if anything else still uses
the disk, and you will have to reboot. It is easier to first make
sure that nothing uses the disk, e.g., by testing:
% umount /dev/sdb1
% sfdisk -R /dev/sdb
BLKRRPART: Device or resource busy
* Device busy for revalidation (usage=2)
% swapoff /dev/sdb3
% sfdisk -R /dev/sdb
* sdb: sdb1 < sdb5 sdb6 > sdb3
%
Note that the starred messages are kernel messages, that may be
logged somewhere, or written to some other console.
In sfdisk 3.01 sfdisk automatically does this check, unless told not to.)
1. One big partition:
sfdisk /dev/hda << EOF
;
EOF
(If there was garbage on the disk before, you may get error messages
like: `ERROR: sector 0 does not have an msdos signature'
and `/dev/hda: unrecognized partition'. This does not matter
if you write an entirely fresh partition table anyway.)
The output will be:
-----------------------------------------------------------------------
Old situation:
...
New situation:
Units = cylinders of 208896 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/hda1 0+ 1023 1024- 208895+ 83 Linux native
Successfully wrote the new partition table
hda: hda1
-----------------------------------------------------------------------
Writing and rereading the partition table takes a few seconds -
don't be alarmed if nothing happens for six seconds or so.
2. Three primary partitions: two of size 50MB and the rest:
sfdisk /dev/hda -uM << EOF
,50
,50
;
EOF
-----------------------------------------------------------------------
New situation:
Units = megabytes of 1048576 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End MB #blocks Id System
/dev/hda1 0+ 50- 51- 51203+ 83 Linux native
/dev/hda2 50+ 100- 51- 51204 83 Linux native
/dev/hda3 100+ 203 104- 106488 83 Linux native
Successfully wrote the new partition table
hda: hda1 hda2 hda3
-----------------------------------------------------------------------
/dev/hda1 is one block (in fact only half a block) shorter than
/dev/hda2 because its start had to be shifted away from zero in
order to leave room for the Master Boot Record (MBR).
3. A 1MB OS2 Boot Manager partition, a 50MB DOS partition,
and three extended partitions (DOS D:, Linux swap, Linux):
sfdisk /dev/hda -uM << EOF
,1,a
,50,6
,,E
;
,20,4
,16,S
;
EOF
-----------------------------------------------------------------------
Device Boot Start End MB #blocks Id System
/dev/hda1 0+ 1- 2- 1223+ a OS/2 Boot Manager
/dev/hda2 1+ 51- 51- 51204 6 DOS 16-bit FAT >=32M
/dev/hda3 51+ 203 153- 156468 5 Extended
/dev/hda4 0 - 0 0 0 Empty
/dev/hda5 51+ 71- 21- 20603+ 4 DOS 16-bit FAT <32M
/dev/hda6 71+ 87- 17- 16523+ 82 Linux swap
/dev/hda7 87+ 203 117- 119339+ 83 Linux native
Successfully wrote the new partition table
hda: hda1 hda2 hda3 < hda5 hda6 hda7 >
-----------------------------------------------------------------------
All these rounded numbers look better in cylinder units:
% sfdisk -l /dev/hda
-----------------------------------------------------------------------
Device Boot Start End #cyls #blocks Id System
/dev/hda1 0+ 5 6- 1223+ a OS/2 Boot Manager
/dev/hda2 6 256 251 51204 6 DOS 16-bit FAT >=32M
/dev/hda3 257 1023 767 156468 5 Extended
/dev/hda4 0 - 0 0 0 Empty
/dev/hda5 257+ 357 101- 20603+ 4 DOS 16-bit FAT <32M
/dev/hda6 358+ 438 81- 16523+ 82 Linux swap
/dev/hda7 439+ 1023 585- 119339+ 83 Linux native
-----------------------------------------------------------------------
But still - why does /dev/hda5 not start on a cylinder boundary?
Because it is contained in an extended partition that does.
Of the chain of extended partitions, usually only the first is
shown. (The others have no name under Linux anyway.) But
these additional extended partitions can be made visible:
% sfdisk -l -x /dev/hda
-----------------------------------------------------------------------
Device Boot Start End #cyls #blocks Id System
/dev/hda1 0+ 5 6- 1223+ a OS/2 Boot Manager
/dev/hda2 6 256 251 51204 6 DOS 16-bit FAT >=32M
/dev/hda3 257 1023 767 156468 5 Extended
/dev/hda4 0 - 0 0 0 Empty
/dev/hda5 257+ 357 101- 20603+ 4 DOS 16-bit FAT <32M
- 358 1023 666 135864 5 Extended
- 257 256 0 0 0 Empty
- 257 256 0 0 0 Empty
/dev/hda6 358+ 438 81- 16523+ 82 Linux swap
- 439 1023 585 119340 5 Extended
- 358 357 0 0 0 Empty
- 358 357 0 0 0 Empty
/dev/hda7 439+ 1023 585- 119339+ 83 Linux native
- 439 438 0 0 0 Empty
- 439 438 0 0 0 Empty
- 439 438 0 0 0 Empty
-----------------------------------------------------------------------
Why the empty 4th input line? The description of the extended partitions
starts after that of the four primary partitions.
You force an empty partition with a ",0" input line, but here all
space was divided already, so the fourth partition became empty
automatically.
How did I know about 4,6,a,E,S? Well, E,S,L stand for Extended,
Swap and Linux. The other values are hexadecimal and come from
the table:
% sfdisk -T
Id Name
0 Empty
1 DOS 12-bit FAT
2 XENIX root
3 XENIX usr
4 DOS 16-bit FAT <32M
5 Extended
6 DOS 16-bit FAT >=32M
7 OS/2 HPFS or QNX or Advanced UNIX
8 AIX data
9 AIX boot or Coherent
a OS/2 Boot Manager
...
4. Preserving the sectors changed by sfdisk.
% sfdisk -O save-hdd-partition-sectors /dev/hda
...
will write the sectors overwritten by sfdisk to file.
If you notice that you trashed some partition, you may
be able to restore things by
% sfdisk -I save-hdd-partition-sectors /dev/hda
%
5. Preserving some old partitions.
% sfdisk -N2 /dev/hda
...
will only change the partition /dev/hda2, and leave the rest
unchanged. The most obvious application is to change an Id:
% sfdisk -N7 /dev/hda
,,63
%
-----------------------------------------------------------------------
Old situation:
Device Boot Start End #cyls #blocks Id System
/dev/hda1 0+ 5 6- 1223+ a OS/2 Boot Manager
...
/dev/hda6 358+ 438 81- 16523+ 82 Linux swap
/dev/hda7 439+ 1023 585- 119339+ 83 Linux native
New situation:
Device Boot Start End #cyls #blocks Id System
/dev/hda1 0+ 5 6- 1223+ a OS/2 Boot Manager
...
/dev/hda6 358+ 438 81- 16523+ 82 Linux swap
/dev/hda7 439+ 1023 585- 119339+ 63 GNU HURD
-----------------------------------------------------------------------
Note that changing a logical partition into an empty partition
will decrease the number of all subsequent logical partitions.
6. Deleting a partition.
At first I thought of having an option -X# for deleting partitions,
but there are several ways in which a partition can be deleted, and
it is probably better to handle this just as a general change.
% sfdisk -d /dev/hda > ohda
will write the current tables on the file `ohda'.
-----------------------------------------------------------------------
% cat ohda
# partition table of /dev/hda
unit: sectors
/dev/hda1 : start= 1, size= 40799, Id= 5
/dev/hda2 : start= 40800, size= 40800, Id=83
/dev/hda3 : start= 81600, size= 336192, Id=83
/dev/hda4 : start= 0, size= 0, Id= 0
/dev/hda5 : start= 2, size= 40798, Id=83
-----------------------------------------------------------------------
In order to delete the partition on /dev/hda3, edit this file
and feed the result to sfdisk again.
-----------------------------------------------------------------------
% emacs ohda
% cat ohda
# partition table of /dev/hda
unit: sectors
/dev/hda1 : start= 1, size= 40799, Id= 5
/dev/hda2 : start= 40800, size= 40800, Id=83
/dev/hda3 : start= 0, size= 0, Id= 0
/dev/hda4 : start= 0, size= 0, Id= 0
/dev/hda5 : start= 2, size= 40798, Id=83
% sfdisk /dev/hda < ohda
Old situation:
Units = cylinders of 208896 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/hda1 0+ 99 100- 20399+ 5 Extended
/dev/hda2 100 199 100 20400 83 Linux native
/dev/hda3 200 1023 824 168096 83 Linux native
/dev/hda4 0 - 0 0 0 Empty
/dev/hda5 0+ 99 100- 20399 83 Linux native
New situation:
Units = sectors of 512 bytes, counting from 0
Device Boot Start End #sectors Id System
/dev/hda1 1 40799 40799 5 Extended
/dev/hda2 40800 81599 40800 83 Linux native
/dev/hda3 0 - 0 0 Empty
/dev/hda4 0 - 0 0 Empty
/dev/hda5 2 40799 40798 83 Linux native
Successfully wrote the new partition table
% sfdisk -l -V /dev/hda
Disk /dev/hda: 12 heads, 34 sectors, 1024 cylinders
Units = cylinders of 208896 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/hda1 0+ 99 100- 20399+ 5 Extended
/dev/hda2 100 199 100 20400 83 Linux native
/dev/hda3 0 - 0 0 0 Empty
/dev/hda4 0 - 0 0 0 Empty
/dev/hda5 0+ 99 100- 20399 83 Linux native
/dev/hda: OK
-----------------------------------------------------------------------
This is a good way of making changes: dump the current status
to file, edit the file, and feed it to sfdisk.
Preserving the file on some other disk could be useful:
if ever the MBR gets thrashed it can be used to restore
the old situation.