I am trying to setup automount for usb external disk.
I followed this post which is great.
http://sourceforge.net/apps/phpbb/freenas/viewtopic.php?f=12&t=2073&hilit=auto+mount+usb+drive
When I plug in the usb disk, it doesn't trig the action I put it in devd.conf. I am new to FreeNAS. I have no idea what happens. Google gives me no help. Can anyone here help me? Thank you!
Here is what in devd.conf:
attach 0 {
device-name "umass[0-9]+";
action "sleep 2; logger vendor:$vendor,product:$product,release:$release,device-name:$device-name";
};
attach 5 {
match "vendor" "0x1058";
match "product" "0x1110";
# match "release" "0x0100";
action "sleep 2; /usr/local/bin/script/back2mybook.sh $device-name";
};
here is the back2mybook.sh
#!/bin/bash
device=da${1//[a-z]/}
target=/mnt/backup
_mount() {
/bin/mkdir -p ${target} &&
/sbin/mount /dev/${device} ${target}/ &&
/sbin/fsck_ufs -pB ${target};
}
_mount;
Here is the information from log
Jun 29 19:11:13 freenas root: Unknown USB device: vendor 0x1058 product 0x1110 bus uhub1
Jun 29 19:11:13 freenas kernel: ugen1.2: <Western Digital> at usbus1
Jun 29 19:11:13 freenas kernel: umass0: <Western Digital My Book 1110, class 0/0, rev 2.00/20.10, addr 2> on usbus1
Jun 29 19:11:15 freenas kernel: da0 at umass-sim0 bus 0 scbus6 target 0 lun 0
Jun 29 19:11:15 freenas kernel: da0: <WD My Book 1110 2010> Fixed Direct Access SCSI-4 device
Jun 29 19:11:15 freenas kernel: da0: 40.000MB/s transfers
Jun 29 19:11:15 freenas kernel: da0: 1907059MB (3905656832 512 byte sectors: 255H 63S/T 243115C)
Jun 29 19:11:15 freenas kernel: ses0 at umass-sim0 bus 0 scbus6 target 0 lun 1
Jun 29 19:11:15 freenas kernel: ses0: <WD SES Device 2010> Fixed Enclosure Services SCSI-4 device
Jun 29 19:11:15 freenas kernel: ses0: 40.000MB/s transfers
Jun 29 19:11:15 freenas kernel: ses0: SCSI-3 SES Device
Jun 29 19:11:16 freenas root: vendor:0x1058,product:0x1110,release:0x2010,device-name:umass0
I followed this post which is great.
http://sourceforge.net/apps/phpbb/freenas/viewtopic.php?f=12&t=2073&hilit=auto+mount+usb+drive
When I plug in the usb disk, it doesn't trig the action I put it in devd.conf. I am new to FreeNAS. I have no idea what happens. Google gives me no help. Can anyone here help me? Thank you!
Here is what in devd.conf:
attach 0 {
device-name "umass[0-9]+";
action "sleep 2; logger vendor:$vendor,product:$product,release:$release,device-name:$device-name";
};
attach 5 {
match "vendor" "0x1058";
match "product" "0x1110";
# match "release" "0x0100";
action "sleep 2; /usr/local/bin/script/back2mybook.sh $device-name";
};
here is the back2mybook.sh
#!/bin/bash
device=da${1//[a-z]/}
target=/mnt/backup
_mount() {
/bin/mkdir -p ${target} &&
/sbin/mount /dev/${device} ${target}/ &&
/sbin/fsck_ufs -pB ${target};
}
_mount;
Here is the information from log
Jun 29 19:11:13 freenas root: Unknown USB device: vendor 0x1058 product 0x1110 bus uhub1
Jun 29 19:11:13 freenas kernel: ugen1.2: <Western Digital> at usbus1
Jun 29 19:11:13 freenas kernel: umass0: <Western Digital My Book 1110, class 0/0, rev 2.00/20.10, addr 2> on usbus1
Jun 29 19:11:15 freenas kernel: da0 at umass-sim0 bus 0 scbus6 target 0 lun 0
Jun 29 19:11:15 freenas kernel: da0: <WD My Book 1110 2010> Fixed Direct Access SCSI-4 device
Jun 29 19:11:15 freenas kernel: da0: 40.000MB/s transfers
Jun 29 19:11:15 freenas kernel: da0: 1907059MB (3905656832 512 byte sectors: 255H 63S/T 243115C)
Jun 29 19:11:15 freenas kernel: ses0 at umass-sim0 bus 0 scbus6 target 0 lun 1
Jun 29 19:11:15 freenas kernel: ses0: <WD SES Device 2010> Fixed Enclosure Services SCSI-4 device
Jun 29 19:11:15 freenas kernel: ses0: 40.000MB/s transfers
Jun 29 19:11:15 freenas kernel: ses0: SCSI-3 SES Device
Jun 29 19:11:16 freenas root: vendor:0x1058,product:0x1110,release:0x2010,device-name:umass0