Projects / hdparm / Comments

Comments for hdparm

13 Dec 2003 18:08 xose

Re: Do NOT enable -W1! DO USE -W0 instead!

>
> % There is small (VERY SMALL) potential
> % for losing a disk write on sudden
> % powerfail with the drive caching
> % enabled. But this is so small as to be
> % insignificant for nearly all of us ...
%
> Why do you say the probability is
> insiginificant? Maybe you don't have an
> environment with unreliable power?

write back cache ON is not recommended, there are a lot of literature about that:


http://listman.redhat.com/archives/ext3-users/2003-February/msg00109.html
http://sr5tech.com/write_back_cache_experiments.htm
http://sr5tech.com/download/ATA_RAID5_Whitepaper.pdf
http://archives.postgresql.org/pgsql-admin/2000-12/msg00094.php
http://redhat.com/archives/fedora-test-list/2003-November/msg01447.html
http://redhat.com/archives/fedora-test-list/2003-December/msg00001.html
http://marc.theaimsgroup.com/?t=104991701200010&r=1&w=2
http://marc.theaimsgroup.com/?t=107014526000001&r=2&w=2
http://marc.theaimsgroup.com/?l=linux-kernel&m=106745860511194&w=2

11 Dec 2003 11:43 sweikart

Re: Do NOT enable -W1! DO USE -W0 instead!

> There is small (VERY SMALL) potential
> for losing a disk write on sudden
> powerfail with the drive caching
> enabled. But this is so small as to be
> insignificant for nearly all of us ...

Why do you say the probability is insiginificant? Maybe you don't have an environment with unreliable power?

> enabling the write cache does FAR MORE
> than just "cheat benchmarks" -- it
> really does improve system response and
> throughput quite noticeably.

Once we have TCQ, enabling the disk's write cache *should* not affect performance.

> I use -W1 continuously during kernel
> development, with extremely frequent
> crashes and have never, ever, lost even
> a sector of data.

A crash has no relationship to a power failure.

If you want to test power failures, you should try pulling out the power cord during heavy write activity (with modern motherboards, I no longer understand what the power switch does).

-scott

17 Jun 2003 05:39 ideguy

Re: registering IF by hdparm with no device

> was it clear ?
> will you write a patch, or this is
> impossible ?
>
> thanks
>


I don't think it is possible to "fix" this without patching the driver (kernel), and that is not going to happen until the IDE driver is updated completely (2.5.xx) to handle hotswap.

But.. if there are no drives/interfaces currently registered, then you should be able to "rmmod" the ide driver modules, and then "modprobe" them again -- when they are reloaded they will probe and find your drive.

Cheers

17 Jun 2003 01:45 olecom

Re: registering IF by hdparm with no device
was it clear ?
will you write a patch, or this is impossible ?

thanks

11 Jun 2003 14:55 olecom

Re: registering IF by hdparm with no device

> My brain cells are unable to decipher
> the previous message. Care to try again?
> :)

Sorry for that, I'll try.
I have little problem. I want to use IDE hotswap with Linux. I think I'am rihgt, when use `hdparm -R` and `hdparm -U` for it.
Stability for this process gives Linux 2.4.21rc1-ac2
(o Fix the ide unregister deadlock bug (me))
It works well. But if there is no IDE device at all, for example on NFS root, I can not register new one:
debian:~# cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / nfs rw,v2,rsize=4096,wsize=4096,hard,udp,nolock,addr=10.33.12.152 0 0
proc /proc proc rw 0 0
devpts /dev/pts devpts rw 0 0
debian:~# ls /proc/ide/
drivers
debian:~#
++++++ I tried:
debian:~# hdparm -R 0x170 0 0 /dev/hdc
/dev/hdc: No such device or address
debian:~# hdparm -R 0x170 0 0 /dev/hda
/dev/hda: No such device or address
debian:~# hdparm -R 0x170 0 0 /dev/zero
/dev/zero not supported by hdparm
debian:~#

If it not so hard for You to fix this problem, do that please.

P.S I used to do it by myself, but Linux's ioctl() don't want to do my buggy hacks like fd == 0, or fd = open ("/dev/zero"...)
;-)

Many thanks.

09 Jun 2003 20:13 ideguy

Re: registering IF by hdparm with no device
My brain cells are unable to decipher the previous message. Care to try again? :)

09 Jun 2003 18:00 olecom

registering IF by hdparm with no device
I noticed, that `hdparm -R` (and -U) works after checking(opening) of /dev/hd??. Today, I sat on nfs_root with no /dev/hda, and wanted to register it, after I inserted hdd into mobile rack and this *feature* failed to do it, because I have no /dev/hd* at all.

In hdparm.c "#ifdef HDIO_SCAN_HWIF && #ifdef HDIO_UNREGISTER_HWIF" are stand after "fd = open (devname, O_RDONLY|O_NONBLOCK);"
and use fd from it: "if (ioctl(fd, HDIO_UNREGISTER_HWIF, hwif))..."
what if to patch this *thing* with: "if (ioctl(0, HDIO_UNREGISTER_HWIF, hwif))" ?
I think it is solution.

thanks, GL.

29 May 2002 09:09 ideguy

Re: Do NOT enable -W1! DO USE -W0 instead!
There is small (VERY SMALL) potential for losing a disk write on sudden powerfail with the drive caching enabled. But this is so small as to be insignificant for nearly all of us, and enabling the write cache does FAR MORE than just "cheat benchmarks" -- it really does improve system response and throughput quite noticeably.

I use -W1 continuously during kernel development, with extremely frequent crashes and have never, ever, lost even a sector of data.

So while the possibility exists, say about the same as contracting a flesh-eating disease, in reality -W1 is safe for the rest of us, and really speeds up the system.

The poster above is more than welcome (hey, even encouraged!) to stick with the slow -W0 lifestyle. But life is too short for me to wait that much for my computer.

Cheers

29 May 2002 08:47 mandree

Do NOT enable -W1! DO USE -W0 instead!
The -W1 switch enables the write cache of a hard disk and will cause severe file system corruption in face of a power outage that occurs while a write operation is in progress. Journalling file systems (reiserfs, ext3fs, xfs, jfs, you name it) cannot help about this either, but may instead hide the actual problem. These file systems rely on their write operations being performed in order.

However, most IDE drives ship with write caches enabled to cheat benchmarks, at the expense of data safety.
Use hdparm -W0 on all your drives to turn the write cache off.

If your drive supports tagged command queueing, it will help write performance as soon as support for this feature gets into your kernel. Tagged Command Queueing makes the write cache safe.

Write barrier support patches are also circulating and may help safety, but before these are in you kernel, enabling the write cache or leaving it enabled without using tagged command queueing is UNSAFE.

You have been warned.

21 Feb 2001 04:03 roalter

Compile does not work with new Kernel 2.4.1
Everytime I try to compile it, I get an error saying
some variable is not defined in /usr/include/linux/strings.h
Are there some major changes in the new kernel?

Screenshot

Project Spotlight

ReciJournal

An open, cross-platform journaling program.

Screenshot

Project Spotlight

Veusz

A scientific plotting package.