1,705 瀏覽數

mtools

Step 1.首先安裝 mtools 套件
Step 2.使用 mtools
Step 3.mtools 設定檔 /etc/mtools.conf
Step 4. mtools 常用的指令

Step 1.首先安裝 mtools 套件

在RedHat第二片光碟中 /RedHat/RPMS/mtools-3.9.8-2.i386.rpm

[root@benjr ~]# mount /mnt/cdrom
[root@benjr ~]# rpm -ivh /mnt/cdrom/RedHat/PRMS/mtools-3.9.8-2.i386.rpm

要注意的是 mtools 只是指令不是一個 service

Step 2.使用 mtools

以下幾點是要注意的

  1. mtools 只對FAT 的分割磁區有效,也就是我們可以用 a:  c: 代表磁碟機(分割區).
  2. 對於FAT的分割磁區,就不再需要掛載(mount)了.
  3. mtools 的指令只要在DOS指令前加上m.

Step 3.mtools 設定檔 /etc/mtools.conf

[root@benjr ~]# vi /etc/mtools.conf
# Example mtools.conf files.  Uncomment the lines which correspond to
# your architecture and comment out the "SAMPLE FILE" line below
# Linux floppy drives
drive a: file="/dev/fd0" exclusive mformat_only
drive b: file="/dev/fd1" exclusive mformat_only
# First SCSI hard disk partition
#drive c: file="/dev/sda1"
# First IDE hard disk partition
#drive c: file="/dev/hda1"
# # dosemu floppy image
# drive m: file="/var/lib/dosemu/diskimage"
# dosemu hdimage
drive n: file="/var/lib/dosemu/hdimage" offset=8832
# # Atari ramdisk image
# drive o: file="/tmp/atari_rd" offset=136
# # ZIP disk for Solaris:
# Drive X is ZIP-100 at target 5
# drive X: file="/dev/rdsk/c0t5d0s2" partition=4 scsi=1 nodelay
# # ZIP disk for SunOS:
# # Zip drive is at target 5, which default kernel calls tape st1 !!
# drive Y: file="/dev/rsd5c" partition=4 scsi=1 nodelay
# # autoselect zip drive/floppy on HP-UX 9/10
#    drive a: file="/dev/rdsk/c201d5"      exclusive partition=4
#    drive a: file="/dev/rdsk/c201d5s0"    exclusive partition=4
#    drive a: file="/dev/rfloppy/c201d0s0" exclusive
#          A/UX target 5 on 1st scsi bus   jaz or zip
# drive X: file="/dev/rdsk/c105d0s31"      partition=4

# Some examples for BeOS.
# floppy drive. hardcoded in devices.c, so no real need to define it here
#drive a: file="/dev/floppy_disk" exclusive
# ZIP drive on SCSI ID 6
#drive z: file="/dev/scsi_disk_060" offset=16384 fat_bits=16                       
# SCO Unix 3.2v4
# # Floppy disk drives
#
# drive a: file="/dev/install" exclusive
# drive b: file="/dev/install1" exclusive
# 
# # SCSI hard disk partitions
# 
# drive c: file="/dev/dsk/0sC"
# drive d: file="/dev/dsk/0sD"
# drive e: file="/dev/dsk/0sE"
# drive f: file="/dev/dsk/0sF"
# drive g: file="/dev/dsk/0sG"
# drive h: file="/dev/dsk/0sH"
# # uncomment the following line to display all file names in lower
# # case by default
# mtools_lower_case=1

設定檔只有磁碟機 a: , b: 的定義
drive a: file="/dev/fd0" exclusive mformat_only
drive b: file="/dev/fd1" exclusive mformat_only
如果你的磁區有其他 FAT 格式的分割區,則還要再額外指定
drive c: file="/dev/hda4"
則可以用 c: 來代表 /dev/hda4 分割區

Step 4. mtools 常用的指令

mcd , mcopy , mdel , mdeltree , mdir , mformat , minfo , mmd , mmount , mrd , mmove , mren , mtype
以上的指令都是指向 mtools 這支程式的 soft link
範例:

  1. 列出磁碟機的內容
    [root@benjr ~]# mdir a:
    Volume in drive A has no label
    Volume Serial Number is B093-6D0D
    Directory for A:/
    COMMAND  COM      94282 06-18-1998  20:01 
    FDISK           EXE        64124 05-06-1999   6:22
    FORMAT       COM      49655 05-05-1999  22:22 
    AUTOEXEC   BAT        7 10-24-2002  20:25
           11 files             714 446 bytes
                                   445 440 bytes free
    
  2. 複製檔案至磁碟機
    [root@benjr ~]# mcopy text.txt a:
    

發表迴響