mount选项用udev正确卸载usb

时间:2016-07-12 09:15:12

标签: linux

我应该忽略下面的挂载错误吗?如果没有,我该如何解决?

我正在使用以下内容来udev规则在ARM上运行的linux上安装/卸载usb stick:

# Mount/Unmount usb sticks of type fat, ntfs
KERNEL!="sd[a-z][0-9]", GOTO="mount_usb_end"

# Create mountpoint                         
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", RUN+="/bin/mkdir -p /shared"

# Mount the device of type vfat                                          
ACTION=="add", ENV{ID_FS_TYPE}=="vfat", RUN+="/bin/mount -o flush,relatime,rw /dev/%k /shared"

# Mount the device of type ntfs                                                               
ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", RUN+="/bin/mount -o relatime,rw,utf8,gid=100,umask=002 /dev/%k /shared"

# Clean up after removal                                                                                       
ACTION=="remove", RUN+="/bin/umount -l /shared"                                                                

# Exit                                                             
LABEL="mount_usb_end"                                              

挂载/卸载和存储使用按预期工作。在Linux / Windows上也可以读/写。但是,内核日志在再次安装存储时显示以下错误:

FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

卸载消息是:

usb 2-1.4: USB disconnect, device number 23

输出dmesg和fsck.vfat <​​/ p>

[  300.820732] usb 2-1.4: new high-speed USB device number 5 using musb-hdrc
[  300.941013] usb 2-1.4: device v1908 p1320 is not supported
[  300.946771] usb 2-1.4: New USB device found, idVendor=1908, idProduct=1320
[  300.954000] usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  300.961677] usb 2-1.4: Product: Flash Disk
[  300.965973] usb 2-1.4: Manufacturer: GoodSun
[  300.970449] usb 2-1.4: SerialNumber: gsgsmt12241216000957
[  300.983405] usb-storage 2-1.4:1.0: USB Mass Storage device detected
[  300.997618] scsi1 : usb-storage 2-1.4:1.0
[  302.001320] scsi 1:0:0:0: Direct-Access     Generic  Mass storage     1.68 PQ: 0 ANSI: 2
[  302.015583] sd 1:0:0:0: [sda] 4120576 512-byte logical blocks: (2.10 GB/1.96 GiB)
[  302.034339] sd 1:0:0:0: [sda] Write Protect is off
[  302.039656] sd 1:0:0:0: [sda] No Caching mode page found
[  302.045285] sd 1:0:0:0: [sda] Assuming drive cache: write through
[  302.055599] sd 1:0:0:0: [sda] No Caching mode page found
[  302.061239] sd 1:0:0:0: [sda] Assuming drive cache: write through
[  302.068973]  sda: sda1
[  302.078999] sd 1:0:0:0: [sda] No Caching mode page found
[  302.084664] sd 1:0:0:0: [sda] Assuming drive cache: write through
[  302.091073] sd 1:0:0:0: [sda] Attached SCSI removable disk
[  302.269772] FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

root@am335x-evm:/home/root# fsck.vfat -V /dev/sda1
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
Starting check/repair pass.
Starting verification pass.
/dev/sda1: 2 files, 1/64373 clusters

0 个答案:

没有答案