⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lsg12.htm

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTM
📖 第 1 页 / 共 2 页
字号:




<BR>







<PRE>







<FONT COLOR="#000080">ls /dev/*rft*</FONT></PRE>







<P>which lists all raw floppy tape devices as shown in Figure 12.1. If several are listed, you may not need to make new devices. For a normal tape installation, there are four non-rewind floppy tape devices called /dev/nrft0, /dev/nrft1, /dev/nrft2, and /dev/nrft3, as well as four rewind devices called /dev/rft0, /dev/rft1, /dev/rft2, and /dev/rft3.







<BR>







<P><B> <A HREF="12LSG01.gif">Figure 12.1.</B>







<BR><B>QIC tape drives (and several other non-SCSI tape drives) have device </B><B>drivers starting with rst and nrst.</A></B>







<BR>







<P>If no floppy tape devices are currently installed, you must make them using the following commands:







<BR>







<PRE>







<FONT COLOR="#000080">mknod -m 666 /dev/nrft0 c 27 4







mknod -m 666 /dev/nrft1 c 27 5







mknod -m 666 /dev/nrft2 c 27 6







mknod -m 666 /dev/nrft3 c 27 7







mknod -m 666 /dev/rft0 c 27 0







mknod -m 666 /dev/rft1 c 27 1







mknod -m 666 /dev/rft2 c 27 2







mknod -m 666 /dev/rft3 c 27 3</FONT></PRE>







<P>The mknod command makes the proper device driver files (see <A HREF="lsg06.htm">Chapter 6</A>, &quot;Devices and Device Drivers&quot;). This command creates all eight character mode devices (four rewind and four non-rewind) with file permissions of 666 (see <A HREF="lsg17.htm">Chapter 17</A> &quot;System Names and Access Permissions&quot;), major device numbers of 27, and minor device numbers ranging from zero through three.







<BR>







<P>If you want to set up a symbolic link to the device /dev/ftape, issue the command







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">ln /dev/rft0 /dev/ftape</FONT></PRE>







<P>The use of a symbolic link lets you use the device name /dev/ftape to access the tape drive instead of having to type the name of whichever tape driver is needed. In other words, you are aliasing ftape to the proper driver. You also can link the non-rewind device to /dev/nftape using the command







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">ln /dev/nrft0 /dev/nftape</FONT></PRE>







<P>To install the device driver into the kernel, you must change to the source directory for the Linux kernel files (usually /usr/src/Linux) and issue the make command to rebuild the kernel:







<BR>







<PRE>







<FONT COLOR="#000080">cd /usr/src/Linux







make config</FONT></PRE>







<P>At one point in the make routine, you are asked whether you want to include QIC-117 tape support. Answer yes, and when the make routine asks for the value of NR_FTAPE_BUFFERS, answer 3. You do not have to install the QIC-02 support to use ftape, so answer no to that question (if it gets asked).







<BR>







<P>Finally, to rebuild the kernel properly, issue the following three commands:







<BR>







<PRE>







<FONT COLOR="#000080">make dep







make clean







make</FONT></PRE>







<P>Once the kernel has been rebuilt, copy it to the startup directory that holds your boot kernel (make a copy of the old kernel for safety's sake) and reboot your machine.







<BR>







<P>If your copy of the ftape program is provided only as source, you will have to compile the program. Use the makefile program included with the source to do the compiling. Most versions of the Linux distribution software include the compiled version of ftape, so you probably will not have to bother compiling the program.







<BR>







<P>To test the tape device, place a formatted tape in the drive and issue the command







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">mt -f /dev/rft0 rewind</FONT></PRE>







<P>If you get an error message about the device not being found, your device driver is not linked into the kernel or the device driver file is not properly set up. If you get a status message about the tape already being rewound or no message at all, the tape drive has been recognized.







<BR>







<BLOCKQUOTE>







<BLOCKQUOTE>







<HR ALIGN=CENTER>







<BR>







<NOTE>Some versions of ftape and the Linux kernel do not allow you to use the tape drive and floppy drive at the same time. If you try, the Linux kernel freezes. Reboot the machine and avoid using both devices at the same time.</NOTE>







<BR>







<HR ALIGN=CENTER>







</BLOCKQUOTE></BLOCKQUOTE>







<BR>







<A NAME="E68E69"></A>







<H3 ALIGN=CENTER>







<CENTER>







<FONT SIZE=5 COLOR="#FF0000"><B>Using the Tape Drive</B></FONT></CENTER></H3>







<BR>







<P>You can use the tape drive to backup and restore files using the standard tar commands, as well as cpio. For more information on using these commands, see <A HREF="lsg22.htm">Chapter 22</A>, &quot;Backup, Backup, Backup!&quot; As a quick guide, use the following instructions for making and restoring backups of your filesystems.







<BR>







<P>To create a backup of the complete filesystem on tape, use the command







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">tar cvf /dev/ftape /</FONT></PRE>







<P>for ftape tape devices, or







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">tar cvf /dev/rst0 /</FONT></PRE>







<P>for SCSI devices. These commands assume that the device exists in the /dev directory and is linked into the kernel. The c option creates the archive file; the v option tells tar to echo its actions to the screen for you to see, and the f option tells tar which device (/dev/ftape) to use for the file. The trailing slash shows the directory structure to backup (in this case, the entire filesystem). If you decide to back up the entire filesystem, you may want to unmount devices like CD-ROM drives first to prevent their contents from being saved, too. Figure 12.2 shows a tar command used to backup the ./mail directory to a tape device using the linked device driver /dev/tape. Each file that is placed on the tape is displayed on-screen because of the verbose (v) option.







<BR>







<P><B> <A HREF="12LSG02.gif">Figure 12.2.</B>







<BR><B>Using </B><B>tar</B><B> to back up a small directory to the tape device.</A></B>







<BR>







<P><A NAME="I2"></A>To restore an entire archive from tape (such as the entire filesystem created above), use the command







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">tar xvf /dev/ftape</FONT></PRE>







<P>or use /dev/rst0 for SCSI devices. In this case, the x option tells tar to extract the contents of the media; the v option tells tar to echo all messages to the screen, and the f option specifies the tar device (in this case /dev/ftape). Because no single files or directories are specified, tar extracts the entire contents of the tape and places them in the current directory position.







<BR>







<P>You can display the contents of a tar archive with the command







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">tar tvf /dev/ftape</FONT></PRE>







<P>(/dev/rst0 for SCSI tape drives), where t tells tar to show the contents, v is for a full display, and f is the device indicator. There are many more options and capabilities to tar, so see <A HREF="lsg22.htm">Chapter 22</A> for more information.







<BR>







<BR>







<A NAME="E68E70"></A>







<H3 ALIGN=CENTER>







<CENTER>







<FONT SIZE=5 COLOR="#FF0000"><B>Summary</B></FONT></CENTER></H3>







<BR>







<P>More tape devices are being added to the Linux supported products list, including parallel-port and board-driven tape drives. If you already own one of these products, watch for a specific kernel driver for it. If you are planning to purchase a tape drive, check for Linux drivers first.







<BR>







<P>When you have a tape drive, you can be conscientious about making tape backups, and thus protecting your files and data. Losing an important file is very annoying, especially when a few minutes of your time could have saved the information for you. Tape drives are one of the easiest and inexpensive methods of making reliable backups. Every system should have one!







<P ALIGN=LEFT>























































</td>
</tr>
</table>

<!-- begin footer information -->



</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -