Laptop Hard Drive

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
chrisuk

Laptop Hard Drive

Post by chrisuk »

OK, I know this isn't a new problem, but it's new to me. I installed Mint 5 (Dual Boot Vista) and everything is great about it, Hardware recognized, all running smooth, does all I want it to do. Actually quite an impressive release. However I have 1 (only 1) nagging worry, my Hard Drive seemed to be more active than it should so I installed smartmontools and monitored my drive in 15 minute intervals. In 15 minutes my Load Cycle Count incremented by 22, that's 88 an hour. On Vista I struggle to get 13 an hour. Now after googling this it appears my my Hard Drive will last a quarter of the time in Linux than it will in Vista. I don't want to change my power management so my drive parks less but gets hotter, I just want it to work how it's designed to work on a Laptop. Is there anyway to fix this properly (not an unofficial ugly fix)? To reiterate, this is the only problem I have with Mint, I really want to use it and ditch Vista.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
chrisuk

Re: Laptop Hard Drive

Post by chrisuk »

oops, forgot my specs:

Fujitsu Siemens Amilo Pi 2515 Laptop
Intel Core 2 Duo t5450
2GB ram
160gb Western Digital SATA HDD (WDC WD1600BEVS-07RST0)
Intel X3100 integrated gfx
Fred

Re: Laptop Hard Drive

Post by Fred »

chrisuk wrote:
Is there anyway to fix this properly (not an unofficial ugly fix)?
I am not sure I know what an "official" fix is. If it is good enough for Linus T. it's good enough for me... lol

You might want to read my post in the below thread.

http://www.linuxmint.com/forum/viewtopi ... ack#p77696

Fred
rivenought

Re: Laptop Hard Drive

Post by rivenought »

As a curiosity, is anyone who is using ext 2 on a laptop these days instead of ext 3 actually extending the life of his or her hard drive or increasing performance? From the data and opinions, it would seem so. Would it really be better to use ext 2, as long as the data loss was absolutely not an issue? I mean, ext 2 was used for years with no problems.

I do not have a laptop, but I have friends who do. It may eventually be a concern for them. Myself, I use ext 2 for /boot, but use ext 3 for / and /home. That combo works fine for my basic home desktop systems, but if there are better options, I am always interested in researching.
Fred

Re: Laptop Hard Drive

Post by Fred »

rivenought,

When I was researching this issue I had similar thoughts. Let me condense the basic problems and tell you the consensus of knowledgeable, evidence supported, opinions that I found. These opinions were also filtered through my own personal, "logical and rational," filter and my own personal experiences. :-)

There are two distinct issues affecting laptop drive performance and life expectancy.

The first is related to statistically reducing the amount of time the drive is exposed to G forces sufficient to damage the drive. This is done with an algorithm that parks and locks the read/write head and removes power from the drive, in that order. There has been much written on this subject by me and others, so I'll let it rest in this post. :-)

The other issue is tied to how a journaling file system works, and its effects on sanely implementing the algorithm referred to in the first issue above.

The ext2 file system is certainly tried and true, so to speak. It is certainly under rated these days. It does have some built in limitations that have been pretty effectively addressed in ext3 however. If you striped the journal out of ext3 you would have an improved and faster ext2 file system.

The ext3 file system has three operating modes. I am going to touch on two of them. Ordered is the default mode in version 2 of ext3. It creates and maintains a journal. In order to keep the journal up to date so data lose in a power failure or kernel crash, (which is rare), is kept to a minimum, the journal is automatically updated every 5 seconds. This is the default time and is selectable when compiling. It becomes immediately obvious that this action is going to interfere with the head parking scheme mentioned above. Every 5 seconds the head must read from and possibly write to the journal. Settings that would protect the drive for longer periods of time and consume less power now are constantly parking and unparking. This is usually referred to as drive thrashing. In spite of much rhetoric about Ubuntu and laptop drive issues that completely ignore these facts, I strongly suspect that most of these issues are caused by using ext3 in ordered mode than any other single factor.

