Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
I have a recently configured Squeeze system: Operating system: Debian Linux 6.0 Kernel and CPU: Linux 2.6.32-5-686 on i686 Processor information: AMD Athlon(tm) XP 1900+, 1 cores Real memory: 502.63 ...
  1. #1
    Just Joined!
    Join Date
    Mar 2011
    Posts
    7

    Tar Backup & Broken Pipe Issue

    I have a recently configured Squeeze system:
    Operating system: Debian Linux 6.0
    Kernel and CPU: Linux 2.6.32-5-686 on i686
    Processor information: AMD Athlon(tm) XP 1900+, 1 cores
    Real memory: 502.63 MB total, 88.67 MB used
    Local disk space: 1003.43 GB total, 565.60 GB used

    Disk name Total size Make and model Partitions Actions
    SATA device A 74.53 GB ATA ST380011A 2 IDE parameters
    SATA device B 6.03 GB ATA Maxtor 90648D3 1 IDE parameters
    SCSI device D 931.51 GB Seagate Portable 1

    SATA device A:
    Number Type Extent Size Start End Used by
    1 Linux 243.17 MB 1 31 /boot
    2 Linux LVM 74.29 GB 32 9729 LVM VG debsrv

    SATA device B:
    Number Type Extent Size Start End Used by
    1 Linux LVM 6.03 GB 1 787

    SCSI device D:
    Number Type Extent Size Start End Used by
    1 NTFS 931.51 GB 1 121601 /mnt/Backup
    I'm wondering if anyone could help resolve the following problem relating to backup failures:

    I mounted a Seagate 1Tb external usb drive (SCSI device C) using the following command:
    mount -t ntfs-3g /dev/sdc1 /mnt/Backup -o umask=0,nls=utf8
    ... the device taking in excess of 30 seconds to mount. I was then able browse the contents of the drive without any problem.

    However when I run a tar backup from either cron or the command line I get the following error:
    gzip: stdout: Input/output error
    tar: /mnt/Backup/NewBackups/20110308_065435/20110308_065435_Shared.tar.gz: Wrote only 2048 of 10240 bytes
    tar: Error is not recoverable: exiting now
    tar: Removing leading `/' from member names
    tar (child): /mnt/Backup/NewBackups/20110308_065435/20110308_065435_UserShares.tar.gz: Cannot open: Input/output error
    tar (child): Error is not recoverable: exiting now
    /home/UserShares/
    /home/UserShares/CTS/
    /home/UserShares/CTS/LYONS/
    /home/UserShares/CTS/LYONS/Build Agreement 04th May 2010.pdf
    tar: /mnt/Backup/NewBackups/20110308_065435/20110308_065435_UserShares.tar.gz: Cannot write: Broken pipe
    tar: Error is not recoverable: exiting now
    Shortly after the failure the USB drive reappears unmounted on the system as SCSI device D!

    The first few times I ran the backup script it got as far as:
    Wrote only 4096 of 10240 bytes

    before failing. After which I did some research online and found the following command to disable STANDBY on the USB drive:
    sdparm --set=STANDBY=0 --long --save /dev/sdc
    The current drive settings are as follows:
    # sdparm -al /dev/sdd
    /dev/sdd: Seagate Portable 0130
    Direct access device specific parameters: WP=0 DPOFUA=0
    Power condition [po] mode page:
    IDLE 0 [cha: n, def: 0, sav: 0] Idle timer active
    STANDBY 0 [cha: y, def: 1, sav: 0] Standby timer active
    ICT 0 [cha: n, def: 0, sav: 0] Idle condition timer (100 ms)
    SCT 4294967286 [cha: y, def:3000, sav:4294967286] Standby condition timer (100 ms)
    #
    Any assistance would be greatly appreciated.

  2. #2
    Just Joined! computer_brad's Avatar
    Join Date
    Mar 2011
    Posts
    6
    I may well be wrong, but every usb drive I use also has a partition on it. I open the package, plug it in, and it's /dev/sdb2.

    another interesting thing to check, would be to see if you can touch /mnt/backup/testfile

    If it does create the file, can you edit it?

  3. #3
    Just Joined!
    Join Date
    Mar 2011
    Posts
    7
    Thanks for your reply, computer_brad.

    When I tried to list the contents of the mount point I got an error. I realised the mounted partitons were showing the external USB drive as mounted on sdc1 whereas since the tar error the drive was now showing as sdd1!

    I tried unmounting sdc1 but got a "busy" error. Now when I run the df command I am getting the following error:

    Transport endpoint is not connected
    I will reboot the server at the end of the day when the users are no longer connected and try what you have suggested. The interesting things is that the daily backup directory is created in the first step of the backup job.

    I'll let you know how I get on.

    Thanks again.

  4. #4
    Just Joined!
    Join Date
    Mar 2011
    Posts
    7
    Just a quick update. I rebooted the server and was able to mount the USB drive, having deleted the original mountpoint directory and created the new one:

    mount -t ntfs-3g /dev/sdc1 /mnt/backup
    I was able to run the command computer_brad suggested:

    touch /mnt/backup/testfile
    and was able to edit the file without any problem.

    Next, I thought I would try to see if I could just do a straight copy of one of the directories I need to backup:

    # cd /mnt/backup
    # pwd
    /mnt/backup
    # cd NewBackups
    # pwd
    /mnt/backup/NewBackups
    # mkdir 20110315_072940
    # ls -l
    total 0
    drwxrwxrwx 1 root root 0 Mar 8 02:03 20110308_020325
    drwxrwxrwx 1 root root 0 Mar 15 07:29 20110315_072940
    # cd 20110315_072940
    # cp -r /home/UserShares .
    Within a few seconds I got the same error as before:

    cp: writing `./UserShares/20110218_Charlie.pst': Input/output error
    cp: cannot create directory `./UserShares/Important': Input/output error
    cp: cannot create directory `./UserShares/REC': Input/output error
    cp: cannot create directory `./UserShares/Charlie': Input/output error
    cp: cannot create directory `./UserShares/YR 1': Input/output error
    cp: cannot create regular file `./UserShares/Helpful Tips - Remember to Check These.pdf': Input/output error
    # ls
    ls: reading directory .: Input/output error
    #
    I then logged into webmin and checked the Hardware > Partitions on Local Disks section and found the USB drive appearing now as SCSI device D instead of SCSI device C which it was displaying originally.

    I checked /var/log/messages:

    Mar 15 07:31:09 debsrv-mustang kernel: [19432.291306] usb 1-1: USB disconnect, address 2
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.291605] sd 2:0:0:0: [sdc] Unhandled error code
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.291609] sd 2:0:0:0: [sdc] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.291616] sd 2:0:0:0: [sdc] CDB: Write(10): 2a 00 44 d5 fa 6f 00 00 50 00
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.291690] lost page write due to I/O error on sdc1
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.291724] lost page write due to I/O error on sdc1
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.291751] lost page write due to I/O error on sdc1
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.291778] lost page write due to I/O error on sdc1
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.291804] lost page write due to I/O error on sdc1
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.291831] lost page write due to I/O error on sdc1
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.291858] lost page write due to I/O error on sdc1
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.291884] lost page write due to I/O error on sdc1
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.291911] lost page write due to I/O error on sdc1
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.291937] lost page write due to I/O error on sdc1
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.296107] sd 2:0:0:0: [sdc] Unhandled error code
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.296112] sd 2:0:0:0: [sdc] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
    Mar 15 07:31:09 debsrv-mustang kernel: [19432.296118] sd 2:0:0:0: [sdc] CDB: Write(10): 2a 00 45 44 ee 8f 00 00 f0 00
    Mar 15 07:31:28 debsrv-mustang kernel: [19452.052047] usb 1-1: new full speed USB device using uhci_hcd and address 3
    Mar 15 07:31:29 debsrv-mustang kernel: [19452.220023] usb 1-1: New USB device found, idVendor=0bc2, idProduct=2300
    Mar 15 07:31:29 debsrv-mustang kernel: [19452.220028] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    Mar 15 07:31:29 debsrv-mustang kernel: [19452.220033] usb 1-1: Product: Portable
    Mar 15 07:31:29 debsrv-mustang kernel: [19452.220036] usb 1-1: Manufacturer: Seagate
    Mar 15 07:31:29 debsrv-mustang kernel: [19452.220039] usb 1-1: SerialNumber: 2GH5QJ2G
    Mar 15 07:31:29 debsrv-mustang kernel: [19452.220216] usb 1-1: configuration #1 chosen from 1 choice
    Mar 15 07:31:29 debsrv-mustang kernel: [19452.222391] scsi3 : SCSI emulation for USB Mass Storage devices
    Mar 15 07:31:34 debsrv-mustang kernel: [19457.224477] scsi 3:0:0:0: Direct-Access Seagate Portable 0130 PQ: 0 ANSI: 4
    Mar 15 07:31:34 debsrv-mustang kernel: [19457.227046] sd 3:0:0:0: Attached scsi generic sg4 type 0
    Mar 15 07:31:34 debsrv-mustang kernel: [19457.233219] sd 3:0:0:0: [sdd] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
    Mar 15 07:31:34 debsrv-mustang kernel: [19457.236381] sd 3:0:0:0: [sdd] Write Protect is off
    Mar 15 07:31:34 debsrv-mustang kernel: [19457.244217] sdd: sdd1
    Mar 15 07:31:34 debsrv-mustang kernel: [19457.299197] sd 3:0:0:0: [sdd] Attached SCSI disk
    The USB drive was bought a few weeks ago and has had no trouble being used to run backups under SBS2008.
    I would be grateful if anyone has any ideas what I can do to get the backups working to the USB drive.

    Thanks again.

  5. #5
    Just Joined! computer_brad's Avatar
    Join Date
    Mar 2011
    Posts
    6
    well... it looks to me like your USB is shutting down. (called auto-suspend)

    There is a way to stop this.

    First, I would make a backup of /sys/devices

    then, after you made sure your backup worked, I would issue:

    Code:
    find /sys -path "*usb*" -name autosuspend | while read f; do
      echo -1 >$f
    done
    see if that cures it. You might need to reboot, not sure. This is getting close to my realm of understanding... I'm just not that much of a kernel guru.

    let me know!

  6. #6
    Just Joined! computer_brad's Avatar
    Join Date
    Mar 2011
    Posts
    6
    oh yea... sometimes USB hubs do this too. If you are using one, try plugging your device in directly

  7. #7
    Just Joined!
    Join Date
    Mar 2011
    Posts
    7
    Thanks for your reply again, compouter_brad.

    I backed up /sys/devices as you suggested:

    # cd /sys
    # tar -czvf /root/sysDevices.tar.gz ./devices/
    ... but got the following message upon completion:

    tar: Exiting with failure status due to previous errors
    n.B. There were a significant number of "Permission denied", "Operation not supported", "No such device or address" and "Input/output error" messages. I've attached the full output in a .zip file along with the output from a test recovery for reference.

    I checked the the backup file had been produced and ran a test restore to the root home directory:

    # ls -l /root/sysDevices.tar.gz
    -rw-r--r-- 1 root root 507736 Mar 18 07:07 /root/sysDevices.tar.gz
    # cd /root
    # tar xvzf sysDevices.tar.gz
    n.B. The test restore appeared to complete without any errors and appears to have restored everything.

    Does the fact that the tar backup exited with errors mean that it would now not be a good idea to run the command to fix autosuspend on the USB device?

    Many thanks again.
    Attached Files Attached Files

  8. #8
    Just Joined! computer_brad's Avatar
    Join Date
    Mar 2011
    Posts
    6
    Sorry I wasn't around this weekend. Been fighting a migrane. I took a look at your output. It seems that the permission denied is because the files are in use. Yes, it appears that your backup did work. I would say go ahead and fix the auto-suspend.

  9. #9
    Just Joined!
    Join Date
    Mar 2011
    Posts
    7
    No problem, computer_brad. I hope you are feeling better now.

    Thanks for the confirmation.
    I will give this a try later and let you know how I get on.

  10. #10
    Just Joined!
    Join Date
    Mar 2011
    Posts
    7
    I ran the command:

    find /sys -path "*usb*" -name autosuspend | while read f; do echo -1 > $f; done
    ... and rebooted the machine. However, when I tried to mount the USB drive with either of the following commands:

    mount -t ntfs-3g /dev/sdc1 /mnt/Backup -o umask=0,nls=utf8
    or:

    mount -t ntfs /dev/sdc1 /mnt/Backup
    I get the following error:

    $MFTMirr does not match $MFT (record 0).
    Failed to mount '/dev/sdc1': Input/output error
    NTFS is either inconsistent, or there is a hardware fault, or it's a
    SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows
    then reboot into Windows twice. The usage of the /f parameter is very
    important! If the device is a SoftRAID/FakeRAID then first activate
    it and mount a different device under the /dev/mapper/ directory, (e.g.
    /dev/mapper/nvidia_eahaabcc1). Please see the 'dmraid' documentation
    for more details.
    I'm beginning to wonder if I might just be better off reformatting the external USB drive as follows:

    mkntfs -Q -v -L “DISKLABEL” /dev/sdc1
    or:

    mkfs.ext3 /dev/sdc1
    e2label /dev/sdc1 Backup
    or:

    mkfs.vfat /dev/sdc1
    Given I will need to access the data on the backup drive from a windows machine XP/7 as well in future, I would be grateful if anyone could advise which of the above formatting options would be the best to use?

    Many thanks again

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •