catinsunshine 发表于 2005-11-16 09:03:35

REDHAT9.0使用U盘和MP3(SCSI)之全程攻略

在REDHAT9.0中使用U盘(USB)和MP3对我这个菜鸟来说一直是个老大难.在LINUX社区中看了些贴子,介绍的不是很全面.一知半解,不能解决我的MP3的挂载问题.连好MP3和电脑,看到连接状态正常,和在WINDOWS中一样,但不能识别使用.经过摸索思考,终于如愿以偿.咱们老百姓啊,今个真高兴,真高兴呀,真高兴.嘿嘿.OK.言归正传,为学习研究之便,将过程以添加注释方式原封不动展示如下:
# mount /dev/hda9 /mnt/harddiskf   #这是我的WINDOWS中个F盘,FAT32格式,挂载到/mnt/harddiskf目录下
# mkdir /mnt/usb                   #建立USB文件夹,以便将U盘内容挂载到此文件夹做准备
# dmesg|grep -i usb            #dmesg显示启动信息. 执行结果为空.没有USB设备加载信息.
# modprobe usb-uhci             #以下两条命令加载USB的驱动模块.
# modprobe usb-storage         #usb-uhci/usb-storage为USB的驱动模块.可用lsmod查看加载的模块内容
# fdisk -l /dev/sd?            #显示U盘加载后对应硬盘上的设备文件.

Disk /dev/sda: 125 MB, 125682176 bytes             #显示对应的位置为sda设备文件
4 heads, 60 sectors/track, 1022 cylinders
Units = cylinders of 240 * 512 = 122880 bytes

   Device Boot    Start       End    Blocks   IdSystem
/dev/sda1   ?   3242233   7998524 570754815+72Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
   phys=(357, 116, 40) logical=(3242232, 3, 49)
Partition 1 has different physical/logical endings:
   phys=(357, 32, 45) logical=(7998523, 0, 19)
Partition 1 does not end on cylinder boundary.
/dev/sda2   ?    702874   8769658 968014120   65Novell Netware 386
Partition 2 has different physical/logical beginnings (non-Linux?):
   phys=(288, 115, 43) logical=(702873, 0, 3)
Partition 2 has different physical/logical endings:
   phys=(367, 114, 50) logical=(8769657, 1, 22)
Partition 2 does not end on cylinder boundary.
/dev/sda3   ?   779117315857957 968014096   79Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
   phys=(366, 32, 33) logical=(7791172, 3, 6)
Partition 3 has different physical/logical endings:
   phys=(357, 32, 43) logical=(15857956, 3, 37)
Partition 3 does not end on cylinder boundary.
/dev/sda4   ?         115155111 1818613248    dUnknown
Partition 4 has different physical/logical beginnings (non-Linux?):
   phys=(372, 97, 50) logical=(0, 0, 1)
Partition 4 has different physical/logical endings:
   phys=(0, 10, 0) logical=(15155110, 1, 36)
Partition 4 does not end on cylinder boundary.

Partition table entries are not in disk order
# fdisk -l dev/sda             #dev前没加/,sda后没加空格致命令运行错误.常见错误.
# fdisk -l /dev/sda            #正确的命令

Disk /dev/sda: 125 MB, 125682176 bytes
4 heads, 60 sectors/track, 1022 cylinders
Units = cylinders of 240 * 512 = 122880 bytes

   Device Boot    Start       End    Blocks   IdSystem
/dev/sda1   ?   3242233   7998524 570754815+72Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
   phys=(357, 116, 40) logical=(3242232, 3, 49)
Partition 1 has different physical/logical endings:
   phys=(357, 32, 45) logical=(7998523, 0, 19)
Partition 1 does not end on cylinder boundary.
/dev/sda2   ?    702874   8769658 968014120   65Novell Netware 386
Partition 2 has different physical/logical beginnings (non-Linux?):
   phys=(288, 115, 43) logical=(702873, 0, 3)
# fdisk -l                #显示所有已经加载的设备文件

Disk /dev/sda: 125 MB, 125682176 bytes
4 heads, 60 sectors/track, 1022 cylinders
Units = cylinders of 240 * 512 = 122880 bytes

   Device Boot    Start       End    Blocks   IdSystem
/dev/sda1   ?   3242233   7998524 570754815+72Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
   phys=(357, 116, 40) logical=(3242232, 3, 49)
Partition 1 has different physical/logical endings:
   phys=(357, 32, 45) logical=(7998523, 0, 19)
Partition 1 does not end on cylinder boundary.
/dev/sda2   ?    702874   8769658 968014120   65Novell Netware 386
Partition 2 has different physical/logical beginnings (non-Linux?):
   phys=(288, 115, 43) logical=(702873, 0, 3)
Partition 2 has different physical/logical endings:
   phys=(367, 114, 50) logical=(8769657, 1, 22)
Partition 2 does not end on cylinder boundary.
/dev/sda3   ?   779117315857957 968014096   79Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
   phys=(366, 32, 33) logical=(7791172, 3, 6)
Partition 3 has different physical/logical endings:
   phys=(357, 32, 43) logical=(15857956, 3, 37)
Partition 3 does not end on cylinder boundary.
/dev/sda4   ?         115155111 1818613248    dUnknown
Partition 4 has different physical/logical beginnings (non-Linux?):
   phys=(372, 97, 50) logical=(0, 0, 1)
Partition 4 has different physical/logical endings:
   phys=(0, 10, 0) logical=(15155110, 1, 36)
Partition 4 does not end on cylinder boundary.

Partition table entries are not in disk order

Disk /dev/hda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   IdSystem
/dev/hda1             1      1020   8193118+   bWin95 FAT32
/dev/hda2          1021      486530884962+   fWin95 Ext'd (LBA)
/dev/hda5          1021      229510241406    bWin95 FAT32
/dev/hda6          2296      2958   5325516    bWin95 FAT32
/dev/hda7          2959      3220   2104483+82Linux swap
/dev/hda8   *      3221      3570   2811343+83Linux
/dev/hda9          3571      486510402056    bWin95 FAT32
# mount -t msdos /dev/sda1 /mnt/usb      #加载系统格式错误.不是MSDOS
mount: wrong fs type, bad option, bad superblock on /dev/sda1,
       or too many mounted file systems
# mount -t msdos /dev/sda2 /mnt/usb      #试用设备文件sda2,结果失败
mount: ?????
# cd /mnt/usb                         #进入文件夹/mnt/usb,可用 mkdir /mnt/usb建立.
# ls                                 #ls显示usb文件夹内容.结果为空.加载MP3失败.
# cd ..                               #退出usb进入mnt文件夹
# modprobe scsi_mod                   #加载scsi_mod驱动模块**成功关键.我的MP3是SCSI硬盘**
# modprob sd_mod                     #加载sd_mod 驱动模块,不清楚这个模块的作用.看网上有加的.
bash: modprob: command not found                           #modprobe少加了一个e,命令运行错误.
# modprobe sd_mod                  #正确命令
# cat /proc/scsi/scsi                     #用cat命令查看文件内容.
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: GENERICModel: USB DISK DEVICERev: 1.00    #O?看到USB DISK DEVICE,莫非这就是MP3?
Type:   Direct-Access             ANSI SCSI revision: 02    # 果然是SCSI硬盘.失败,现在才知道MP3的是SCSI格式的.汗!
# lsmod                              #显示已加载的模块
Module                  SizeUsed by    Not tainted
msdos                   8140   0(autoclean)
sd_mod               13516   0(autoclean)             #sd_mod模块    | 最关键的四个模块
usb-storage            69332   0                         #usb-storage模块 | 看来前的努力没白费   
scsi_mod            107160   2   #scsi_mod模块   |回忆一下加载命令:
usb-uhci               26348   0(unused)                #usb-uhci模块   |   modprobe 模块名   
usbcore                78784   0
nls_iso8859-1         3516   1(autoclean)
nls_cp437               5116   1(autoclean)
vfat                   13004   1(autoclean)
fat                  38808   0(autoclean)
i810_audio             27720   1(autoclean)
ac97_codec             13640   0(autoclean)
soundcore               6404   2(autoclean)
mousedev                5492   1(autoclean)
input                   5856   0(autoclean)
parport_pc             19076   1(autoclean)
lp                      8996   0(autoclean)
parport                37056   1(autoclean)
autofs               13268   0(autoclean) (unused)
ipt_REJECT            3928   6(autoclean)
iptable_filter          2412   1(autoclean)
ip_tables            15096   2
ext3                   70784   1
jbd                  51892   1
# fdisk -l /dev/sd?                  #再看一下               

