藍澄灣業主社群

標題: 有冇linux 高手 [打印本頁]

作者: Stephen@RC    時間: 2005-8-15 22:27:41     標題: 有冇linux 高手

請問有冇人知點比linux detect 到 USB Harddisk ??


thanks
作者: 貓貓仔 貓貓女    時間: 2005-8-15 23:18:59

喵~
首先要load module 先:
1. Run as superuser-----~$su <root password>
2. Load module----~#modprobe usb-storage

跟住插usb-device 睇o下有冇dectect 到:
3. Check log-----~#dmesg
最尾哥幾行應該見到話detect 到usb-device

最後mount usb-drive 到個mount point到:
4. Create mount point------~#mkdir ~/usb-drive; chmod 777 ~/usb-drive
5. Mount device-----
   a. 如果係舊式 /dev 就要試:
       mount -t vfat /dev/sda0 ~/usb-drive  or
       mount -t vfat /dev/sda1 ~/usb-drive  or
       mount -t vfat /dev/sdb0 ~/usb-drive  or
       mount -t vfat /dev/sda1 ~/usb-drive
    b. 如果係新式 devfs 係/dev directory 會多o左sda 或sdb 再 cd 入去睇o下係 0 or 1  然後
        mount -t vfat /dev/sdx0 ~/usb-drive  or
        mount -t vfat /dev/sdx1 ~/usb-drive
作者: Stephen@RC    時間: 2005-8-16 10:04:23

thanks ..

i want to install redhat9 on a usb harddisk using the installer.
However it cannot detect the usb harddisk so that i cant intall it on the right hd .

any idea ? thanks
作者: 貓貓仔 貓貓女    時間: 2005-8-16 15:20:28

喵~
咁就要先裝好個linux 係local drive 先 再mount o左隻usb harddisk /opt/usb-drive (用上述方法) 再format 埋佢 然後抄所有野入去:
1. ~#fdisk /dev/sda   (creat linux native(83) & swap(82) partition 分別係sda1 & sda2 記得用按command a 去activate sda1 o既 bootable flag 再按command w 儲存)
2. ~#mke2fs -j /dev/sda1 (format w/ ext3 journal)
    ~#mkswap /dev/sda2   (format swap partition)
    ~#mount /dev/sda1 /opt/usb-drive  (mount usb-device)
3. ~#cd /
    ~#cp -ax . /opt/usb-drive (抄晒所有野去usb-drive 要等幾耐o下)

做module image file 改fstab 改linux loader o既 config file:
4. ~#cd /boot
    ~#mkinitrd --preload=usb-storage --preload=usb-uhci --preload=scsi_mod usb-initrd.img 2.4.xx<version>
5. 改/opt/usb-drive/etc/fstab 通常係第一行:
    LABEL=/     /  ext3 defaults 1  1  --- >
    /dev/sda1   /  ext3 defaults 1  1   
6. 改 /opt/usb-drive/etc/lilo.conf 裡面幾句:
    disk=/dev/sda1 bios=0x80  ##(Treat as 1st pri harddisk)
    boot=/dev/sda
    map=/opt/usb-drive/boot/map
    install=/opt/usb-drive/boot/boot.b
    image=/opt/usb-drive/boot/vmlinuz
    initrd=/opt/usb-drive/boot/usb-initrd.img
    root=/dev/sda1
    同埋所有舊path 都要改 /boot --> /opt/usb-drive/boot
7. ~#lilo -v -v -C /opt/usb-drive/etc/lilo.conf    (Update LILO to usb harddisk)
   
最後息機 拆o左local harddisk 插usb-harddisk 再開機....成功o既話就改番/etc/lilo.conf o既path: /opt/usb-drive/boot --> /boot 同埋改其中一行:
8. disk=/dev/sda1 bios=0x80  --> disk=/dev/sda1
9. ~#lilo -v -v    (Update LILO to usb harddisk)

再reboot 幾次睇o下正唔正常.......
作者: Stephen@RC    時間: 2005-8-16 16:36:01

very detail

thanks 貓貓仔&貓貓女
作者: Stephen@RC    時間: 2005-8-28 10:22:10

