You are not logged in.

#1 2010-10-09 12:57:13

halfgaar
Member
Registered: 2010-05-22
Posts: 50

Making a hard disk inaccessible

Hi,

I have a third hard disk in my machine for Windows. When in Linux, I want it to spin down because it makes noise. I already tried the hdparm -y and -Y and such, but there still are some instances where the disk is accessed and therefore spins up (for example, opening a "save as" dialog in Thunderbird).

Is it possible, with some command, udev rule or kernel parameter or something, to make the disk not be seen by the kernel?

Offline

#2 2010-10-09 13:33:52

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Making a hard disk inaccessible

Maybe you can disable it in BIOS or unmount it in the system.

Offline

#3 2010-10-09 17:20:29

halfgaar
Member
Registered: 2010-05-22
Posts: 50

Re: Making a hard disk inaccessible

Disabling in the BIOS doesn't help, because the Linux kernel does its own hard disk detection.

And unmounting works on servers, in my experience, but as I mentioned, some things (like the "save as" dialog in Thunderbird) cause it to spin up again. I guess it's because of dbus/hal discovering devices.

Offline

#4 2010-10-09 17:24:08

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Making a hard disk inaccessible

The disk is only accessed because it's mounted, if it's not mounted, then there won't be any access to it when a program looks for locations to save a file. It can only save to mounted locations, after all...


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#5 2010-10-09 17:57:38

halfgaar
Member
Registered: 2010-05-22
Posts: 50

Re: Making a hard disk inaccessible

I know how mounting works. Keeping it unmounted on a server system works fine, but modern desktop systems work differently. When I open the thunderbird save-as dialog, I get a list of devices on the left side. One is a 137 GB disk, which is the disk in question.

"mount |grep -i sdc" doesn't give any output BTW, so it's really not mounted.

Offline

#6 2010-10-13 12:59:09

gonX
Member
From: Denmark
Registered: 2009-08-16
Posts: 112

Re: Making a hard disk inaccessible

You can try 'chmod 000 /dev/sdX' as root, with X being the hard drive you want to prevent access to. You won't be able to access the drive before you change the chmod settings back however.

Last edited by gonX (2010-10-13 12:59:30)


since 2009

Offline

#7 2010-10-13 20:56:34

halfgaar
Member
Registered: 2010-05-22
Posts: 50

Re: Making a hard disk inaccessible

gonX wrote:

You can try 'chmod 000 /dev/sdX' as root, with X being the hard drive you want to prevent access to. You won't be able to access the drive before you change the chmod settings back however.

Doesn't help sad And accessing the drive works fine, even with perms 000... Weird...

Offline

#8 2010-10-14 11:19:54

kfgz
Member
From: Supraśl, Poland
Registered: 2009-03-02
Posts: 114

Re: Making a hard disk inaccessible

Sumount?

It requires scsiadd and lsscsi.

Script:

#!/bin/sh

if [ $# -ne 1 ]; then
    echo "Usage: $0 <device>"
    exit 1
fi

if ! which lsscsi >/dev/null 2>&1; then
    echo "Error: lsscsi not installed";
    exit 1
fi

if ! which scsiadd >/dev/null 2>&1; then
    echo "Error: scsiadd not installed"
    exit 1
fi

device=`lsscsi | grep $1`
if [ -z "$device" ]; then
    echo "Error: could not find device: $1"
    exit 1
fi

hcil=`echo $device | awk \
    '{split(substr($0, 2, 7),a,":"); print a[1], a[2], a[3], a[4]}'`

scsiadd -r $hcil

Last edited by kfgz (2010-10-14 11:22:50)

Offline

#9 2010-10-16 21:51:03

nitroguy
Member
Registered: 2009-10-16
Posts: 16

Re: Making a hard disk inaccessible

halfgaar wrote:
gonX wrote:

You can try 'chmod 000 /dev/sdX' as root, with X being the hard drive you want to prevent access to. You won't be able to access the drive before you change the chmod settings back however.

Doesn't help sad And accessing the drive works fine, even with perms 000... Weird...

My guess is that HAL is giving you the rights as a user on the console.

Offline

#10 2010-10-18 09:24:03

halfgaar
Member
Registered: 2010-05-22
Posts: 50

Re: Making a hard disk inaccessible

@kfgz
it worked, except that I had to run the scsiadd -r command manually; the script you provided didn't work. I'll bugfix that later...

Thanks

Offline

Board footer

Powered by FluxBB