LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-23-2011, 06:17 PM   #1
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,731

Rep: Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393
Slackware external drive cronjob help


Hi guys,

I bought a cheap external enclosure for my 2tb hard drive and it is working fine, but the thing keeps going to sleep every 5 or so minutes of inactivity. The enclosure doesn't support advanced power features so I want to make a cronjob to write a zero byte or "ls" the top directory every few minutes to keep it awake, I tried a cronjob that touches the drive every few minutes but its not keeping it awake, so I need a new idea

Thanks in advance.
 
Old 10-23-2011, 07:07 PM   #2
mRgOBLIN
Slackware Contributor
 
Registered: Jun 2002
Location: New Zealand
Distribution: Slackware
Posts: 999

Rep: Reputation: 231Reputation: 231Reputation: 231
fdisk usually wakes things up
 
Old 10-24-2011, 03:52 AM   #3
backblaze.pl
LQ Newbie
 
Registered: Apr 2010
Distribution: Slackware
Posts: 23

Rep: Reputation: 6
Does `hdparm -S 0 -B 251 /dev/sdX' work with this drive? If '-S 0' doesn't work, try high values (RTFM for details), like '-S 251'.

What is wrong with energy-saving anyway? If you access the drive less then 12 times per hour, why shouldn't it sleep? Maybe you should try even shortening the inactivity timeout down to fifteen seconds?

--
Cheers,
backblaze.pl
 
Old 10-24-2011, 07:05 PM   #4
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,731

Original Poster
Rep: Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393
Quote:
Originally Posted by backblaze.pl View Post
Does `hdparm -S 0 -B 251 /dev/sdX' work with this drive? If '-S 0' doesn't work, try high values (RTFM for details), like '-S 251'.

What is wrong with energy-saving anyway? If you access the drive less then 12 times per hour, why shouldn't it sleep? Maybe you should try even shortening the inactivity timeout down to fifteen seconds?

--
Cheers,
backblaze.pl
Nothing is wrong with energy saving but all my files are on the drive so I access it constantly. I have tried the above command before and like I said the enclosure does not support advanced power features. I get errors like this

hdparm -S 0 -B 251 /dev/sdc

/dev/sdc:
setting Advanced Power Management level to 0xfb (251)
HDIO_DRIVE_CMD failed: Input/output error
setting standby to 0 (off)
HDIO_DRIVE_CMD(setidle) failed: Invalid argument
APM_level = not supported

my only option is a cronjob.
 
Old 10-25-2011, 06:16 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
A cron job doing an ls on the drive sounds feasible. Have you tried it? Did you get stuck? If so, where did you get stuck?
 
Old 10-25-2011, 06:35 AM   #6
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
MrGoblin has already suggested fdisk. Have you tried 'fdisk -l >/dev/null 2>&1' ?
 
Old 10-25-2011, 11:42 AM   #7
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
How does the enclosure control the hard drive as described? A link describing the enclosure hardware might help explain what is happening. Possibly a link describing the hard drive too.
 
Old 10-25-2011, 07:09 PM   #8
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,731

Original Poster
Rep: Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393
Sorry for the late reply, I should of been more specific about my cronjob. I have never had to use a cronjob until now, so I guess my question what is the best method to make a cronjob, Right now I just added */1 * * * * ls /mnt/backup &>/dev/null to my /etc/rc.d/rc.local. Is this method ok or is there a better way?

Thanks.
 
Old 10-25-2011, 07:29 PM   #9
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
Quote:
Originally Posted by Daedra View Post
Sorry for the late reply, I should of been more specific about my cronjob. I have never had to use a cronjob until now, so I guess my question what is the best method to make a cronjob, Right now I just added */1 * * * * ls /mnt/backup &>/dev/null to my /etc/rc.d/rc.local. Is this method ok or is there a better way?

Thanks.
I'm not sure I understand. You added the cron command to rc.local? This is definitely not OK. You need to run 'crontab -e' and add it there.
 
Old 10-25-2011, 07:47 PM   #10
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,731

Original Poster
Rep: Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393Reputation: 1393
Yes I did add it rc.local. Thats how I think I screwed up, I am reading man pages on crontab right now. I should know how to do this but ironically I have never had a to use cron until now.
 
Old 10-25-2011, 07:57 PM   #11
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
Yeah, run 'crontab -e' and it'll open in vi and you can put your commands there.

One of the gotchas with crontab to be aware of is that is doesn't have the full system environmental variables like $PATH, so it's always good practice to put the full path of any program you need to run.

/bin/ls

(actually that one may work without the path but you get the idea).

Last edited by dive; 10-25-2011 at 08:05 PM.
 
1 members found this post helpful.
  


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
Slackware 12 and external USB drive linuxhippy Slackware 61 05-07-2008 08:15 PM
Installing Slackware 9.1 on external hard drive? gene69 Linux - Newbie 1 09-18-2005 07:26 PM
Slackware 10.1 Install on External USB Drive SlammedDime Slackware 11 06-21-2005 02:40 AM
Slackware 10.1 and External Drive NetRAVEN5000 Linux - Hardware 4 05-19-2005 06:24 PM
Installing Slackware 9 to external FireWire drive Atdeb Linux - General 1 06-13-2003 11:16 PM

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

All times are GMT -5. The time now is 02:05 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