Using ext2 as the file system would remove this complicating factor. I think there is a better solution though. The ext3 file system can also be run in the writeback mode. Writeback mode uses a journal just like ordered mode does. The difference is that the journal is only updated when the kernel normally needs to go to the disk. ie a normal asynchronous kernel flush/fetch cycle. If the system is dormant or is being used for something like writing this post, where there is very little data involved, it might be quite sometime before the disk would normally need to be accessed. This allows the disk to park and the power to be shut off without having to be immediately fired back up. Starting a drive is the most damaging operation a drive does. Head parking, unparking is the second most damaging.

All other things being equal, ext3 writeback mode is faster than ordered mode and ext2. In the case of ext3, writeback requires less overhead for the kernel. In the case of ext2, ext3 is just faster when the journal doesn't have to be separately serviced.

More on an antidotel level. I don't have a laptop, but I have put maybe 8 or 10 laptops on ext3 writeback mode for others and am satisfied that the disk thrashing issue is greatly improved. It is just so obvious you can't miss it. Some have said that their notebooks are faster, some say they can't tell if it is or isn't but it is at least as fast.

I would expect the same improvement in the disk thrashing with ext2. I would also expect it to be slightly slower than ext3 writeback mode. But I doubt you would notice much of a difference in normal operation on most equipment.

Using ext3 writeback mode still gives all the advantages of using a journaled file system. You can potentially lose more than 5 seconds of data if you have a power failure though. On a laptop that is, or should be, a moot point.

Fred
donec
Level 4
Level 4
Posts: 333
Joined: Sun Nov 18, 2007 5:21 pm
Location: Texas
Contact:

Re: Laptop Hard Drive

Post by donec »

So Fred, how do I put my laptop on ext3 writeback mode?
Don
http://bestwebstop.webcentr.net
Links and accurate information provide the best answer, while garbage in provides garbage out.ImageRegistered Linux user # 449322
Moved up to LM17 KDE
Fred

Re: Laptop Hard Drive

Post by Fred »

donec,

There is some commentary on this in the below post you should read before doing this. The sequence is important so you don't have problems. The fstab modes entry was taken directly from a post by Linus T. about the way he has his laptop set.

The big thing to remember is not to try to boot a system that is set for one file system mode when fstab is looking for another mode. The mode the file system is set to must match what fstab is looking for on boot.

http://www.linuxmint.com/forum/viewtopi ... ack#p77696


To check a partition file system spec. and mode:

sudo tune2fs -l /dev/sdxx


Use fstab modes entry:

noatime,nodiratime,defaults,data=writeback


To set ext3 to writeback mode:

sudo tune2fs -o journal_data_writeback /dev/sdxx


To set ext3 back to ordered mode:

sudo tune2fs -o journal_data_ordered /dev/sdxx

Fred
eeezzzeee

Re: Laptop Hard Drive

Post by eeezzzeee »

Fred I remember having a discussion with you about this problem a while back. Thanks for keeping up on it and helping people work there way through it. You always have level headed to the point advice and I learn a lot from your posts. Just wanted to thank you.
chrisuk

Re: Laptop Hard Drive

Post by chrisuk »

Thanks for responding promptly, I'll try all the suggestions over the weekend and post back the result.

Thanks again :)
Chris
donec
Level 4
Level 4
Posts: 333
Joined: Sun Nov 18, 2007 5:21 pm
Location: Texas
Contact:

Re: Laptop Hard Drive

Post by donec »

In the storage media applet and on the desktop clicking on the image of a drive and selecting properties it shows a mounting tab. under this tab there is a selector for "Filesystem Specific Mount Options" Journaling which allows the selection of "All Data" "Ordered" and " Write Back". Now when I click on Write Back a note pops up saying "Mountpoint has to be below /media". What does that mean and is it possible to change the mount option using this?
Don
http://bestwebstop.webcentr.net
Links and accurate information provide the best answer, while garbage in provides garbage out.ImageRegistered Linux user # 449322
Moved up to LM17 KDE
Fred

Re: Laptop Hard Drive

Post by Fred »

donec,

I am afraid I can't help you there. I have never tried to do it like that. I am going to show my age and how old fashioned I am. I just wouldn't trust a GUI to do something this critical to the system. If the GUI doesn't modify fstab correctly and change the mode to match, you are quite likely to wind up with a system that won't boot. At that point you will have to use a live cd to go in and manually correct the fstab file and/or reset the file system mode. I have no idea what that GUI actually does to the /etc/fstab file, if anything. It is just too easy to do it from the command line and not take the risk of a GUI.

