From 605abcfbe4ee5bf85832f97a906c49291be12100 Mon Sep 17 00:00:00 2001 From: "Simon L. B. Nielsen" Date: Thu, 23 Mar 2006 22:13:54 +0000 Subject: [PATCH] Some rework of the memory, and file-backed file systems section: - Remove 5.X from titles, since it applies to 5.X+. - Refer only to bsdlabel in the 5.X+ section and remove note about the switch from disklabel to bsdlabel in FreeBSD 5.1. - Do not suggest users place file systems on the "c" partition (which is meant for the "raw" device) and use the "a" partition instead. (Note that I'm not really sure if there is a good reason to label a memory disk before use when just using the entire disk for one file system, but I will leave this for now.) - Update program output to show what resent FreeBSD version actually writes. - For memory backed file system section, suggest that people use swap backed and not malloc(9) backed, since malloc based memory disks have a good disk of causing a panic since the kernel risks runing out of memory in the malloc pool. --- .../books/handbook/disks/chapter.sgml | 71 ++++++++----------- 1 file changed, 31 insertions(+), 40 deletions(-) diff --git a/en_US.ISO8859-1/books/handbook/disks/chapter.sgml b/en_US.ISO8859-1/books/handbook/disks/chapter.sgml index 16a855f078..479868889c 100644 --- a/en_US.ISO8859-1/books/handbook/disks/chapter.sgml +++ b/en_US.ISO8859-1/books/handbook/disks/chapter.sgml @@ -3009,14 +3009,14 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on - File-Backed File System under FreeBSD 5.X + File-Backed File System disks - file-backed (5.X) + file-backed The utility &man.mdconfig.8; is used to configure and enable - memory disks, &man.md.4;, under FreeBSD 5.X. To use + memory disks, &man.md.4;, under FreeBSD 5.X and later. To use &man.mdconfig.8;, you have to load &man.md.4; module or to add the support in your kernel configuration file: @@ -3032,7 +3032,7 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on Using <command>mdconfig</command> to Mount an Existing File System - Image under FreeBSD 5.X + Image &prompt.root; mdconfig -a -t vnode -f diskimage -u 0 &prompt.root; mount /dev/md0 /mnt @@ -3047,16 +3047,16 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on 5120+0 records in 5120+0 records out &prompt.root; mdconfig -a -t vnode -f newimage -u 0 -&prompt.root; disklabel -r -w md0 auto -&prompt.root; newfs md0c -/dev/md0c: 5.0MB (10240 sectors) block size 16384, fragment size 2048 - using 4 cylinder groups of 1.27MB, 81 blks, 256 inodes. +&prompt.root; bsdlabel -w md0 auto +&prompt.root; newfs md0a +/dev/md0a: 5.0MB (10224 sectors) block size 16384, fragment size 2048 + using 4 cylinder groups of 1.25MB, 80 blks, 192 inodes. super-block backups (for fsck -b #) at: - 32, 2624, 5216, 7808 -&prompt.root; mount /dev/md0c /mnt + 160, 2720, 5280, 7840 +&prompt.root; mount /dev/md0a /mnt &prompt.root; df /mnt -Filesystem 1K-blocks Used Avail Capacity Mounted on -/dev/md0c 4846 2 4458 0% /mnt +Filesystem 1K-blocks Used Avail Capacity Mounted on +/dev/md0a 4710 4 4330 0% /mnt If you do not specify the unit number with the @@ -3066,14 +3066,6 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on md4. For more details about &man.mdconfig.8;, please refer to the manual page. - Since &os; 5.1-RELEASE, the &man.bsdlabel.8; - utility replaces the old &man.disklabel.8; program. With - &man.bsdlabel.8; a number of obsolete options and parameters - have been retired; in the example above the option - should be removed. For more - information, please refer to the &man.bsdlabel.8; - manual page. - The utility &man.mdconfig.8; is very useful, however it asks many command lines to create a file-backed file system. FreeBSD 5.0 also comes with a tool called &man.mdmfs.8;, @@ -3091,7 +3083,7 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on &prompt.root; mdmfs -F newimage -s 5m md0 /mnt &prompt.root; df /mnt Filesystem 1K-blocks Used Avail Capacity Mounted on -/dev/md0 4846 2 4458 0% /mnt +/dev/md0 4718 4 4338 0% /mnt If you use the option without unit @@ -3132,50 +3124,49 @@ Filesystem 1K-blocks Used Avail Capacity Mounted on - Memory-Based File System under FreeBSD 5.X + Memory-Based File System disks - memory file system (5.X) + memory file system The same tools are used for memory-based and file-backed - file systems: &man.mdconfig.8; or &man.mdmfs.8;. The storage - for memory-based file system is allocated with - &man.malloc.9;. + file systems: &man.mdconfig.8; or &man.mdmfs.8;. For a + memory-based file system the swap backing + should normally be used. Using swap backing does not mean + that the memory disk will be swapped out to disk by default, + but merely that the memory disk will be allocated from a + memory pool which can be swapped out to disk if needed. It is + also possible to create memory-based disk which are + &man.malloc.9; backed, but using malloc backed memory disks, + especially large ones, can result in a system panic if the + kernel runs out of memory. Creating a New Memory-Based Disk with <command>mdconfig</command> - &prompt.root; mdconfig -a -t malloc -s 5m -u 1 + &prompt.root; mdconfig -a -t swap -s 5m -u 1 &prompt.root; newfs -U md1 /dev/md1: 5.0MB (10240 sectors) block size 16384, fragment size 2048 - using 4 cylinder groups of 1.27MB, 81 blks, 256 inodes. - with soft updates + using 4 cylinder groups of 1.27MB, 81 blks, 192 inodes. + with soft updates super-block backups (for fsck -b #) at: - 32, 2624, 5216, 7808 + 160, 2752, 5344, 7936 &prompt.root; mount /dev/md1 /mnt &prompt.root; df /mnt Filesystem 1K-blocks Used Avail Capacity Mounted on -/dev/md1 4846 2 4458 0% /mnt +/dev/md1 4718 4 4338 0% /mnt Creating a New Memory-Based Disk with <command>mdmfs</command> - &prompt.root; mdmfs -M -s 5m md2 /mnt + &prompt.root; mdmfs -s 5m md2 /mnt &prompt.root; df /mnt Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/md2 4846 2 4458 0% /mnt - - Instead of using a &man.malloc.9; backed file system, it is - possible to use swap, for that just replace - with in the - command line of &man.mdconfig.8;. The &man.mdmfs.8; utility - by default (without ) creates a swap-based - disk. For more details, please refer to &man.mdconfig.8; - and &man.mdmfs.8; manual pages.