(itstool) path: sect1/indexterm
<primary>file systems</primary> <secondary>snapshots</secondary>
Context English Turkish (tr_TR) State
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.
The file system integrity checker, <citerefentry><refentrytitle>fsck</refentrytitle><manvolnum>8</manvolnum></citerefentry>, may be run on the snapshot. Assuming that the file system was clean when it was mounted, this should always provide a clean and unchanging result.
Running <citerefentry><refentrytitle>dump</refentrytitle><manvolnum>8</manvolnum></citerefentry> on the snapshot will produce a dump file that is consistent with the file system and the timestamp of the snapshot. <citerefentry><refentrytitle>dump</refentrytitle><manvolnum>8</manvolnum></citerefentry> can also take a snapshot, create a dump image, and then remove the snapshot in one command by using <option>-L</option>.
The snapshot can be mounted as a frozen image of the file system. To <citerefentry><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry> the snapshot <filename>/var/snapshot/snap</filename> run:
<prompt>#</prompt> <userinput>mdconfig -a -t vnode -o readonly -f /var/snapshot/snap -u 4</userinput>
<prompt>#</prompt> <userinput>mount -r /dev/md4 /mnt</userinput>


No matching activity found.

Browse all component changes


English Turkish (tr_TR)
base system temel sistem FreeBSD Doc
credential file kimlik bilgileri dosyası FreeBSD Doc
Extended (Ext) File System Genişletilmiş Dosya Sistemi FreeBSD Doc
file system dosya sistemi FreeBSD Doc
host system ana bilgisayar sistemi FreeBSD Doc
log file sistem günlük dosyası FreeBSD Doc
native file system yerel dosya sistemi FreeBSD Doc
network file system ağ dosya sistemi FreeBSD Doc
operating system işletim sistemi FreeBSD Doc
plain text file düz metin dosyası FreeBSD Doc
snapshot anlık FreeBSD Doc
supported file system desteklenen dosya sistemi FreeBSD Doc
swap file getir götür kütüğü FreeBSD Doc
system administration Sistem Yönetimi FreeBSD Doc
system call sistem çağrısı FreeBSD Doc
system collapsing sistem çökmesi FreeBSD Doc

Source information

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