Ffs From Hackepedia
The Berkeley FFS was written by Marshall Kirk McKusick for 4.2BSD at UCB. It resides on a disk partition in blocks greater or equal to 4096 bytes (no less). It has a super block that contains filesystem specific data (eg. when the last fsck took place, use dumpfs(8) to display the superblock, this is a very long listing) which is at block 0. It also has backup superblocks in case the first superblock is corrupted (fsck -b to repair a broken superblock and check the filesystem with an alternate superblock), the next superblock is at block 32 and the others are made known at newfs time.
# newfs /dev/rsvnd0a
Warning: cylinder groups must have a multiple of 2 cylinders
Warning: 64 sector(s) in last cylinder unallocated
/dev/rsvnd0a: 65536 sectors in 656 cylinders of 1 tracks, 100 sectors
32.0MB in 3 cyl groups (250 c/g, 12.21MB/g, 3136 i/g)
super-block backups (for fsck -b #) at:
32, 25032, 50032,
Here in the example the backups are 32, 25032 and 50032. To find out the alternate superblocks after a filesystem has already been created use newfs -N.
Next (not counting the super-blocks) the filesystem is split into 2 parts. One for a long index (sequence of inodes) and the other for data. The inodes are the reference points for objects and data in the filesystem and they hold information such as:
The inode in FFS does not store the filename, that has to be read out of the data of a directory which contains entries of filenames up to 255 bytes long not including the NUL terminator and also has the inode number stored for reference back to the inode and thus the data of a file. Lookup always starts at the root of the system which is usually inode number 2 in FFS:
$ ls -lid / 2 drwxr-xr-x 17 root wheel 512 Oct 25 22:39 / ^This way the path of a program is traversed until the file is found and then the inode of the file is identified. The system uses a caching mechanism to speed up consecutive lookups of filenames in a path. For more information on FFS see A fast filesystem for UNIX. UFS2 FreeBSD and NetBSD have a second version of FFS that allows filesystem sizes greater than 1 TB. This is UFS2. The size of an UFS2 inode is 256 bytes and thus UFS1 and UFS2 are not compatible.
$ less -XF /usr/src/sys/contrib/softupdates/READMETo see if you have soft-updates enabled: on FreeBSD:
$ mount /dev/ad0s1a on / (ufs, local) devfs on /dev (devfs, local) /dev/ad0s1g on /backup (ufs, local, soft-updates) /dev/ad0s1e on /tmp (ufs, local, soft-updates) /dev/ad0s1f on /usr (ufs, local, soft-updates) /dev/ad0s1d on /var (ufs, local, soft-updates)on OpenBSD
$ mount /dev/wd0a on / type ffs (local, softdep) /dev/wd0e on /usr type ffs (NFS exported, local, nodev, softdep) /dev/wd0d on /var type ffs (local, nodev, nosuid, softdep) mfs:22707 on /tmp type mfs (asynchronous, local, nodev, nosuid, size=261120 512-blocks)Side effects of having soft updates on the / filesystem are that a new kernel written to /bsd shortly before a panic will be corrupted requiring the next boot off a backup of the kernel.
German - von Hackepedia
Das Berkeley FFS war geschrieben von Marshall Kirk McKusick fuer die version 4.2BSD bei UCB (Uni Berkeley). FFS liegt auf einer Festplatten Partition geteilt in Blocks von 4096 bytes oder mehr (aber nicht weniger). Es hat einen "super-block" das Dateisystem-spezifische Daten enthaelt (z.b. wann der letzte fsck benutzt war. Mit dumpfs(8) kann man den superblock sehen, was aber ein sehr langes listing wird). Der super-block ist auf Block 0, es gibt auch backups vom superblock falls der superblock auf Block 0 korrupiert ist (man benutzt fsck -b um einen kaputten superblock zu reparieren und das Dateisystem wird ebenfalls gecheckt), ein naechster superblock is block 32 und die anderen koennen gesehen werden wenn das Dateisystem zuerst initialisiert wird mit dem Kommando "newfs".
# newfs /dev/rsvnd0a
Warning: cylinder groups must have a multiple of 2 cylinders
Warning: 64 sector(s) in last cylinder unallocated
/dev/rsvnd0a: 65536 sectors in 656 cylinders of 1 tracks, 100 sectors
32.0MB in 3 cyl groups (250 c/g, 12.21MB/g, 3136 i/g)
super-block backups (for fsck -b #) at:
32, 25032, 50032,
In dem Beispiel oben sind die alternativen superblocks 32, 25032 und 50032.
Um die alternativen superblocks in einem live Dateisystem zu finden benutze
newfs -N sei aber vorsichtig das Sie sich nicht vertippen.
Das Dateisytem ist dann in Zwei teile gespalten. Ein teil fuer das Index (inodes/meta-dateien) und das andere fuer Dateien. Die inodes sind referenz punkte fuer Daten im Dateisystem und sie halten Informationen wie:
$ ls -lid / 2 drwxr-xr-x 17 root wheel 512 Oct 25 22:39 / ^Und so wird der Pfad des Programms entlang gelaufen bis die gesuchte Datei gefunden ist, und die Inode der Datei identifiziert ist. Das FFS system benutzt eine Speicher-Cache um diesen Mechanismus zu beschleunigen nach dem ersten mal. FreeBSD und NetBSD haben eine Zweite version von FFS (FFS2) die erlaubt ein Dateisystem groesser als 1TB zu halten. Der unterschied zu FFS1 in FFS2 ist das eine Inode eine groesse von 256 bytes hat anstatt 128 und deswegen sind FFS1 und FFS2 nicht kompatibel.
$ less -XF /usr/src/sys/contrib/softupdates/README To see if you have soft-updates enabled: on FreeBSD: $ mount /dev/ad0s1a on / (ufs, local) devfs on /dev (devfs, local) /dev/ad0s1g on /backup (ufs, local, soft-updates) /dev/ad0s1e on /tmp (ufs, local, soft-updates) /dev/ad0s1f on /usr (ufs, local, soft-updates) /dev/ad0s1d on /var (ufs, local, soft-updates) on OpenBSD $ mount /dev/wd0a on / type ffs (local, softdep) /dev/wd0e on /usr type ffs (NFS exported, local, nodev, softdep) /dev/wd0d on /var type ffs (local, nodev, nosuid, softdep) mfs:22707 on /tmp type mfs (asynchronous, local, nodev, nosuid, size=261120 512-blocks)