[quote:cae44020c9="貓貓仔&貓貓女"]喵~
咁就要先裝好個linux 係local drive 先 再mount o左隻usb harddisk /opt/usb-drive (用上述方法) 再format 埋佢 然後抄所有野入去:
1. ~#fdisk /dev/sda   (creat linux native(83) & swap(82) partition 分別係sda1 & sda2 記得用按command a 去activate sda1 o既 bootable flag 再按command w 儲存)
2. ~#mke2fs -j /dev/sda1 (format w/ ext3 journal)
    ~#mkswap /dev/sda2   (format swap partition)
    ~#mount /dev/sda1 /opt/usb-drive  (mount usb-device)
3. ~#cd /
    ~#cp -ax . /opt/usb-drive (抄晒所有野去usb-drive 要等幾耐o下)

做module image file 改fstab 改linux loader o既 config file:
4. ~#cd /boot
    ~#mkinitrd --preload=usb-storage --preload=usb-uhci --preload=scsi_mod usb-initrd.img 2.4.xx<version>
5. 改/opt/usb-drive/etc/fstab 通常係第一行:
    LABEL=/     /  ext3 defaults 1  1  --- >
    /dev/sda1   /  ext3 defaults 1  1   
6. 改 /opt/usb-drive/etc/lilo.conf 裡面幾句:
    disk=/dev/sda1 bios=0x80  ##(Treat as 1st pri harddisk)
    boot=/dev/sda
    map=/opt/usb-drive/boot/map
    install=/opt/usb-drive/boot/boot.b
    image=/opt/usb-drive/boot/vmlinuz
    initrd=/opt/usb-drive/boot/usb-initrd.img
    root=/dev/sda1
    同埋所有舊path 都要改 /boot --> /opt/usb-drive/boot
7. ~#lilo -v -v -C /opt/usb-drive/etc/lilo.conf    (Update LILO to usb harddisk)
   
最後息機 拆o左local harddisk 插usb-harddisk 再開機....成功o既話就改番/etc/lilo.conf o既path: /opt/usb-drive/boot --> /boot 同埋改其中一行:
8. disk=/dev/sda1 bios=0x80  --> disk=/dev/sda1
9. ~#lilo -v -v    (Update LILO to usb harddisk)

再reboot 幾次睇o下正唔正常.......[/quote]

hi 貓貓仔&貓貓女
i tried to mount the usb harddisk but failed .
there are both /dev/sda and /dev/sdb but both are not directory.
how can i know use 0 or 1 ?

fdisk /dev/sda   is to format the usb harddisk ?
why not fdisk /opt/usb-harddisk then ?


thanks a lot
作者: 貓貓仔 貓貓女    時間: 2005-8-29 01:28:17

喵~
Re: i tried to mount the usb harddisk but failed .
Ans:首先你要make sure load o左必要o既modules
~#lsmod|grep usb
睇o下有冇usb-storage usb_uhci scsi_mod usbcore 冇o既話就要load...
~#modprobe usb_uhci
~#modprobe usb-storage
~#modprobe usbcore
~#modprobe scsi_mod

Re:there are both /dev/sda and /dev/sdb but both are not directory.
how can i know use 0 or 1 ?

Ans:其實/dev/sda /dev/sdb 係block device 你可以當佢係電腦o既各種device:
/dev/fd0=第一個floppy
/dev/hda1=第一個ide harddisk 第一個 partition
/dev/hda2=第一個ide harddisk 第二個 partition
/dev/sda=第一條scsi channel id0 lun0 o既harddisk
/dev/sda1=第一條scsi channel id0 lun0 o既harddisk o既第一個 partition
至於第一個usb harddisk 正常黎講會map 係/dev/sda1 你可以插o左usb harddisk 後打 ~#dmesg 睇o下
/dev/sda0 係冇o既 sorry..... 因為貓貓理解錯o左.....睇0 or 1 係要有devfs 先有用:
/dev/scsi/host0/bus0/target0/lun0/disc=第一條scsi channel id0 lun0 o既harddisk

Re:fdisk /dev/sda is to format the usb harddisk ? why not fdisk /opt/usb-harddisk then ?
Ans:fdisk 後o既參數係<device> /opt/usb-harddisk 唔係device 而係mount point 所以呢個command "fdisk /opt/usb-harddisk" 係錯o既!!
要重新fdisk format 過係因為要用linux natvie filesystem "ext3 fs"

p.s. 重有呀 想用usb-drive boot 機要bios support 先得o架 如果唔係就要用floppy boot 啦!! 如有錯漏 請多多包涵!!




歡迎光臨 藍澄灣業主社群 (http://rcrest.bzone.com.hk/discuz/) Powered by Discuz! X2