From owner-svn-doc-all@FreeBSD.ORG Thu Apr 24 18:24:49 2014 Return-Path: Delivered-To: svn-doc-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3621B3A8; Thu, 24 Apr 2014 18:24:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 220801CDD; Thu, 24 Apr 2014 18:24:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3OIOmlX070234; Thu, 24 Apr 2014 18:24:49 GMT (envelope-from dru@svn.freebsd.org) Received: (from dru@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3OIOmvB070233; Thu, 24 Apr 2014 18:24:48 GMT (envelope-from dru@svn.freebsd.org) Message-Id: <201404241824.s3OIOmvB070233@svn.freebsd.org> From: Dru Lavigne Date: Thu, 24 Apr 2014 18:24:48 +0000 (UTC) To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r44647 - head/en_US.ISO8859-1/books/handbook/disks X-SVN-Group: doc-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-doc-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire doc trees \(except for " user" , " projects" , and " translations" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Apr 2014 18:24:49 -0000 Author: dru Date: Thu Apr 24 18:24:48 2014 New Revision: 44647 URL: http://svnweb.freebsd.org/changeset/doc/44647 Log: Editorial review of Attaching and Detaching Existing Images. More commits to come to finish review of this chapter. Sponsored by: iXsystems Modified: head/en_US.ISO8859-1/books/handbook/disks/chapter.xml Modified: head/en_US.ISO8859-1/books/handbook/disks/chapter.xml ============================================================================== --- head/en_US.ISO8859-1/books/handbook/disks/chapter.xml Thu Apr 24 18:20:14 2014 (r44646) +++ head/en_US.ISO8859-1/books/handbook/disks/chapter.xml Thu Apr 24 18:24:48 2014 (r44647) @@ -1989,44 +1989,67 @@ scsibus1: In addition to physical disks, &os; also supports - the creation and use of memory disks. + the creation and use of memory disks. One possible use for a + memory disk is to access the contents of an + ISO file system without the overhead of first + burning it to a CD or DVD, + then mounting the CD/DVD media. + + In &os;, the &man.md.4; driver is used to provide support + for memory disks. The GENERIC kernel + includes this driver. When using a custom kernel + configuration file, ensure it includes this line: - - disks - memory - + device md Attaching and Detaching Existing Images disks - file-backed + memory - &man.mdconfig.8; is used to configure and enable memory - disks, &man.md.4;, under &os;. To use &man.mdconfig.8;, - &man.md.4; must be first loaded. When using a custom kernel - configuration file, ensure it includes this line: + To mount an existing file system image, use + mdconfig to specify the name of the + ISO file and a free unit number. Then, + refer to that unit number to mount it on an existing mount + point. Once mounted, the files in the ISO + will appear in the mount point. This example attaches + diskimage.iso to the memory device + /dev/md0 then mounts that memory device + on /mnt: - device md + &prompt.root; mdconfig -f diskimage.iso -u 0 +&prompt.root; mount /dev/md0 /mnt - &man.mdconfig.8; supports several types of memory backed - virtual disks: memory disks allocated with &man.malloc.9; and - memory disks using a file or swap space as backing. One - possible use is the mounting of CD - images. + If a unit number is not specified with + , mdconfig will + automatically allocate an unused memory device and output + the name of the allocated unit, such + as md4. Refer to &man.mdconfig.8; + for more details about this command and its options. + + When a memory disk is no + longer in use, its resources should be released back to + the system. First, unmount the file system, then use + mdconfig to detach the disk from the system and + release its resources. To continue this example: - To mount an existing file system image: + &prompt.root; umount /mnt +&prompt.root; mdconfig -d -u 0 - - Using <command>mdconfig</command> to Mount an Existing - File System Image + To determine if any memory disks are still attached to the + system, type mdconfig -l. + - &prompt.root; mdconfig -f diskimage.iso -u 0 -&prompt.root; mount /dev/md0 /mnt - + + Creating a Memory Disk + + disks + memory file system + To create a new file system image with &man.mdconfig.8;: @@ -2050,12 +2073,32 @@ Filesystem 1K-blocks Used Avail Capacity /dev/md0a 4710 4 4330 0% /mnt - If unit number is not specified with - , &man.mdconfig.8; uses the - &man.md.4; automatic allocation to select an unused device. - The name of the allocated unit will be output to stdout, such - as md4. Refer to &man.mdconfig.8; - for more details about. + For a memory-based file system, swap + backing should normally be used. This does not mean + that the memory disk will be swapped out to disk by default, + but rather 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 disks which are + &man.malloc.9; backed, but using large malloc backed memory + disks 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 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, 192 inodes. + with soft updates +super-block backups (for fsck -b #) at: + 160, 2752, 5344, 7936 +&prompt.root; mount /dev/md1 /mnt +&prompt.root; df /mnt +Filesystem 1K-blocks Used Avail Capacity Mounted on +/dev/md1 4718 4 4338 0% /mnt + While &man.mdconfig.8; is useful, it takes several command lines to create a file-backed file system. &os; also @@ -2087,58 +2130,6 @@ Filesystem 1K-blocks Used Avail Capacity disks detaching a memory disk - - When a memory-based or file-based file system is no - longer in use, its resources should be released back to - the system. First, unmount the file system, then use - &man.mdconfig.8; to detach the disk from the system and - release the resources. - - For example, to detach and free all resources used by - /dev/md4: - - &prompt.root; mdconfig -d -u 4 - - It is possible to list information about configured - &man.md.4; devices by running - mdconfig -l. - - - - Creating a Memory Disk - - - disks - memory file system - - - For a memory-based file system, swap - backing should normally be used. This does not mean - that the memory disk will be swapped out to disk by default, - but rather 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 disks which are - &man.malloc.9; backed, but using large malloc backed memory - disks 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 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, 192 inodes. - with soft updates -super-block backups (for fsck -b #) at: - 160, 2752, 5344, 7936 -&prompt.root; mount /dev/md1 /mnt -&prompt.root; df /mnt -Filesystem 1K-blocks Used Avail Capacity Mounted on -/dev/md1 4718 4 4338 0% /mnt - - Creating a New Memory-Based Disk with <command>mdmfs</command>