開発したアプリなど一覧

玄箱のバックアップその1、USBHDDマウント編

アフィリエイトリンクを含む場合があります

いい加減ディスク一個しか載ってない玄箱にすべてを任すのは怖いなと思ってきたのでバックアップを考えた。

幸い玄箱にはUSBポートが一個付いてるのでこいつを使うことにする。HDDを買う前に手持ちのHDDとUSB変換機を使って軽くテスト。ちょうど同期を取るコマンドであるrsyncがある。マウントさせてcronでrsync動かすのが楽ちんだろう。

# modprobe ehci-hcd # modprobe usb-storage

usb関連のブツはデフォルトではロードされてないらしいので手動でロードしよう。そしてdmesg

# dmesg ..... USB Mass Storage support registered. hub.c: new USB device 00:0e.2-2, assigned address 2 scsi0 : SCSI emulation for USB Mass Storage devices Vendor: QUANTUM Model: FIREBALL EX6.4A Rev: 0811 Type: Direct-Access ANSI SCSI revision: 02

やっぱりSCSIエミュレーションするのか。

# mount -t usbfs none /proc/bus/usb # mount /dev/hda1 on / type ext3 (rw,noatime,errors=remount-ro) proc on /proc type proc (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/hda3 on /mnt type ext3 (rw,noatime) none on /proc/bus/usb type usbfs (rw)

おkかな、次はfdiskでパーティション切る。

# fdisk /dev/sda su: fdisk: command not found

fdiskがなかった。aptitudeでpmac-fdiskをつっこんどいた。

# amiga-fdisk /dev/sda Command (m for help): p Disk /dev/sda: 199 heads, 62 sectors, 1020 cylinders, RDB: 0 Logical Cylinders from 2 to 1019, 6317056 bytes/Cylinder Device Boot Mount Begin End Size Pri BBlks System Command (m for help): n block 2 is free. Device Boot Mount Begin End Size Pri BBlks System Partition number: 1 block 2 is free. Creating new partition entry at block 2. Low Cylinder: 2 High Cylinder: 1019 Command (m for help): p Disk /dev/sda: 199 heads, 62 sectors, 1020 cylinders, RDB: 0 Logical Cylinders from 2 to 1019, 6317056 bytes/Cylinder Device Boot Mount Begin End Size Pri BBlks System /dev/sda1 * 2 1019 6280042 0 0 0x444f5301 = DOS1 Amiga FFS Command (m for help): q # mkfs.ext3 /dev/sda1 mke2fs 1.27 (8-Mar-2002) ..... 180 days, whichever comes first. Use tune2fs -c or -i to override. # mkdir /mnt/usbhdd # mount /dev/sda1 /mnt/usbhdd # df Filesystem 1k-blocks Used Available Use% Mounted on /dev/hda1 2063504 333008 1625676 18% / /dev/hda3 238046172 52290352 185755820 22% /mnt /dev/sda1 6190664 32828 5843368 1% /mnt/usbhdd

これでおk、あとは自動マウントだ。/etc/rc.2d/S99usbmountファイルを作成し以下の内容で保存する。

#! /bin/sh /sbin/modprobe ehci-hcd /sbin/modprobe usb-storage /bin/mount -t usbfs none /proc/bus/usb /bin/mount /dev/sda1 /mnt/usbhdd

多分これでいける。再起動しない鯖だからわからん。

あとはrsyncだがまた今度。

----------
参考URL

http://www.geocities.jp/wkurow/usbhdd.html

thx

Sponsored Link

コメント

タイトルとURLをコピーしました