Disk /dev/sda: 125 MB, 125682176 bytes
4 heads, 60 sectors/track, 1022 cylinders
Units = cylinders of 240 * 512 = 122880 bytes

   Device Boot    Start       End    Blocks   IdSystem
/dev/sda1   ?   3242233   7998524 570754815+72Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
   phys=(357, 116, 40) logical=(3242232, 3, 49)
Partition 1 has different physical/logical endings:
   phys=(357, 32, 45) logical=(7998523, 0, 19)
Partition 1 does not end on cylinder boundary.
/dev/sda2   ?    702874   8769658 968014120   65Novell Netware 386
Partition 2 has different physical/logical beginnings (non-Linux?):
   phys=(288, 115, 43) logical=(702873, 0, 3)
Partition 2 has different physical/logical endings:
   phys=(367, 114, 50) logical=(8769657, 1, 22)
Partition 2 does not end on cylinder boundary.
/dev/sda3   ?   779117315857957 968014096   79Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
   phys=(366, 32, 33) logical=(7791172, 3, 6)
Partition 3 has different physical/logical endings:
   phys=(357, 32, 43) logical=(15857956, 3, 37)
Partition 3 does not end on cylinder boundary.
# fdisk -l /dev/sda4               #sda1~3都不行,蒙个sda4试一下   

Disk /dev/sda4: 1862.2 GB, 1862259965952 bytes          #倒,还真有货唉!看来有戏.
4 heads, 60 sectors/track, 15155110 cylinders
Units = cylinders of 240 * 512 = 122880 bytes

   Device Boot    Start       End    Blocks   IdSystem
/dev/sda4p1   ?   3242233   7998524 570754815+72Unknown
Partition 1 does not end on cylinder boundary.
/dev/sda4p2   ?    702874   8769658 968014120   65Novell Netware 386
Partition 2 does not end on cylinder boundary.
/dev/sda4p3   ?   779117315857957 968014096   79Unknown
Partition 3 does not end on cylinder boundary.
/dev/sda4p4   ?         115155111 1818613248    dUnknown
Partition 4 does not end on cylinder boundary.

Partition table entries are not in disk order
# mount -t vfat /dev/sda4 /mnt/usb#MP3是fat32格式的,用vfat标示类型.我再蒙!
# cd usb                     #哇噻,没有错误提示耶!快进去看看!
# ls                           #显示文件
linuxmusic                                           #耶,嘿嘿,哈哈.天啊,我终于看到你了.成功了!


Ok.回过头来回顾一下,几个关键所在:
root@catinsunshine root]# dmesg|grep -i usb
# modprobe usb-uhci
# modprobe usb-storage
# modprobe sd_mod
# modprobe scsi_mod
# cat /proc/scsi/scsi
# fdisk -l /dev/sd?
# fdisk -l /dev/sda4
# mount -t vfat /dev/sda4 /mnt/usb
总结.一般来说如果,连接USB,redhat 不能识别是因为驱动模块没有加载.其中最关键的四个模块为:
usb-uhci/usb-storage/sd_mod/scsi_mod.

有个小问题如下:
控制中心-->信息-->SCSI 内容显示如下.(但在USB设备里看不到内容)
Attached devices:
Host:scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: GENERIC Model: USB DISK DEVICE Rev: 1.00
Type: Direct-Access            ANSI SCSI revision:02

catinsunshine 发表于 2005-11-16 16:21:17

晕,昨晚辛苦一夜,连个回复的也没有.我当时为解决这问题,头都大了.到处找资料.算了,我自己顶一下吧.

fuhuizn 发表于 2005-11-18 00:26:39

我用 FC2 都已经感到跟不上时代了!
老兄,要与时俱进!
这种问题到了 kernel-2.6 上就不再是问题了!

hellboy_zhang 发表于 2005-11-19 18:18:00

但是我一挂我的读卡器就。。。。。
页: [1]
查看完整版本: REDHAT9.0使用U盘和MP3(SCSI)之全程攻略