LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 02-10-2011, 05:57 PM   #1
mturob
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Rep: Reputation: 0
Will an external usb hard drive remount on wake from sleep?


I have a headless server running Ubuntu 9.04 which a bash script sends to sleep after a certain period of network inactivity using the command sleep.sh to save power. It's only used in the evenings to serve files and audio via mediatomb.

Now I would like to buy a 1T external usb drive to use with this server.

My question: is the external drive likely to remount automagically when the server wakes from sleep? And if not will it be reasonably easy to cure by a script in the right place to run at wake time?

I'd be grateful for any advice before buying the drive.

Apologies if this is not the right part of the forum for this question or for any infringment of normal etiquette, this is my first post.

Rob
 
Old 02-10-2011, 09:14 PM   #2
frankbell
Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Mageia, Mint
Posts: 7,576

Rep: Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433
I have two external USB drives on two different computers--one Debian and one Ubuntu. I don't normally suspend or hibernate any computer, but here's what I've experienced.

The one in the Ubuntu computer is not in fstab, but mounts just fine on reboot.

The Debian computer is my home file server, so I wanted the USB drive to mount to the same mount point all the time. I created mountpoints for the two partitions and put them in fstab, marked for "auto," as follows; they behave just as if they were on an internal hard drive.

Code:
/dev/sdb1       /media/sdb1     ext3    rw,user,auto    0      1
/dev/sdb5       /media/sdb5     ext3    rw,user,auto    0      1
Hope this helps.
 
1 members found this post helpful.
Old 02-10-2011, 09:30 PM   #3
EDDY1
Guru
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 5,290

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
frankbell
Quote:
/dev/sdb1 /media/sdb1 ext3 rw,user,auto 0 1
/dev/sdb5 /media/sdb5 ext3 rw,user,auto 0 1
I'm not original poster, but I'd like to know, if I put this entry in my computer will it automatically load my other ext hdd's at that point or would it just be that 1 hdd?
Excuse me for asking as I only seek info.
 
Old 02-11-2011, 04:45 PM   #4
jefro
Guru
 
Registered: Mar 2008
Posts: 11,340

Rep: Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386
I can't be sure that an external would spin down as part of acpi.

Bios, bios settings, motherboard support, OS support and the external drive would all have to be both known and well tested to answer.

I do think that on older installs it gets less likely. Since the drive is cheap enough it would be a matter of testing go no go.
 
1 members found this post helpful.
Old 02-11-2011, 08:07 PM   #5
frankbell
Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Mageia, Mint
Posts: 7,576

Rep: Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433
Quote:
Originally Posted by EDDY1 View Post
I'm not original poster, but I'd like to know, if I put this entry in my computer will it automatically load my other ext hdd's at that point or would it just be that 1 hdd?
Excuse me for asking as I only seek info.
Not by itself. You need to do several things.

1. Determine how your system is viewing the HDD. I like to use dmesg for this.

Here's how my podplayer shows in dmesg (slightly edited for clarity):

Code:
[356289.690541] scsi 18:0:0:1: Direct-Access     iriver   E150             0100 PQ: 0 ANSI: 0 CCS
[356289.690931] sd 18:0:0:0: Attached scsi generic sg5 type 0
[356289.734539] sd 18:0:0:0: [sdd] 15134720 512-byte logical blocks: (7.74 GB/7.21 GiB)
[356289.736976] sd 18:0:0:0: [sdd] Write Protect is off
[356289.736981] sd 18:0:0:0: [sdd] Mode Sense: 00 12 00 00
[356289.742395] sd 18:0:0:0: [sdd] Assuming drive cache: write through
[356289.742403]  sdd:
[356289.746018] sd 18:0:0:0: [sdd] Assuming drive cache: write through
[356289.746022] sd 18:0:0:0: [sdd] Attached SCSI removable disk
Therefore, if I wanted to add it to fstab, it would be /dev/sdd.


2. Create a mountpoint, that is a directory to which to mount the drive, in /media or /mnt (the current fashion is to put it in /media). You can call the directory anything you want, like Ralph or Fred or podplayer. I've gotten so I usually name it after the dmesg output (/media/sdd in the above example).

3. Then add the device to fstab like this:

device . . . . mountpoint . . . . file system . . . . read/write_permissions,owner,auto/not_automount . . . . other_stuff.

More about fstab syntax here.

The first time I did this (USB stick and Slackware 10.0), I felt like I was penetrating a mystery. Now I'm really really glad I learned how.
 
1 members found this post helpful.
Old 02-13-2011, 04:59 PM   #6
mturob
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Original Poster
Rep: Reputation: 0
I'm very grateful for this quick and detailed advice. It sounds as though it should be possible to get this to work although until actually trying it is not easy to know whether additional steps will be needed. I'll order the drive (possibly after month end..) and if necessary as frankbell suggests dmesg should help me work out what to do with fstab. I'll post results back here in due course.

Thanks frankbell and jefro
 
Old 06-21-2011, 04:56 PM   #7
mturob
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Hi Again, after a brief delay awaiting favourable conditions in fundspace I bought the external drive. These are the results so far.

I was able to mount the drive, format it to ext3 and set up what I think is an appropriate fstab entry:

/dev/sdb1 /mnt/wdig1 ext3 defaults 0,0

So far so good. **Unfortunately after waking from sleep the drive is no longer accessible**, giving an i/o error for example if I do ls /mnt/wdig1.

dmesg suggests that on wake the server is naming the external drive /sdc rather than /sdb. Further /sdb is now generating a number of nasty looking dmesg entries - I'll post some of this below.

The only idea I have is to add a line such as umount /dev/wdig1 into the script which sends the server to sleep on network activity. Then I'll have to find out how to set up a script which runs on wake in order to remount the drive. I may also try redoing the ext3 format while the drive is still blank.

Here is the dmesg output:

[ 4.795229] PM: Finishing wakeup.
[ 4.795231] Restarting tasks ... done.
[ 4.953735] usb 4-1: USB disconnect, address 3
[ 4.992537] Buffer I/O error on device sdc1, logical block 0
[ 4.992611] lost page write due to I/O error on sdc1
[ 5.073633] usb 4-1: new high speed USB device using ehci_hcd and address 4
[ 5.224671] usb 4-1: configuration #1 chosen from 1 choice
[ 5.228125] scsi4 : SCSI emulation for USB Mass Storage devices
[ 5.233720] usb-storage: device found at 4
[ 5.233728] usb-storage: waiting for device to settle before scanning
[ 5.574543] Intel(R) PRO/1000 Network Driver - version 7.3.20-k2-NAPI
[ 5.574551] Copyright (c) 1999-2006 Intel Corporation.
[ 5.574629] ACPI: PCI Interrupt 0000:01:0c.0[A] -> GSI 18 (level, low) -> IRQ 18
[ 5.861747] e1000: 0000:01:0c.0: e1000_probe: (PCI:33MHz:32-bit) 00:0b:db:50:35:eb
[ 5.903367] e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection
[ 5.992203] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 6.123858] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 6.173208] ata2.01: failed to IDENTIFY (I/O error, err_mask=0x1)
[ 6.173216] ata2: failed to recover some devices, retrying in 5 secs
[ 7.782460] e1000: eth0: e1000_watchdog: NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX
[ 7.785694] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 10.232498] usb-storage: device scan complete
[ 10.234863] scsi 4:0:0:0: Direct-Access WD Ext HDD 1021 2021 PQ: 0 ANSI: 4
[ 10.249098] sd 4:0:0:0: [sdc] 1953519616 512-byte hardware sectors (1000202 MB)
[ 10.250948] sd 4:0:0:0: [sdc] Write Protect is off
[ 10.250957] sd 4:0:0:0: [sdc] Mode Sense: 17 00 10 08
[ 10.250961] sd 4:0:0:0: [sdc] Assuming drive cache: write through
[ 10.252809] sd 4:0:0:0: [sdc] 1953519616 512-byte hardware sectors (1000202 MB)
[ 10.254697] sd 4:0:0:0: [sdc] Write Protect is off
[ 10.254705] sd 4:0:0:0: [sdc] Mode Sense: 17 00 10 08
[ 10.254708] sd 4:0:0:0: [sdc] Assuming drive cache: write through
[ 10.254814] sdc:<4>ata2.01: failed to IDENTIFY (I/O error, err_mask=0x1)
[ 11.340296] ata2: failed to recover some devices, retrying in 5 secs
[ 16.887346] ata2.00: configured for UDMA/33
[ 18.356139] eth0: no IPv6 routers present
[ 22.061387] sdc1
[ 22.061481] sd 4:0:0:0: [sdc] Attached SCSI disk
[ 22.061536] sd 4:0:0:0: Attached scsi generic sg2 type 0
[ 22.201886] EXT3-fs error (device sdc): ext3_check_descriptors: Block bitmap for group 880 not in group (block 0)!
[ 22.203876] EXT3-fs: group descriptors corrupted!
[ 22.368774] kjournald starting. Commit interval 5 seconds
[ 22.370127] EXT3 FS on sdc1, internal journal
[ 22.370134] EXT3-fs: recovery complete.
[ 22.370139] EXT3-fs: mounted filesystem with ordered data mode.
[ 1001.964921] EXT3-fs error (device sdb1): ext3_find_entry: reading directory #2 offset 0
[ 1001.966285] WARNING: at /build/buildd/linux-2.6.24/fs/buffer.c:1169 mark_buffer_dirty()
[ 1001.966294] Pid: 31847, comm: less Not tainted 2.6.24-16-server #1
[ 1001.966316] [<c01bc254>] mark_buffer_dirty+0x74/0x90
[ 1001.966335] [<f89d4798>] ext3_commit_super+0x48/0x80 [ext3]
[ 1001.966355] [<f89d534a>] ext3_handle_error+0x6a/0xb0 [ext3]
[ 1001.966368] [<c01322cb>] printk+0x1b/0x20
[ 1001.966381] [<f89d5445>] ext3_error+0x55/0x60 [ext3]
[ 1001.966398] [<f89d2b49>] ext3_find_entry+0x4c9/0x660 [ext3]
[ 1001.966415] [<c01bb974>] __find_get_block_slow+0xc4/0x150
[ 1001.966448] [<c0127947>] enqueue_task_fair+0x27/0x30
[ 1001.966459] [<c0223eed>] number+0x35d/0x370
[ 1001.966484] [<f89d449c>] ext3_lookup+0x3c/0x120 [ext3]
[ 1001.966495] [<c01ac6f4>] d_alloc+0x114/0x1a0
[ 1001.966510] [<c01a1cd2>] do_lookup+0x122/0x1a0
[ 1001.966524] [<c01a3c43>] __link_path_walk+0x703/0xe10
[ 1001.966536] [<c018080f>] __do_fault+0x2af/0x4c0
[ 1001.966555] [<c01a4395>] link_path_walk+0x45/0xc0
[ 1001.966571] [<c019894b>] do_filp_open+0x4b/0x60
[ 1001.966584] [<c0123feb>] check_pgt_cache+0x1b/0x20
[ 1001.966600] [<c01a45e7>] do_path_lookup+0x77/0x200
[ 1001.966605] [<c01a333a>] getname+0xaa/0xe0
[ 1001.966613] [<c01a504b>] __user_walk_fd+0x3b/0x60
[ 1001.966623] [<c019ddc2>] vfs_stat_fd+0x22/0x60
[ 1001.966639] [<c019894b>] do_filp_open+0x4b/0x60
[ 1001.966650] [<c0123feb>] check_pgt_cache+0x1b/0x20
[ 1001.966663] [<c019dedf>] sys_stat64+0xf/0x30
[ 1001.966671] [<c01a691f>] do_ioctl+0x7f/0x90
[ 1001.966681] [<c01a6b5e>] vfs_ioctl+0x22e/0x2b0
[ 1001.966693] [<c01a6c36>] sys_ioctl+0x56/0x70
[ 1001.966703] [<c010839a>] sysenter_past_esp+0x6b/0xa1
[ 1001.966727] =======================
[ 1001.966753] Buffer I/O error on device sdb1, logical block 0
[ 1001.967014] lost page write due to I/O error on sdb1

Any suggestions would be much appreciated. Unless advised otherwise I'll try my idea of unmounting before sleeping/remounting on wake plus maybe reformating in a couple of days.

Rob
 
Old 06-24-2011, 09:15 PM   #8
EDDY1
Guru
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 5,290

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
Is the external usb drive one of those western digital with it's own enclosure, if so it has software to the SD/cruzer-g storages. What model is your external harddrive?
 
1 members found this post helpful.
Old 06-25-2011, 01:48 AM   #9
EDDY1
Guru
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 5,290

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
WD Ext HDD 1021 2021 When you formatted for linux you overwrote the windows & mac software. If you can't get it to work in linux, go to a windows or mac machine & download the software to repair. You may have to create a ntfs partition then Ext3 following that, not exactly sure, but someone here can either comfirm or lead you on the right direction. The i/o errors are from the overwrite that I am sure as I did it on a mac.
 
1 members found this post helpful.
Old 07-04-2011, 07:14 PM   #10
mturob
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks EDDY1,
I'm continuing to try and get this to work in Linux for now. It seems from Googling that the ext3 descriptors error block bitmap for block 880... error is not uncommon. Using fsck is often suggested but as it seems that this can be risky if done wrongly I am trying to understand as much as possible first. I'm not sure if the problem is a phyisical fault. If so, presumably fsck is used to ensure that bad sectors are not used. If the problem is not physical I can't see why it is not simplest just to recreate and reformat the single ext3 partition.
I still suspect that doing pm-suspend without unmounting may have caused this issue.
Rob
 
Old 07-05-2011, 01:29 AM   #11
EDDY1
Guru
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 5,290

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
The wd external hdd comes with windows & mac software similar to some of the usb storage drives.
 
1 members found this post helpful.
Old 07-05-2011, 03:53 AM   #12
mturob
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Hi EDDY1,

sorry if I am being slow on the uptake here. Is the windows&mac software to which you refer something that can be used to repair the disk so that I can then reformat and use in linux? Or is the windows&mac software something that needs to be present for ongoing use of the drive?
Eg. are you suggesting that I download the windows&mac software that I seem to have overwritten, then run it to do....? Or simply replace it on the drive?

Rob
 
Old 07-05-2011, 04:13 AM   #13
EDDY1
Guru
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 5,290

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
The wd essentials has a repair tool.
tHis one is for XP
http://support.wdc.com/product/downl...sid=34&lang=en


Linux support
http://wdc.custhelp.com/app/answers/...UFl5S2xjeWs%3D
 
1 members found this post helpful.
Old 07-05-2011, 04:38 AM   #14
mturob
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks for those useful links EDDY1.

They led to the WD community forum where I found some advice suggesting that I have done the right thing so far by simply formatting the whole drive to ext3 and reclaiming the admin space using tune2fs.

I may try the recovery tool with Windows if I get stuck fixing things in linux. There seem to be quite a few people using these drives with linux so I am hopeful.

Rob
 
Old 07-05-2011, 09:10 PM   #15
EDDY1
Guru
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 5,290

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
The wd passport is readable & useable in linux.
Put the windows firmware back & if you format ext3 or 4 just don't overwrite the software that makes it readable.
Also linux can read & write to ntfs.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Booting Linux on an external USB hard drive (not a memory stick, a hard drive) comcastuser Linux - Hardware 4 01-13-2010 06:59 PM
How do I wake up an external hard drive on boot? cypher181 Linux - Software 1 05-20-2008 04:07 AM
External USB hard drive unmounts, can't remount or figure out what's causing it adanedhel728 Ubuntu 7 04-21-2008 01:26 AM
external enclosure for an internal hard drive vs external USB hard drive powah Linux - Hardware 1 03-10-2006 09:03 AM
Installing grub to external USB hard drive for later use as internal hard drive dhave Linux From Scratch 2 12-10-2005 08:48 AM


All times are GMT -5. The time now is 10:43 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration