LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-18-2009, 04:08 PM   #1
DavidHindman
Member
 
Registered: Dec 2008
Distribution: Slack 13 + JWM
Posts: 101

Rep: Reputation: 23
External USB hard drive doesn't unmount cleanly at shutdown


I have a USB external hard drive. I'm not hot plugging or unplugging it.

My computer has two kinds of USB ports. The built in USB ports are USB1.1. Also, I've added a PCMCIA/Cardbus card (or whatever it's called now) that gives me some USB2.0 ports.

The problem is what occurs when I do shutdown -h now or ctl-alt-del. When the external drive is plugged into a built-in USB port, the drive is unmounted cleanly with no problems. If it's plugged into my USB2.0 PCMCIA adapter, the drive does not unmount cleanly -- it always fscks at the next boot.

I think the problem is that when I do a shutdown or ctl-alt-delete, my USB2.0 adapter gets shut down before the external hard drive gets unmounted. I can see this easily by watching the console in real time. The time stamps in the log files don't have enough resolution to show the exact sequence of events, but you can see what's happening more or less.

Question: In Slackware 12.2, how can I get my external hard drive unmounted before the system shutdown takes down the PCMCIA/Cardbus USB interface that's talking to the external drive? (One way is to do it manually -- I'm looking for something more automatic.)

From /var/log/messages:

Code:
Feb 18 15:29:20 barsoom shutdown[2878]: shutting down for system halt
Feb 18 15:29:20 barsoom init: Switching to runlevel: 0
Feb 18 15:29:27 barsoom sshd[2639]: Received signal 15; terminating.
Feb 18 15:29:27 barsoom logger: /etc/rc.d/rc.inet1:  /sbin/route del default
Feb 18 15:29:27 barsoom logger: /etc/rc.d/rc.inet1:  /sbin/ifconfig eth0 down
Feb 18 15:29:27 barsoom logger: /etc/rc.d/rc.inet1:  /sbin/ifconfig lo down
Feb 18 15:29:27 barsoom kernel: pccard: card ejected from slot 0
Feb 18 15:29:27 barsoom kernel: ohci_hcd 0000:03:00.0: remove, state 1
Feb 18 15:29:27 barsoom kernel: usb usb3: USB disconnect, address 1
Feb 18 15:29:27 barsoom kernel: ohci_hcd 0000:03:00.0: USB bus 3 deregistered
Feb 18 15:29:27 barsoom kernel: ohci_hcd 0000:03:00.0: PCI INT A disabled
Feb 18 15:29:27 barsoom kernel: ohci_hcd 0000:03:00.1: remove, state 1
Feb 18 15:29:27 barsoom kernel: usb usb4: USB disconnect, address 1
Feb 18 15:29:27 barsoom kernel: ohci_hcd 0000:03:00.1: USB bus 4 deregistered
Feb 18 15:29:27 barsoom kernel: ohci_hcd 0000:03:00.1: PCI INT B disabled
Feb 18 15:29:27 barsoom kernel: ehci_hcd 0000:03:00.2: remove, state 1
Feb 18 15:29:27 barsoom kernel: usb usb5: USB disconnect, address 1
Feb 18 15:29:27 barsoom kernel: usb 5-2: USB disconnect, address 2
Feb 18 15:29:27 barsoom kernel: ehci_hcd 0000:03:00.2: USB bus 5 deregistered
Feb 18 15:29:27 barsoom kernel: ehci_hcd 0000:03:00.2: PCI INT C disabled
From /var/log/syslog:
Code:
Feb 18 15:29:27 barsoom kernel: Buffer I/O error on device sda1, logical block 7355
Feb 18 15:29:27 barsoom kernel: lost page write due to I/O error on sda1
Feb 18 15:29:27 barsoom kernel: Buffer I/O error on device sda1, logical block 7356
Feb 18 15:29:27 barsoom kernel: lost page write due to I/O error on sda1
Feb 18 15:29:27 barsoom kernel: REISERFS: abort (device sda1): Journal write error in flush_commit_list
Feb 18 15:29:27 barsoom kernel: REISERFS: Aborting journal for filesystem on sda1
 
Old 02-18-2009, 07:40 PM   #2
armandrix
Member
 
Registered: Nov 2005
Location: Brazil
Distribution: slackware64 -current
Posts: 46

Rep: Reputation: 18
Almost called it as a bug...

Hi DavidHindman..!

I only discarded that idea when i read last block:
Quote:
Question: In Slackware 12.2, ... and so...
If it was about any major distro from nowadays, it'll must be reported, but treating as we must, slack, like it is....

I suggest you to look at rc.scripts(/etc/init.d ??), mainly rc4, 5, 6.., maybe opposite of rc.local (or it's been linked in reboot/shutdown levels???).. There you'll find scripts for this tweaking... Do you have hal or what managing automounts?? are you in stick group??.. so many to watch out!

Unfortunately, i had to leave slack when i move to amd64 machines, i find none of slack alternatives good enough and changed, so .. think cannot help you more than that, but don't forget it: "when in slack, you must manage it on your nail edge.."

it worths!!!


best wishes
 
Old 02-18-2009, 08:07 PM   #3
armandrix
Member
 
Registered: Nov 2005
Location: Brazil
Distribution: slackware64 -current
Posts: 46

Rep: Reputation: 18
Forgotted...

Does it look strange ???
Quote:
pccard: card ejected from slot 0
regards
 
Old 02-18-2009, 08:11 PM   #4
DavidHindman
Member
 
Registered: Dec 2008
Distribution: Slack 13 + JWM
Posts: 101

Original Poster
Rep: Reputation: 23
Quote:
Originally Posted by armandrix View Post
Do you have hal or what managing automounts?
I'm not sure what mounts my external hard drive at boot time. I don't hotplug it, it's always connected to the computer. The drive has one partition, the system's /home. It's reiserfs. I labelled it "colossus-home". I added the following line to /etc/fstab:

Code:
LABEL=colossus-home /home reiserfs   defaults         1   2
The label feature allows Linux to recognize the partition and mount it as /home. It doesn't care if the partition is actually /dev/sda1 or /dev/sdb1 or whatever else.

Quote:
Originally Posted by armandrix View Post
I suggest you to look at rc.scripts(/etc/init.d ??), mainly rc4, 5, 6..,\
Hmm, /etc/rc.d/rc.6 looks like the script that handles shutdowns. Looks promising. Thanks.

Last edited by DavidHindman; 02-18-2009 at 08:14 PM.
 
Old 02-18-2009, 08:25 PM   #5
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 232Reputation: 232Reputation: 232
Quote:
Hmm, /etc/rc.d/rc.6 looks like the script that handles shutdowns. Looks promising. Thanks
.This script calls /etc/rc.d/rc.local_shutdown if it's there and executable which is where to put local shutdown code.
 
Old 02-18-2009, 08:48 PM   #6
DavidHindman
Member
 
Registered: Dec 2008
Distribution: Slack 13 + JWM
Posts: 101

Original Poster
Rep: Reputation: 23
Quote:
Originally Posted by armandrix View Post
Does it look strange ???
Quote:
pccard: card ejected from slot 0
Nothing came flying out of my computer! My USB2.0 adapter is a PCMCIA/Cardbus/PCCARD card or whatever they're calling it this year. It's removeable and maybe theoretically ejectable. I'm guessing that it means the adapter card has been logically removed from the system.

Quote:
Originally Posted by bgeddy View Post
.This script calls /etc/rc.d/rc.local_shutdown if it's there and executable which is where to put local shutdown code.
Thanks, that might be helpful. There are a few more steps that take place after rc.local_shutdown is called. I don't think any of those things require access to /home, so it might work.

I did something else as an experiment. I commented out the following code in /etc/rc.d/rc6:

Code:
# Shut down PCMCIA devices:
# DLH - commented out
#if [ -x /etc/rc.d/rc.pcmcia ]; then
#  . /etc/rc.d/rc.pcmcia stop
  # The cards might need a little extra time here to deactivate:
#  /bin/sleep 5
#fi
I think commenting out this block might leave the PCMCIA/Cardbus/PCCARD USB2.0 interface up long enough for the external drive to get unmounted. Yes, two tests seem to show that the external drive now gets unmounted. There are no error messages in the system log files and the drive doesn't need an fsck at the next boot.

The problem is that I don't know what might be the unintended side effects of commenting out that block of code.
 
Old 02-18-2009, 09:04 PM   #7
armandrix
Member
 
Registered: Nov 2005
Location: Brazil
Distribution: slackware64 -current
Posts: 46

Rep: Reputation: 18
Hi....

I'd read your answwers but cannot think much about it... sorry

Even for the first information that is very relevant...

I can see you mount your usb drive in the home diretory.,. very bad.. I.E. if you use kde desktop environment, it always have a process of konqueror sitting at your home directory...

Slackware needs a must muscle job to take rid of it cause none automounts can easily unmount a busy device..

After what you'd posted before, i can tell you to try to make it mounts it in a specific folder, like /home/fulano/ext-drive/ ... did you got it?? a folder that will be not busy at the "unmount time".. post here if it works,



cheers
 
  


Reply



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
Cannot unmount from external hard drive anthony602 Linux - Newbie 1 05-16-2008 04:39 PM
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
Safe shutdown of external USB hard-drive? blixel Linux - Hardware 3 12-12-2003 12:57 PM
XS Drive II external USB hard drive/card reader max74 Linux - Hardware 7 10-21-2003 10:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:22 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration