showing the name of the hard disk devices using grep - linux

Why does this command:
[jalal#galapagos-20] (42)$ dmesg | egrep '(s|h)d[a-z]'
Shows the following? Can you please show step by step?
ACPI: SSDT 00000000d8ffbbd8 03528 (v01 SaSsdt SaSsdt 00003000 INTL 20091112)
NMI watchdog enabled, takes one hw-pmu counter.
sd 0:0:0:0: [sda] 500118192 512-byte logical blocks: (256 GB/238 GiB)
sd 0:0:0:0: [sda] 4096-byte physical blocks
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sda: sda1 sda2 sda3 sda4 sda5 sda6 sda7
sd 0:0:0:0: [sda] Attached SCSI disk
EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts:
dracut: Mounted root filesystem /dev/sda3
snd_hda_intel 0000:00:03.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
snd_hda_intel 0000:00:03.0: irq 33 for MSI/MSI-X
snd_hda_intel 0000:00:03.0: setting latency timer to 64
snd_hda_intel 0000:00:1b.0: PCI INT A -> GSI 22 (level, low) -> IRQ 22
snd_hda_intel 0000:00:1b.0: irq 34 for MSI/MSI-X
snd_hda_intel 0000:00:1b.0: setting latency timer to 64
sound hdaudioC1D2: autoconfig for ALC3220: line_outs=1 (0x1b/0x0/0x0/0x0/0x0) type:line
sound hdaudioC1D2: speaker_outs=1 (0x14/0x0/0x0/0x0/0x0)
sound hdaudioC1D2: hp_outs=1 (0x15/0x0/0x0/0x0/0x0)
sound hdaudioC1D2: mono: mono_out=0x0
sound hdaudioC1D2: inputs:
sound hdaudioC1D2: Front Mic=0x1a
sound hdaudioC1D2: Rear Mic=0x18
EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts:
EXT4-fs (sda7): mounted filesystem with ordered data mode. Opts:
EXT4-fs (sda4): mounted filesystem with ordered data mode. Opts:
EXT4-fs (sda6): mounted filesystem with ordered data mode. Opts:
EXT4-fs (sda5): mounted filesystem with ordered data mode. Opts:
Adding 67108860k swap on /dev/sda2. Priority:-1 extents:1 across:67108860k SS
snd_hda_intel 0000:00:1b.0: IRQ timing workaround is activated for card #1. Suggest a bigger bdl_pos_adj.

The command dmesg dumps the kernel log buffer to stdout. This output consists of a bunch of log messages, each on a separate line.
That output is piped to the command egrep with the option (s|h)d[a-z]. egrep checks its stdin (the output of dmesg) one line at a time for a match against the regular expression (s|h)d[a-z]. This regular expression will match a series of characters where:
The first character is s or h
The second character is d
The third character is in the ASCII range (inclusive) between a and z (the lowercase letters a to z).
egrep prints to stdout any lines which match the supplied regular expression.

The egrep command is using the regular expression (s|h)d[a-z] for filtering lines containing the sequences hda to hdz and sda to sdz on the output of dmesg - traditional names for disk devices in Linux.
This regular expression could be switched to [sh]d[a-z], which has the same effect but you may find easier to understand.
There are several false positives if you are looking for disks, like the lines containing "hdaudio".

Related

Mount USB device on router - OpenWrt

I am new to OpenWrt and Linux/Unix shell. Prior to this, was using dd-wrt for 2 years. Recently switched to OpenWrt and got the basic setup done(wifi/internet working). I need to install transmission my router. But, USB device won't mount.
The Details of the router are as follows:
Router Model:
Asus RT-N13U B1
Image flashed:
chaos_calmer 15.05.1 (openwrt-15.05.1-ramips-rt305x-rt-n13u-squashfs-sysupgrade.bin)
Usb Details:
Crusier Blade 16GB usb 2.0
Formatted to ext4 using GParted bootable cd
Drivers Installed:
kmod-usb-core(preinstalled)
kmod-usb-dwc2(preinstalled)
kmod-usb2
kmod-usb-storage
kmod-fs-ext4
kmod-scsi-core(preinstalled)
Here are permissions for dev/sda, /dev/sda1 and /mnt (set 777 manually):
~#ls -l /dev
brwxrwxrwx 1 root root 8, 0 Jan 17 21:56 sda
brwxrwxrwx 1 root root 8, 1 Jan 17 21:56 sda1
~#ls -l ..
drwxrwxrwx 2 root root 0 Jan 16 21:28 mnt
Error while mounting:
~# mount -t ext4 /dev/sda1 /mnt
mount: mounting /dev/sda1 on /mnt failed: No such file or directory
echo $?
255
sda1 is present inside dev and /mnt directory exists. Still it shows an error.
I have tried installing/reinstalling and then mounting, but for the same result. Also when I disconnect the USB sda and sda1 folders disappear and then reappear when USB is reconnected so I guess the device is being detected successfully.
What is it, that I am missing?
Edit:
Added edits as suggested in the comments.
dmesg output (The output is very big so linked it)
Edit 2:
Switched to LEDE 17. Is more stable and have had zero issues in the past week.
the critical part of the dmesg output is
[ 9.410000] mount_root: loading kmods from internal overlay
[ 9.940000] SCSI subsystem initialized
[ 9.960000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 9.980000] ehci-platform:EHCI generic platform driver [ 9.990000] usb-storage 1-1:1.0: no of_node; not parsing pinctrl DT
[ 9.990000] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 10.010000] scsi host0: usb-storage 1-1:1.0
[ 10.020000] usbcore: registered new interface driver usb-storage
[ 10.100000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[ 10.120000] block: extroot: not configured
[ 10.130000] mount_root: switching to jffs2 overlay
[ 10.180000] procd: - early -
[ 11.020000] scsi 0:0:0:0: Direct-Access SanDisk Cruzer Blade 1.27 PQ: 0 ANSI: 6
[ 11.030000] sd 0:0:0:0: no of_node; not parsing pinctrl DT
[ 11.050000] sd 0:0:0:0: [sda] 30529536 512-byte logical blocks: (15.6 GB/14.5 GiB)
[ 11.070000] sd 0:0:0:0: [sda] Write Protect is off
[ 11.070000] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[ 11.090000] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 11.120000] sda: sda1
[ 11.130000] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 11.550000] EXT4-fs (sda1): Cannot load crc32c driver
oh no, this seems to be a bug
Bug#819725: ext4 missing softdep on crc32c module
https://lists.debian.org/debian-kernel/2016/04/msg00013.html
the following workaround is not applicable because initramfs is a native file system at startup time (https://en.wikipedia.org/wiki/Initramfs) and has no influence when the system is fully up (rootfs is mounted):
Until this is fixed in the kernel package, you can work around it by
either:
Setting base-installer/initramfs-tools/driver-policy to "most" instead of "dep"
Setting base-config/late_command to a script that adds crc32c to /etc/initramfs-tools/modules
post the stack trace anyway, maybe there is another workaround
this is overcomplicated stuff...
here is maybe a solution https://forum.openwrt.org/viewtopic.php?id=69175
download kmod-lib-crc32c and kmod-crypto-crc32c
if this is not working maybe the easiest solution is to format the USB stack as VFAT and to wait for a new kernel...
this is not a permissions error. a permission error would return EPERM -> error code 1 Operation not permitted
it would be interesting to know what exit code the mount returns. The 'exit behavior is very different in the several mount version' i.e. mount(2) and mount(8)
for getting the return value, type in a shell the command
mount /dev/sda1 /mnt
then
echo $?
the number is the returned exit code of the mount (the 255 means 'exit status out of range' in this case '-1', http://www.tldp.org/LDP/abs/html/exitcodes.html#EXITCODESREF)
a listing of the mount(8) exit codes is i.e. in http://www.stackoverflow.com/questions/33167585/what-are-the-return-codes-values-of-linux-umount
http://www.becane.com/2014/09/02/understanding-exit-codes-and-how-to-use-them-in-a-bash-script
beside the return value mount(2) also sets an error code in errno (http://man7.org/linux/man-pages/man3/errno.3.html). printing errno in shell is a bit difficult it is easier to get a reference like http://www-numi.fnal.gov/offline_software/srt_public_context/WebDocs/Errors/unix_system_errors.html and search for the error string, in this case No such file or directory
the string No such file or directory is system error ENOENT
As a system error ENOENT means A pathname was empty or had a nonexistent component. (http://man7.org/linux/man-pages/man2/mount.2.html)
try sudo mount -t ext4 /dev/sda1 /mnt because the stick is formatted in ext4
if this is not working dmesg output would be interesting
detach usb device, reattach usb device, type dmesg and see the output. in the output of dmesg you also see which drivers are loaded for the device
https://wiki.openwrt.org/doc/howto/usb.storage says that you need several more drivers (block-mount, kmod-scsi-core,...) because a usb stick (USB Mass Storage class) is also a SCSI and a block device...
(linux system error codes are in http://www-numi.fnal.gov/offline_software/srt_public_context/WebDocs/Errors/unix_system_errors.html)
print a stack trace sudo strace -f mount -t ext4 -o default /dev/sda1 /mnt and post it

error when changing mount location for external hdd

I will admit this might be a bit complicated and maybe not the best method so if you have a better solution let me know...
I have a 'server' that I put lubuntu 14.4 on. I am attempting to attach an external hdd formatted to ext3 to the folder /home/external so that my ftp users are able to get to the files on it without leaving the /home directory (to which I have them 'chained' / chrooted).
The hdd will mount just fine (no errors) with the automatic mount options. but every time I try to change the mount point to something other than /media//external I get:
Error mounting system-managed device /dev/sdd1: Command-line `mount "/mnt/
external"' exited with non-zero exit status 32: mount: wrong fs type, bad option,
bad superblock on /dev/sdd1
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
(udisks-error-quark, 0)
As far as I can tell it does not matter where I try to mount it even tried /mnt/external with same results.
Output of dmesg | tail (before mount changes):
sd 6:0:0:0: [sdd] Write Protect is off
sd 6:0:0:0: [sdd] Mode Sense: 23 00 00 00
sd 6:0:0:0: [sdd] No Caching mode page found
sd 6:0:0:0: [sdd] Assuming drive cache: write through
sdd: sdd1
sd 6:0:0:0: [sdd] Attached SCSI disk
EXT4-fs (sdd1): mounting ext3 file system using the ext4 subsystem
EXT4-fs (sdd1): mounted filesystem with ordered data mode. Opts: (null)
Output of dmesg | tail (after mount changes):
sd 6:0:0:0: [sdd] Mode Sense: 23 00 00 00
sd 6:0:0:0: [sdd] No Caching mode page found
sd 6:0:0:0: [sdd] Assuming drive cache: write through
sdd: sdd1
sd 6:0:0:0: [sdd] Attached SCSI disk
EXT4-fs (sdd1): mounting ext3 file system using the ext4 subsystem
EXT4-fs (sdd1): mounted filesystem with ordered data mode. Opts: (null)
EXT4-fs (sdd1): Unrecognized mount option "x-gvfs-show" or missing value
Just to be sure, did you actually unmount the block device in question before you tried to mount it on a different location?
Problem fixed: I was using the disks GUI to change the mount options because I didn't want to screw up my fstab.conf file. For some reason when I check 'Show in user interface' it only adds x-gvfs-show instad of comment=x-gvfs-show (which is apparently the correct syntax for that option). Having manually added the 'comment=' I can say the problem is resolved.

Raspberry Pi USB mount error (sd* letter always changes) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I wanted to set up a torrent server with my Raspberry Pi 2 and with a 16 GB USB.
My fstab:
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
/dev/sda1 /mnt/usb ext4 defaults 0 0
It worked for a few minutes, and then the transmission-daemon had input-output error. Then I saw in the /proc/partitions file, that the USB isn't sda any more, but sdb. So I mounted it manually to /mnt/usb (sudo mount /dev/sdb1 /mnt/usb). But after a few minutes transmission-daemon had the same error, and sdb changed to sdc. I also tried to format my USB, but it didn't work even if I had an NTFS filesystem on my USB.
Dmesg said some errors too:
[ 450.036334] usb 1-1.4: reset high-speed USB device number 42 using dwc_otg
[ 450.907015] usb 1-1.4: USB disconnect, device number 42
[ 450.916493] sd 5:0:0:0: [sdb]
[ 450.916523] Result: hostbyte=0x01 driverbyte=0x00
[ 450.916541] sd 5:0:0:0: [sdb] CDB:
[ 450.916553] cdb[0]=0x2a: 2a 00 01 78 80 70 00 00 f0 00
[ 450.916618] blk_update_request: I/O error, dev sdb, sector 24674416
[ 450.916650] EXT4-fs warning (device sdb1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 770637824 size 1114112 starting block 3084332)
[ 450.916672] Buffer I/O error on device sdb1, logical block 3084046
[ 450.916719] Buffer I/O error on device sdb1, logical block 3084047
[ 450.916739] Buffer I/O error on device sdb1, logical block 3084048
[ 450.916757] Buffer I/O error on device sdb1, logical block 3084049
[ 450.916776] Buffer I/O error on device sdb1, logical block 3084050
[ 450.916793] Buffer I/O error on device sdb1, logical block 3084051
[ 450.916811] Buffer I/O error on device sdb1, logical block 3084052
[ 450.916828] Buffer I/O error on device sdb1, logical block 3084053
[ 450.916846] Buffer I/O error on device sdb1, logical block 3084054
[ 450.916863] Buffer I/O error on device sdb1, logical block 3084055
[ 450.917060] EXT4-fs warning (device sdb1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 770637824 size 1114112 starting block 3084392)
[ 450.917221] EXT4-fs warning (device sdb1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 770637824 size 1114112 starting block 3084422)
[ 450.917375] EXT4-fs warning (device sdb1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 770637824 size 1114112 starting block 3084452)
[ 450.917530] EXT4-fs warning (device sdb1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 770637824 size 1114112 starting block 3084482)
[ 450.917682] EXT4-fs warning (device sdb1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 770637824 size 1114112 starting block 3084512)
[ 450.917835] EXT4-fs warning (device sdb1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 770637824 size 1114112 starting block 3084542)
[ 450.917985] EXT4-fs warning (device sdb1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 770637824 size 1114112 starting block 3084544)
[ 450.918065] sd 5:0:0:0: [sdb]
[ 450.918080] Result: hostbyte=0x01 driverbyte=0x00
[ 450.918096] sd 5:0:0:0: [sdb] CDB:
[ 450.918106] cdb[0]=0x2a: 2a 00 01 78 81 60 00 00 f0 00
[ 450.918168] blk_update_request: I/O error, dev sdb, sector 24674656
[ 450.918193] EXT4-fs warning (device sdb1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 770637824 size 1114112 starting block 3084362)
[ 450.918327] Aborting journal on device sdb1-8.
[ 450.918404] JBD2: Error -5 detected when updating journal superblock for sdb1-8.
[ 450.926386] blk_update_request: I/O error, dev sdb, sector 0
[ 450.965297] EXT4-fs error (device sdb1): ext4_journal_check_start:56: Detected aborted journal
[ 450.965364] EXT4-fs (sdb1): Remounting filesystem read-only
[ 451.005340] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #2: comm pool: reading directory lblock 0
[ 451.005551] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #2: comm pool: reading directory lblock 0
[ 451.005911] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #2: comm pool: reading directory lblock 0
[ 451.006405] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #2: comm pool: reading directory lblock 0
[ 451.006540] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #2: comm pool: reading directory lblock 0
[ 451.007847] EXT4-fs warning (device sdb1): __ext4_read_dirblock:884: error -5 reading directory block (ino 2, block 0)
[ 451.022015] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #2: comm gvfsd-trash: reading directory lblock 0
[ 451.022288] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #2: comm gvfsd-trash: reading directory lblock 0
[ 451.039755] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #260639: comm transmission-da: reading directory lblock 0
[ 451.039933] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #260639: comm transmission-da: reading directory lblock 0
[ 451.040011] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #260639: comm transmission-da: reading directory lblock 0
[ 451.636367] usb 1-1.4: new high-speed USB device number 43 using dwc_otg
[ 451.741850] usb 1-1.4: New USB device found, idVendor=090c, idProduct=1000
[ 451.741876] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 451.741894] usb 1-1.4: Product: USB Flash Disk
[ 451.741911] usb 1-1.4: Manufacturer: General
[ 451.741927] usb 1-1.4: SerialNumber: 0107000000011210
[ 451.743734] usb-storage 1-1.4:1.0: USB Mass Storage device detected
[ 451.744258] scsi host6: usb-storage 1-1.4:1.0
[ 453.040465] scsi 6:0:0:0: Direct-Access General USB Flash Disk 1100 PQ: 0 ANSI: 6
[ 453.041762] sd 6:0:0:0: Attached scsi generic sg0 type 0
[ 453.042685] sd 6:0:0:0: [sdc] 31490048 512-byte logical blocks: (16.1 GB/15.0 GiB)
[ 453.043669] sd 6:0:0:0: [sdc] Write Protect is off
[ 453.043698] sd 6:0:0:0: [sdc] Mode Sense: 43 00 00 00
[ 453.044665] sd 6:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 453.126409] usb 1-1.4: reset high-speed USB device number 43 using dwc_otg
[ 453.554715] sdc: sdc1
[ 453.565480] sd 6:0:0:0: [sdc] Attached SCSI removable disk
[ 461.356064] EXT4-fs (sdc1): recovery complete
[ 462.443547] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
[ 462.536762] usb 1-1.4: reset high-speed USB device number 43 using dwc_otg
[ 463.558275] EXT4-fs error: 5 callbacks suppressed
[ 463.558315] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 463.560901] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 463.563529] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 463.565388] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 463.634130] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 463.636388] EXT4-fs error (device sdb1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 578.048876] usb 1-1.4: reset high-speed USB device number 43 using dwc_otg
[ 580.069629] usb 1-1.4: USB disconnect, device number 43
[ 580.088851] sd 6:0:0:0: [sdc]
[ 580.088881] Result: hostbyte=0x01 driverbyte=0x00
[ 580.088900] sd 6:0:0:0: [sdc] CDB:
[ 580.088912] cdb[0]=0x2a: 2a 00 00 c4 26 10 00 00 08 00
[ 580.088977] blk_update_request: I/O error, dev sdc, sector 12854800
[ 580.089000] Buffer I/O error on dev sdc1, logical block 1606594, lost sync page write
[ 580.089107] EXT4-fs warning (device sdc1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 352321536 size 1441792 starting block 2982174)
[ 580.089129] buffer_io_error: 232 callbacks suppressed
[ 580.089144] Buffer I/O error on device sdc1, logical block 2981888
[ 580.089192] Buffer I/O error on device sdc1, logical block 2981889
[ 580.089215] Buffer I/O error on device sdc1, logical block 2981890
[ 580.089236] Buffer I/O error on device sdc1, logical block 2981891
[ 580.089260] Buffer I/O error on device sdc1, logical block 2981892
[ 580.089280] Buffer I/O error on device sdc1, logical block 2981893
[ 580.089301] Buffer I/O error on device sdc1, logical block 2981894
[ 580.089322] Buffer I/O error on device sdc1, logical block 2981895
[ 580.089343] Buffer I/O error on device sdc1, logical block 2981896
[ 580.089364] Buffer I/O error on device sdc1, logical block 2981897
[ 580.089510] EXT4-fs warning (device sdc1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 352321536 size 1441792 starting block 2982204)
[ 580.089693] EXT4-fs warning (device sdc1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 352321536 size 1441792 starting block 2982234)
[ 580.089878] EXT4-fs warning (device sdc1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 352321536 size 1441792 starting block 2982264)
[ 580.090063] EXT4-fs warning (device sdc1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 352321536 size 1441792 starting block 2982294)
[ 580.090245] EXT4-fs warning (device sdc1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 352321536 size 1441792 starting block 2982324)
[ 580.090428] EXT4-fs warning (device sdc1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 352321536 size 1441792 starting block 2982354)
[ 580.090616] EXT4-fs warning (device sdc1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 352321536 size 1441792 starting block 2982384)
[ 580.090791] EXT4-fs warning (device sdc1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 352321536 size 1441792 starting block 2982414)
[ 580.091004] EXT4-fs warning (device sdc1): ext4_end_bio:317: I/O error -5 writing to inode 260640 (offset 352321536 size 1441792 starting block 2982444)
[ 580.091497] JBD2: Error -5 detected when updating journal superblock for sdc1-8.
[ 580.091733] Aborting journal on device sdc1-8.
[ 580.091790] JBD2: Error -5 detected when updating journal superblock for sdc1-8.
[ 580.165173] EXT4-fs error (device sdc1): ext4_journal_check_start:56: Detected aborted journal
[ 580.165223] EXT4-fs (sdc1): Remounting filesystem read-only
[ 580.169410] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260639: comm transmission-da: reading directory lblock 0
[ 580.169620] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260639: comm transmission-da: reading directory lblock 0
[ 580.169719] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260639: comm transmission-da: reading directory lblock 0
[ 580.169794] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260639: comm transmission-da: reading directory lblock 0
[ 580.169973] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260639: comm transmission-da: reading directory lblock 0
[ 580.170050] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260639: comm transmission-da: reading directory lblock 0
[ 580.170112] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260639: comm transmission-da: reading directory lblock 0
[ 580.170179] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260639: comm transmission-da: reading directory lblock 0
[ 580.178082] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #2: comm pool: reading directory lblock 0
[ 580.178334] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #2: comm pool: reading directory lblock 0
[ 580.678933] usb 1-1.4: new high-speed USB device number 44 using dwc_otg
[ 580.784418] usb 1-1.4: New USB device found, idVendor=090c, idProduct=1000
[ 580.784448] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 580.784466] usb 1-1.4: Product: USB Flash Disk
[ 580.784482] usb 1-1.4: Manufacturer: General
[ 580.784499] usb 1-1.4: SerialNumber: 0107000000011210
[ 580.786308] usb-storage 1-1.4:1.0: USB Mass Storage device detected
[ 580.786843] scsi host7: usb-storage 1-1.4:1.0
[ 582.083966] scsi 7:0:0:0: Direct-Access General USB Flash Disk 1100 PQ: 0 ANSI: 6
[ 582.085891] sd 7:0:0:0: Attached scsi generic sg0 type 0
[ 582.087744] sd 7:0:0:0: [sdd] 31490048 512-byte logical blocks: (16.1 GB/15.0 GiB)
[ 582.088711] sd 7:0:0:0: [sdd] Write Protect is off
[ 582.088740] sd 7:0:0:0: [sdd] Mode Sense: 43 00 00 00
[ 582.089890] sd 7:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 582.097623] sdd: sdd1
[ 582.102909] sd 7:0:0:0: [sdd] Attached SCSI removable disk
[ 583.864490] EXT4-fs (sdd1): recovery complete
[ 583.864537] EXT4-fs (sdd1): mounted filesystem with ordered data mode. Opts: (null)
[ 583.949085] usb 1-1.4: reset high-speed USB device number 44 using dwc_otg
[ 905.411955] EXT4-fs error: 5 callbacks suppressed
[ 905.411994] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 905.415351] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 905.418646] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 905.421045] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 905.422771] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 905.425328] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 1619.454353] EXT4-fs error (device sdc1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 1671.150949] usb 1-1.4: USB disconnect, device number 44
[ 1671.152308] blk_update_request: I/O error, dev sdd, sector 0
[ 1671.159210] sd 7:0:0:0: [sdd] Synchronizing SCSI cache
[ 1671.159556] sd 7:0:0:0: [sdd]
[ 1671.159575] Result: hostbyte=0x01 driverbyte=0x00
[ 1674.198477] usb 1-1.2: new high-speed USB device number 45 using dwc_otg
[ 1674.303962] usb 1-1.2: New USB device found, idVendor=090c, idProduct=1000
[ 1674.303988] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1674.304006] usb 1-1.2: Product: USB Flash Disk
[ 1674.304023] usb 1-1.2: Manufacturer: General
[ 1674.304040] usb 1-1.2: SerialNumber: 0107000000011210
[ 1674.305851] usb-storage 1-1.2:1.0: USB Mass Storage device detected
[ 1674.306351] scsi host8: usb-storage 1-1.2:1.0
[ 1675.608760] scsi 8:0:0:0: Direct-Access General USB Flash Disk 1100 PQ: 0 ANSI: 6
[ 1675.610728] sd 8:0:0:0: Attached scsi generic sg0 type 0
[ 1675.611007] sd 8:0:0:0: [sdd] 31490048 512-byte logical blocks: (16.1 GB/15.0 GiB)
[ 1675.612004] sd 8:0:0:0: [sdd] Write Protect is off
[ 1675.612032] sd 8:0:0:0: [sdd] Mode Sense: 43 00 00 00
[ 1675.612989] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 1675.621378] sdd: sdd1
[ 1675.626508] sd 8:0:0:0: [sdd] Attached SCSI removable disk
[ 1677.426106] EXT4-fs (sdd1): recovery complete
[ 1677.426151] EXT4-fs (sdd1): mounted filesystem with ordered data mode. Opts: (null)
[ 1677.508594] usb 1-1.2: reset high-speed USB device number 45 using dwc_otg
[ 1699.728493] usb 1-1.2: reset high-speed USB device number 45 using dwc_otg
[ 1706.888517] usb 1-1.2: reset high-speed USB device number 45 using dwc_otg
[ 1707.218479] usb 1-1.2: device descriptor read/64, error -71
[ 1708.088519] usb 1-1.2: reset high-speed USB device number 45 using dwc_otg
[ 1708.988506] usb 1-1.2: reset high-speed USB device number 45 using dwc_otg
[ 1710.979144] usb 1-1.2: USB disconnect, device number 45
[ 1710.988746] sd 8:0:0:0: [sdd]
[ 1710.988775] Result: hostbyte=0x01 driverbyte=0x00
[ 1710.988794] sd 8:0:0:0: [sdd] CDB:
[ 1710.988807] cdb[0]=0x2a: 2a 00 00 c4 26 40 00 00 18 00
[ 1710.988871] blk_update_request: I/O error, dev sdd, sector 12854848
[ 1710.988973] Aborting journal on device sdd1-8.
[ 1710.989059] JBD2: Error -5 detected when updating journal superblock for sdd1-8.
[ 1710.991653] sd 8:0:0:0: [sdd] Synchronizing SCSI cache
[ 1710.991959] sd 8:0:0:0: [sdd]
[ 1710.991984] Result: hostbyte=0x01 driverbyte=0x00
[ 1711.033811] EXT4-fs error (device sdd1): ext4_find_entry:1289: inode #2: comm gvfsd-trash: reading directory lblock 0
[ 1711.034142] EXT4-fs error (device sdd1): ext4_find_entry:1289: inode #2: comm gvfsd-trash: reading directory lblock 0
[ 1711.588496] usb 1-1.2: new high-speed USB device number 46 using dwc_otg
[ 1711.693976] usb 1-1.2: New USB device found, idVendor=090c, idProduct=1000
[ 1711.694007] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1711.694025] usb 1-1.2: Product: USB Flash Disk
[ 1711.694041] usb 1-1.2: Manufacturer: General
[ 1711.694058] usb 1-1.2: SerialNumber: 0107000000011210
[ 1711.695898] usb-storage 1-1.2:1.0: USB Mass Storage device detected
[ 1711.696514] scsi host9: usb-storage 1-1.2:1.0
[ 1712.738232] ieee80211 phy6: rt2x00lib_rxdone_read_signal: Warning - Frame received with unrecognized signal, mode=0x0000, signal=0x0008, type=2
[ 1712.738810] ERROR::dwc_otg_hcd_urb_enqueue:505: Not connected
[ 1712.738810]
[ 1712.748414] ERROR::dwc_otg_hcd_urb_enqueue:505: Not connected
[ 1712.748414]
[ 1712.748456] ERROR::dwc_otg_hcd_urb_enqueue:505: Not connected
[ 1712.748456]
[ 1712.748493] ERROR::dwc_otg_hcd_urb_enqueue:505: Not connected
[ 1712.748493]
[ 1712.748549] ERROR::dwc_otg_hcd_urb_enqueue:505: Not connected
[ 1712.748549]
[ 1712.748664] ERROR::dwc_otg_hcd_urb_enqueue:505: Not connected
[ 1712.748664]
[ 1712.788536] usb 1-1: USB disconnect, device number 39
[ 1712.788563] usb 1-1.1: USB disconnect, device number 40
[ 1712.788851] smsc95xx 1-1.1:1.0 eth0: unregister 'smsc95xx' usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet
[ 1712.788919] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[ 1712.834183] EXT4-fs error (device sdd1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 1712.849322] usb 1-1.2: USB disconnect, device number 46
[ 1712.851093] usb 1-1.3: USB disconnect, device number 41
[ 1712.857125] EXT4-fs error (device sdd1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 1712.863743] EXT4-fs error (device sdd1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 1712.868764] EXT4-fs error (device sdd1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 1712.871981] EXT4-fs error (device sdd1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 1712.881372] EXT4-fs error (device sdd1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 1712.889661] EXT4-fs error (device sdd1): ext4_find_entry:1289: inode #260609: comm transmission-da: reading directory lblock 0
[ 1712.890923] wlan0: deauthenticating from 64:66:b3:14:6f:de by local choice (Reason: 3=DEAUTH_LEAVING)
[ 1712.899551] EXT4-fs error (device sdd1): ext4_find_entry:1289: inode #260639: comm transmission-da: reading directory lblock 0
I also have problems occasionally with my USB WLAN adapter. Is it hardware issue with my USB or the Raspberry Pi, or is it just a software problem?
You might be getting powerspikes. If you're using a 0.7 A adapter you should change to a 1 A instead. Because, while the Raspberry Pi can survive on 0.7 A, it will have a hard time sustaining your USB adapters.

mkfs ext4 failing on Azure VM

I have a VM running CenOS 6.3 on Azure. I'm following the steps in the Microsoft article to attach a disk (article).
When I run: sudo mkfs -t ext4 /dev/sdc1
the process hangs indefinitely at "Writing superblocks and filesystem accounting information"
If I start a new session and try mounting the partition it says:
"mount: you must specify the filesystem type"
I've upgraded and downgraded my VM in order to force a hardware switch. I've detached and re-attached new disks of various sizes. Same result each time.
I'm guessing it must be either an error or setting on my OS that is causing the problem. Below is a full bash session. Any help would be very much appreciated!
[apper#apper ~]$ sudo grep SCSI /var/log/messages
Apr 19 14:08:47 apper kernel: sd 3:0:0:0: [sdc] Attached SCSI disk
Apr 19 14:19:38 apper kernel: sd 3:0:0:0: [sdc] Synchronizing SCSI cache
Apr 19 14:22:58 apper kernel: SCSI subsystem initialized
Apr 19 14:22:58 apper kernel: Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
Apr 19 14:22:58 apper kernel: sd 1:0:1:0: [sdb] Attached SCSI disk
Apr 19 14:22:58 apper kernel: sd 0:0:0:0: [sda] Attached SCSI disk
Apr 19 14:33:08 apper kernel: sd 3:0:0:0: [sdc] Attached SCSI disk
Apr 19 14:40:16 apper kernel: sd 3:0:0:0: [sdc] Synchronizing SCSI cache
Apr 19 14:47:11 apper kernel: SCSI subsystem initialized
Apr 19 14:47:11 apper kernel: Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
Apr 19 14:47:11 apper kernel: sd 1:0:1:0: [sdb] Attached SCSI disk
Apr 19 14:47:11 apper kernel: sd 0:0:0:0: [sda] Attached SCSI disk
Apr 19 14:48:40 apper kernel: sd 3:0:0:0: [sdc] Attached SCSI disk
[apper#apper ~]$ sudo fdisk /dev/sdc
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-32635, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-32635, default 32635):
Using default value 32635
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[apper#apper ~]$ sudo mkfs -t ext4 /dev/sdc1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
16384000 inodes, 65535151 blocks
3276757 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
2000 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:
Try passing –E lazy_itable_init=1,lazy_journal_init=1 to mkfs.

Very low performance of g_mass_storage virtual usb device

Hello I am using Linux usb gadget facility to emulate a USB flash drive. It is working fine except for very low performance.
I use a 4Gb file, created by dd and created a ext2 or vfat (tried both) partition on it. Than I mount it using the following command sequence:
# modprobe dummy_hcd is_super_speed=1 # I tried is_high_speed=1, and no parameter too
# modprobe g_mass_storage file=/home/del/img/flash stall=0 # tried w/o stall=0 too
# mount /dev/sdc1 /mnt/tmp
After that I get /dev/sdc and /dev/sdc1 devices created without any errors in dmesg:
[1256700.986581] usb 3-1: reset high-speed USB device number 5 using dummy_hcd
[1256701.022551] gadget: high-speed config #1: Linux File-Backed Storage
[1256701.242481] usb 3-1: reset high-speed USB device number 5 using dummy_hcd
[1256701.278422] gadget: high-speed config #1: Linux File-Backed Storage
[1256701.422339] gadget: high-speed config #1: Linux File-Backed Storage
[1256934.915697] usb 3-1: reset high-speed USB device number 5 using dummy_hcd
[1256934.951628] gadget: high-speed config #1: Linux File-Backed Storage
[1256935.915155] usb 3-1: reset high-speed USB device number 5 using dummy_hcd
[1256935.951090] gadget: high-speed config #1: Linux File-Backed Storage
[1256936.095018] gadget: high-speed config #1: Linux File-Backed Storage
[1317073.396892] usb-storage 3-1:1.0: Quirks match for vid 0525 pid a4a5: 10000
[1317073.396995] scsi53 : usb-storage 3-1:1.0
[1317074.411883] scsi 53:0:0:0: Direct-Access Linux File-CD Gadget 0302 PQ: 0 ANSI: 2
[1317074.412669] sd 53:0:0:0: Attached scsi generic sg3 type 0
[1317074.431910] sd 53:0:0:0: [sdc] 8388608 512-byte logical blocks: (4.29 GB/4.00 GiB)
[1317074.443816] sd 53:0:0:0: [sdc] Write Protect is off
[1317074.443821] sd 53:0:0:0: [sdc] Mode Sense: 0f 00 00 00
[1317074.455839] sd 53:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[1317074.551757] sdc: sdc1
[1317074.683704] sd 53:0:0:0: [sdc] Attached SCSI removable disk
The problem is that IO performance is very poor. Writing 200Mb file takes quite a while:
$ ls -lh file
-rw-rw-r-- 1 root del 206M Sep 4 09:34 file
$ time sudo cp file /mnt/tmp/
real 11m59.618s
user 0m0.000s
sys 0m0.260s
Which is about 300K/sec. However the same file on the same system is copied to a real USB flash in less than a minute.
Iotop shows something like this:
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
9986 be/4 root 0.00 B/s 262.05 K/s 0.00 % 99.86 % cp file /mnt/tmp/
20651 be/4 root 51.77 K/s 238.95 K/s 0.00 % 93.23 % [file-storage]
Can anything be done to improve the performance of g_mass_storage-emulated USB drive?
PS: I am using kernel
$ uname -rm
3.2.0-4-686-pae i686
Same here.
After one night at 6:00 i had a solution for me.
modprobe g_mass_storage file=/home/del/img/flash stall=0 buflen=65536
This made up to 5MByte/sec
modprobe g_mass_storage file=/home/del/img/flash stall=0 nofua=1
This made up to 11MByte/sec
A combination of "buflen" and "nofua" did not really helped.
About "nufua" read here: http://lxr.free-electrons.com/source/drivers/usb/gadget/file_storage.c?v=3.5
Ultrasoft /

Resources