I have a usb drive mounted to a folder in an Ubuntu 9.04 server installation. The mount options are stored in /etc/fstab for easy mounting/dismounting:
# <file system> <mount point> <type> <options> <dump> <pass> /dev/sdb1 /media/backup ntfs nouser,auto,sync 0 3
(I’ve since changed the portion to a UUID to see if it would help with the problem). A backup has been copying files to the disk every morning without issue. Just now I tried to copy one of the files to another folder, and ended up with the error:
cp: reading `ts01-even.tgz': Input/output error
I discovered that the problem occured because /dev/sdb had changed to /dev/sdc. If I mount /dev/sdc and try to copy the file again, the drive will change back to /dev/sdb. After changing the fstab file system from /dev/sdX1 to a UUID there was no difference in behavior. Also, I used to be able to list the file contents of the tarball, but attempting to do so now results in the above behavior. Any ideas?
running the backup script and storing the backup on the usb HD does not produce the problem, but listing the files in the tarball does. Here is the output of the syslog during the tarball command “tar -ztf FILENAME”:
Jul 3 15:09:14 ts01 kernel: [308398.446893] Buffer I/O error on device sdc1, logical block 786433 Jul 3 15:09:28 ts01 ntfs-3g: ntfs_attr_pread_i: ntfs_pread failed: Input/output error Jul 3 15:09:28 ts01 ntfs-3g: Failed to read of MFT, mft=5 count=1 br=-1: Input/output error Jul 3 15:09:28 ts01 kernel: [308412.404579] Buffer I/O error on device sdc1, logical block 786433 Jul 3 15:09:29 ts01 ntfs-3g: Unmounting /dev/sdc1 (FreeAgent Drive) Jul 3 15:09:32 ts01 ntfs-3g: Version 2009.2.1 external FUSE 27 Jul 3 15:09:32 ts01 ntfs-3g: Mounted /dev/sdb1 (Read-Write, label "FreeAgent Drive", NTFS 3.1) Jul 3 15:09:32 ts01 ntfs-3g: Cmdline options: rw,sync Jul 3 15:09:32 ts01 ntfs-3g: Mount options: rw,sync,silent,allow_other,nonempty,relatime,fsname=/dev/sdb1,blkdev,blksize=4096 Jul 3 15:10:01 ts01 /USR/SBIN/CRON: (root) CMD ([ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd 2>/dev/null) Jul 3 15:11:35 ts01 kernel: [308539.310031] usb 1-1: reset high speed USB device using ehci_hcd and address 38 ... (log repeated with a different address) Jul 3 15:12:47 ts01 kernel: [308611.790038] usb 1-1: reset high speed USB device using ehci_hcd and address 38 Jul 3 15:12:49 ts01 kernel: [308613.148837] end_request: I/O error, dev sdb, sector 84779391 Jul 3 15:12:49 ts01 kernel: [308613.148871] Buffer I/O error on device sdb1, logical block 10597416 ... (log repeated with a different address, with the logical block incrementing by 1 each time) Jul 3 15:12:49 ts01 kernel: [308613.149090] Buffer I/O error on device sdb1, logical block 10597425 Jul 3 15:12:49 ts01 ntfs-3g: ntfs_attr_pread_i: ntfs_pread failed: Input/output error Jul 3 15:12:49 ts01 ntfs-3g: ntfs_attr_pread error reading '/TS01_Backup/ts01-even.tgz' at offset 177012736: 131072 <> -1: Input/output error Jul 3 15:12:49 ts01 ntfs-3g: ntfs_attr_pread_i: ntfs_pread failed: Input/output error Jul 3 15:12:49 ts01 ntfs-3g: ntfs_attr_pread error reading '/TS01_Backup/ts01-even.tgz' at offset 177012736: 4096 <> -1: Input/output error
I found something that seemed relevant, but following the instructions has not proven fruitful: FreeAgent Drives
There are many things that seem wrong with your configuration.
It doesn’t make sense to put USB drives in fstab. Fstab is a mostly static listing of
system storage devices and their mount points. You assign a static drive/partition
identification (based on controller/device address) to a static mount point. Neither
of these are really static for USB drives. In your first example, you’d have problems
if you install a second hard-disk to the system: it would become /dev/sdb, moving your
current USB drive to /dev/sdc, thus breaking your configuration at boot time.
Also, having your drive in fstab and with “auto” option tells the system that the drive
is to be mounted at boot time. If for any reason the drive is disconnected at boot time,
you’ll have your server failing at the boot procedure, which is a really undesirable
situation. If the drive is not essential for the system to function, it at least should
not have the “auto” option.
The “nouser” option is unnecessary, it is the default. The “sync” option is a really
bad idea unless you really know what you are doing. Not only it severely impacts
performance, it also causes additional wearing of the drive, specially flash media.
fs_passno = 3 (sixth column of fstab) causes undefined behavior. Valid values are 0,
1 or 2 only.
Using NTFS with a drive intended for backup of a Linux server. Why are you doing
that? All Linux NTFS implementations are suboptimal, and inadequate to run any Linux
subsystem upon. You should use a native Linux filesystem, like Ext3.
From your kernel log, I could predict that one or more of these may be valid:
You have a malpartitioned disk, i.e. the filesystem was formatted with the wrong
parameters, bigger than the actual partition; or the partition in the partition
table (the logical size) is bigger than the physical size of the drive. This is from
the “Buffer I/O errors” you are seeing. You should consider resetting this disk
completely, including the partition table, and repartitioning and reformatting it
You have a bad sector in your disk (“end_request: I/O errors”). You should consider
badblocksover the disk to check.
Your USB enclosure is not functioning properly (from “usb resets”). If it is an
external hard drive, it should use an independent power supply. The 5V 500mA that is
(sometimes) available from the USB port is not enough to keep the mechanics of a hard
drive running. It may also be overheating, specially cheap USB flash drives.
The NTFS filesystem is corrupted. Fixing it may be possible with
ntfsfix, but you
should remember, again, that NTFS is not a native Linux filesystem. For best results,
you’d need a Windows system to properly check this partition (using Scandisk).
Other suggestions include: stop using NTFS and choose a native Linux filesystem, remove that entry from fstab, manually mount the disk as part of the backup script, umounting it after finished and use UUID or filesystem labels to refer to the disk.
- Install Ubuntu on USB drive then put back HD inside computer?
- USB Drive on Linux (Redhat Ent 5.3) appears to use up available space on my primary drive
- Which /dev/sdX is my usb stick on?
- Rsyncing to a USB drive failing every now and again
- Ubuntu 10.10 Live CD – How to copy files to external USB drive (no permissions?)
Leave a comment
- Cron expression that runs every 5 minutes from 1:30 am – 6:00 am [duplicate]
- Understanding redundant power supplies
- Is there a way for administrators to disable users from installing Firefox extensions?
- Is there research material on NTP accuracy available?
- How to create a limited “domain admin” that does not have access to domain controllers?