If you have a laptop, I would recommend you use the writeback mode with the fstab modifications I specified. But I recommend you do it the way I suggested also. If you do it the way I showed, you won't have problems. If you don't, I don't know what the outcome might be.

Fred
artie
Level 1
Level 1
Posts: 24
Joined: Thu Oct 18, 2007 12:32 pm

Re: Laptop Hard Drive

Post by artie »

Hi Everyone,

I tried Fred's fix and it did not work for me (maybe I missed a step?) so I tried the ugly fix,
$ sudo hdparm -B 254 /dev/sda
$ sudo hdparm -S 0 /dev/sda
and it fixed the load cycle, parking and unparking problem but now the hard drive is constantly spinning
and heating up (I can actually feel the heat through the touch pad) Is there away to set the hdparm
settings back to default so that I might try Fred's fix again?

Specs,
Darnya
Inspiron 600m
Fred

Re: Laptop Hard Drive

Post by Fred »

artie,

To set your load cycle back to the default use the below command.

sudo hdparm -B 128 /dev/sdx

Change the sdx above to whatever the correct drive is, ie sda, sdb, etc.

Remember, when setting writeback mode, this must be done for all your ext3 partitions, if you have more than one, not just your root partition.

To set an ext3 partition to writeback mode:

sudo tune2fs -o journal_data_writeback /dev/sdxx

Do this for each ext3 partition, changing sdxx to the appropriate designator.

Open your /etc/fstab file for editing with:

gksu gedit /etc/fstab

Change the mode entry to:

noatime,nodiratime,defaults,data=writeback

for each of your ext3 mounting stanzas.

They should wind up looking something like mine below. Ignore the "LABEL=something" part. That is another issue.

# /dev/sda5 UUID=8440a1b8-06ae-4ea0-b0b2-98160104db88
LABEL=Root-1 / ext3 noatime,nodiratime,defaults,data=writeback,errors=remount-ro 0 1

# /dev/sda6 UUID=67a6f60f-7861-440e-9f29-0e23edb64625
LABEL=Home-1 /home ext3 noatime,nodiratime,defaults,data=writeback 0 2

Don't mistake word wrap for returns. The only returns in the above are at the end of the UUID=32Characters line.

Save, exit and reboot.

I hope you see the results you are looking for.

Fred
artie
Level 1
Level 1
Posts: 24
Joined: Thu Oct 18, 2007 12:32 pm

Re: Laptop Hard Drive

Post by artie »

Okay Fred,
First of all I do not know what you are doing awake at this time of the morning :D (I am in Boston MA)
Second of all your fix seemed to have worked well, but is there a way to make this fix a permanent
change into the next Mint? (Mint laptop edition maybe?) this hard drive problem seems to be a deal breaker
for a lot of my linux converts.
MagnusB
Level 6
Level 6
Posts: 1252
Joined: Sun Nov 18, 2007 12:39 pm
Location: Norway

Re: Laptop Hard Drive

Post by MagnusB »

artie wrote:Hi Everyone,

I tried Fred's fix and it did not work for me (maybe I missed a step?) so I tried the ugly fix,
$ sudo hdparm -B 254 /dev/sda
$ sudo hdparm -S 0 /dev/sda
and it fixed the load cycle, parking and unparking problem but now the hard drive is constantly spinning
and heating up (I can actually feel the heat through the touch pad) Is there away to set the hdparm
settings back to default so that I might try Fred's fix again?

Specs,
Darnya
Inspiron 600m
That is not an ugly fix, it just shortens the battery life of the hard drive. And the real issue is that the default power saving settings are set to 1 in most BIOS, so Linux get that number. This seems like a issue coming from Microsoft handling it different and the manufacturers don't worry about (<-- Pure guess work)
Image
You're not drunk if you can lie on the floor without holding on.
--Dean Martin
Fred

Re: Laptop Hard Drive

Post by Fred »

artie,

I am glad you got it set-up correctly and it seems to be working for you. So far, every laptop I have done this on has shown a significant improvement in disk thrashing, and most have claimed at least some speed improvement.

If your experiences are not consistent with the above I would appreciate some feedback.

I am using it on my desktop for testing purposes, looking for unintended consequences. I don't, however, recommend this fix for desktops, only laptops. Desktops have a different operating environment and the issues are not the same.

The power saving algorithm that MagnusB alluded to above is a complicated issue with many sides. Much has been written on the subject and I will leave that for another time. :-)

Fred
hotweiss

Re: Laptop Hard Drive

Post by hotweiss »

This is the fix that I found on ubuntuforums (thanks to jakon) that works great for me:

A) First we’ll have to adjust the hard drive’s power management settings by typing the following in Terminal:

Code: Select all

sudo nano /etc/hdparm.conf
B) And by pasting the following three lines in the file:
/dev/sda {
apm = 254
}
C) Hit Ctrl-O to save and then Ctrl-X to exit.

D) Next we’ll have to tell the notebook to reactivate these settings after resuming from suspend mode by typing the following in Terminal:

Code: Select all

sudo nano 30hdparm
E) And by pasting the following lines inside the file:
#!/bin/bash

# Run hdparm like on boot to restore hdparm.conf settings -
# hds lose them when going to standby.

resume_hdparm()
{
for x in /sys/bus/ide/devices/*/block* /sys/bus/scsi/devices/*/block*
do
# This check is required - x can contain
# literal ‘/sys/bus/ide/devices/*/block*’
# when the glob did not match anything.
if [ -e $x ]
then
drive=$(basename $(readlink $x))
DEVNAME=/dev/$drive /lib/udev/hdparm
fi
done
}

case “$1″ in
thaw|resume)
resume_hdparm
;;
*)
;;
esac

exit $?
F) Hit Ctrl-O to save and then Ctrl-X to exit.

G) Finally we’ll have to install the file we just created by typing the following in Terminal:

Code: Select all

sudo install 30hdparm /etc/pm/sleep.d/
H) Reboot and your hard drive should be working with Mint as it should have from the start.
Fred

Re: Laptop Hard Drive

Post by Fred »

hotweiss,

Thats nice, and I am glad you are happy with it, but do you know what you have actually done?

That is a complex and convoluted way of executing the command:

sudo hdparm -B 254 /dev/sda

and making it sticky in all situations.

What this does is essentially disable the power saving, and disk protection on your hard drive.

The Issue I have been discussing in this thread is a different one, though related.

Fred
artie
Level 1
Level 1
Posts: 24
Joined: Thu Oct 18, 2007 12:32 pm

Re: Laptop Hard Drive

Post by artie »

Hey Guys, (I will safely assume there are no ladies here,yet )
I tried Fred's fix on my employers laptop and it also seemed to have worked well. The thrashing has cut down
and it does seem faster but its kind of strange because even though I applied the same fix that I did on my laptop
to his laptop he seems to still have thrashing every 5-10 seconds as where i am having hard drive parking every
40-50 seconds. I was using smartmontools to monitor both laptops and his load cycle is down as to where mine
was up? Not sure but should I really trust smartmontools? We both have Dell laptops and I will have to agree
with Magnus, I have read many debates as to, Is this a Linux- Ubuntu problem? Or a BIOS power management
problem? I am kind of a newbie but I will have to say yeah it is a hardware issue.
Thanks Fred, I have learned huge amounts of info from you and many others on this forum. Its people like you
guys that make linux great fun.
Last edited by artie on Thu Mar 26, 2009 7:29 am, edited 1 time in total.
AK Dave

Re: Laptop Hard Drive

Post by AK Dave »

The thrashing seems to be more of an issue with newer SATA laptops, right? I don't see this problem on IDE-based laptops, such as my own, where writeback mode DOES offer a significant performance boost (esp noted on boot). But since I'm considering some laptop purchases later this year, I think that MagnusB's theory is probably spot-on: MS handles this "different" and manufacturers take shortcuts by not passing proper parms. This leads me to suspect that laptops sold specifically for Linux/Ubuntu may be easier to get to work "right" than others and that I should limit my laptop selections to those which can or do come preloaded with a Linux.

Dang, those Dell "E" mininotes are sounding really sweet. I can't wait to get my hands on a couple of them preloaded with Ubuntu.
Locked

Return to “Beginner Questions”