(itstool) path: sect2/para
To instead create a new memory-based memory disk with <command>mdmfs</command>, use this one command:
Context English Turkish (tr_TR) State
<primary>disks</primary> <secondary>detaching a memory disk</secondary>
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 <command>mdconfig</command> to detach the disk from the system and release its resources. To continue this example:
<prompt>#</prompt> <userinput>umount /mnt</userinput>
<prompt>#</prompt> <userinput>mdconfig -d -u <replaceable>0</replaceable></userinput>
To determine if any memory disks are still attached to the system, type <command>mdconfig -l</command>.
Creating a File- or Memory-Backed Memory Disk
<primary>disks</primary> <secondary>memory file system</secondary>
FreeBSD also supports memory disks where the storage to use is allocated from either a hard disk or an area of memory. The first method is commonly referred to as a file-backed file system and the second method as a memory-backed file system. Both types can be created using <command>mdconfig</command>.
To create a new memory-backed file system, specify a type of <literal>swap</literal> and the size of the memory disk to create. Then, format the memory disk with a file system and mount as usual. This example creates a 5M memory disk on unit <literal>1</literal>. That memory disk is then formatted with the <acronym>UFS</acronym> file system before it is mounted:
<prompt>#</prompt> <userinput>mdconfig -a -t swap -s <replaceable>5</replaceable>m -u <replaceable>1</replaceable></userinput>
<prompt>#</prompt> <userinput>newfs -U md<replaceable>1</replaceable></userinput>
/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>#</prompt> <userinput>mount /dev/md<replaceable>1</replaceable> <replaceable>/mnt</replaceable></userinput>
<prompt>#</prompt> <userinput>df <replaceable>/mnt</replaceable></userinput>
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/md1 4718 4 4338 0% /mnt
To create a new file-backed memory disk, first allocate an area of disk to use. This example creates an empty 5MB file named <filename>newimage</filename>:
<prompt>#</prompt> <userinput>dd if=/dev/zero of=<replaceable>newimage</replaceable> bs=1k count=<replaceable>5</replaceable>k</userinput>
5120+0 records in
5120+0 records out
Next, attach that file to a memory disk, label the memory disk and format it with the <acronym>UFS</acronym> file system, mount the memory disk, and verify the size of the file-backed disk:
<prompt>#</prompt> <userinput>mdconfig -f <replaceable>newimage</replaceable> -u <replaceable>0</replaceable></userinput>
<prompt>#</prompt> <userinput>bsdlabel -w md<replaceable>0</replaceable> auto</userinput>
<prompt>#</prompt> <userinput>newfs -U md<replaceable>0</replaceable>a</userinput>
/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:
160, 2720, 5280, 7840
<prompt>#</prompt> <userinput>mount /dev/md<replaceable>0</replaceable>a <replaceable>/mnt</replaceable></userinput>
<prompt>#</prompt> <userinput>df <replaceable>/mnt</replaceable></userinput>
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/md0a 4710 4 4330 0% /mnt
It takes several commands to create a file- or memory-backed file system using <command>mdconfig</command>. FreeBSD also comes with <command>mdmfs</command> which automatically configures a memory disk, formats it with the <acronym>UFS</acronym> file system, and mounts it. For example, after creating <replaceable>newimage</replaceable> with <command>dd</command>, this one command is equivalent to running the <command>bsdlabel</command>, <command>newfs</command>, and <command>mount</command> commands shown above:
<prompt>#</prompt> <userinput>mdmfs -F <replaceable>newimage</replaceable> -s <replaceable>5</replaceable>m md<replaceable>0</replaceable> <replaceable>/mnt</replaceable></userinput>
To instead create a new memory-based memory disk with <command>mdmfs</command>, use this one command:
<prompt>#</prompt> <userinput>mdmfs -s <replaceable>5</replaceable>m md<replaceable>1</replaceable> <replaceable>/mnt</replaceable></userinput>
If the unit number is not specified, <command>mdmfs</command> will automatically select an unused memory device. For more details about <command>mdmfs</command>, refer to <citerefentry><refentrytitle>mdmfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
File System Snapshots
<primary>file systems</primary> <secondary>snapshots</secondary>
FreeBSD offers a feature in conjunction with <link linkend="soft-updates">Soft Updates</link>: file system snapshots.
UFS snapshots allow a user to create images of specified file systems, and treat them as a file. Snapshot files must be created in the file system that the action is performed on, and a user may create no more than 20 snapshots per file system. Active snapshots are recorded in the superblock so they are persistent across unmount and remount operations along with system reboots. When a snapshot is no longer required, it can be removed using <citerefentry><refentrytitle>rm</refentrytitle><manvolnum>1</manvolnum></citerefentry>. While snapshots may be removed in any order, all the used space may not be acquired because another snapshot will possibly claim some of the released blocks.
The un-alterable <option>snapshot</option> file flag is set by <citerefentry><refentrytitle>mksnap_ffs</refentrytitle><manvolnum>8</manvolnum></citerefentry> after initial creation of a snapshot file. <citerefentry><refentrytitle>unlink</refentrytitle><manvolnum>1</manvolnum></citerefentry> makes an exception for snapshot files since it allows them to be removed.
Snapshots are created using <citerefentry><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>. To place a snapshot of <filename>/var</filename> in the file <filename>/var/snapshot/snap</filename>, use the following command:
<prompt>#</prompt> <userinput>mount -u -o snapshot /var/snapshot/snap /var</userinput>
Alternatively, use <citerefentry><refentrytitle>mksnap_ffs</refentrytitle><manvolnum>8</manvolnum></citerefentry> to create the snapshot:
<prompt>#</prompt> <userinput>mksnap_ffs /var /var/snapshot/snap</userinput>
One can find snapshot files on a file system, such as <filename>/var</filename>, using <citerefentry><refentrytitle>find</refentrytitle><manvolnum>1</manvolnum></citerefentry>:
<prompt>#</prompt> <userinput>find /var -flags snapshot</userinput>
Once a snapshot has been created, it has several uses:
Some administrators will use a snapshot file for backup purposes, because the snapshot can be transferred to <acronym>CD</acronym>s or tape.


No matching activity found.

Browse all component changes


English Turkish (tr_TR)
base system temel sistem FreeBSD Doc
boot disk önyükleme diski FreeBSD Doc
command komut FreeBSD Doc
command komut FreeBSD Doc
command line komut satırı FreeBSD Doc
disk space disk alanı FreeBSD Doc
memory hafıza,bellek FreeBSD Doc
virtual memory sanal bellek FreeBSD Doc

Source information

Source string comment
(itstool) path: sect2/para
Source string location
String age
8 months ago
Source string age
a year ago
Translation file
books/tr_TR/handbook.po, string 5999