Tag Archives: disk

smartmontools: A hard drive’s best friend

Here’s something you don’t see every day:

2014-04-30-6m47421-smartmontools-01 2014-04-30-6m47421-smartmontools-02

I mentioned a short while ago that I bought this hard drive to run in a Dell Inspiron 8000 more than eight years ago, and those screenshots are proof.

The actual conversion is up for debate, but a power-on time of 18,562 hours works out to be more than two years of working time. And it keeps on ticking. 😀

I know these things because smartmontools tells me. The suite provides a rundown on the S.M.A.R.T. data from a hard drive, then breaks apart the analysis into something vaguely human-readable.

How you interpret the information is up to you, but the beauty of it is that, as I understand it, it’s sometimes possible to get a warning that a drive is about to die.

And as someone who has heard deathly clacking noises from hard drives, any kind of warning would be a good thing. 😯

I must admit I’ve never tried to use smartmontools with either an SSD or any kind of surrogate, nonmechanical drive. It would be interesting to see though.

While it’s not a complete diagnostic tool and not a data recovery utility, it’s worth remembering that the information is available to you. Mark, and remember. 😉

P.S., yes, I know 18,562 hours qualifies as Old_Age according to smartctl, and I should have shown that a lot of other categories are marked Pre_Fail. Don’t worry, I have planned accordingly. 😉

slocate: All the makings of an intercontinental grudge match

I could be left alone in a windowless room with only a bare light bulb and find to search out the lost files on my computer, and I’d be fine with that.

Then again slocate, and its evil stepsisters in the mlocate coven, might give find a run for its money.

kmandla@6m47421: ~$ time find /usr/lib -iname *pcmcia*
...
/usr/lib/modules/3.14.1-1-ARCH/build/drivers/char/pcmcia
/usr/lib/modules/3.14.1-1-ARCH/build/sound/pcmcia
/usr/lib/initcpio/install/pcmcia

real	0m0.400s
user	0m0.120s
sys	0m0.090s

And the upstart?

kmandla@6m47421: ~$ time slocate -qi pcmcia | grep /usr/lib
...
/usr/lib/udev/pcmcia-check-broken-cis
/usr/lib/udev/pcmcia-socket-startup
/usr/lib/udev/rules.d/60-pcmcia.rules

real	0m0.303s
user	0m0.240s
sys	0m0.000s

Uh-oh. This could shape up to be the match of the century. 😯

Loyalists will insist that slocate is cheating, because it doesn’t really search so much as skim through its database and pick out the stuff you want.

Bolsheviks will counter with reduced time searching, less disk thrashing and adherence to the Second Law of Robotics.

For my own part, I’m not a big fan of databases and meta-information on my system. I appreciate s/m/locate‘s speed and conservation of energy, but my allegiance lies with find.

And really, I know where everything is on my computer. I don’t go searching for stuff that often. 🙄

So I say … down with the revolution! 😈

pydf: Disk space, in color

I pulled pydf out of the dark corners of my memory, just to make an appearance here again today.

2014-03-21-lv-r1fz6-pydf

Simple enough. A good rundown on drives, mounted points, sizes, and space left. A visual indicator for those of us who think it important.

And color. Everybody likes color. 😉

And … I can’t think of anything else to say. I know I remember another disk usage tool that used solid blocks instead of ASCII characters, but I can’t recall it now.

I shall soon have to dredge that out of my memory too. 😕

parted: The forgotten partition tool

Maybe it’s just me, but when I need access to disk partitions, I have a tendency to either run for fdisk or cfdisk. parted just never comes to mind.

I will list that as a flaw in my character, since I have no reason to doubt that parted is just as effective and powerful as its counterparts.

2014-02-22-lv-r1fz6-parted

Unfortunately there’s not much I can show about parted in action, lest I scramble my hard drive so badly as to require Clonezilla to repair it.

And while I like you all, I’m not ready for that kind of commitment. 😛

As far as how parted compares to fdisk, or for that matter to cfdisk, I don’t see much that differs. The man pages suggest they both are capable of manipulating or creating partitions. Obviously they both have their own styles.

And of course if you distill the Internet and decant the same question from it, you get a mish-mosh of opinions and unhelpful posts decrying one or the other.

So I leave it to you to decide which you prefer. The fact that you have a choice at all is what matters.

ncdu: You need this tool

Just this morning I ran out of space on a small external drive that I use for system backups and stashing the odd ISO image.

And the first thing I grabbed after the error message was ncdu.

2014-01-31-lv-r1fz6-ncdu

ncdu is one of the best tools available that doesn’t fit neatly into any one category. It’s not quite a file manager, even though it does have some fundamental file management functions.

And it’s not a tree navigator, even if it does display its information in a basic array of nested directory links.

What it does instead is run through the tree, find file sizes and show what’s taking up space. And at times, that can be the most amazing thing.

ncdu’s help screens appear with the ? key, which makes it very easy to learn. Sorting, reverse sorting, display options and error messages are all listed there.

The conventional du and df tools are fine and dandy, and I wouldn’t suggest replacing them at all.

I can say though that ncdu replaced them for me, years ago. And I still use it, even today. 😐

hdparm: Out of respect for times past

I’m going to mention hdparm in passing, mostly because I think it’s becoming more and more rare, with each passing hour, to find machines that need it, let alone people who use it.

Which is not the fault of hdparm. It’s an issue of hardware improvements over time … which suggests it still might be influential, if you’re working with older drives.

Drive lifetimes are limited though, and I have only one traditional IDE drive in the house now — in this machine — even if you can still find them online for fairly cheap.

I used to work a lot with hdparm as a tool for keeping systems speedy, or for getting whiny hard drives to shut up.

Results, for what I remember, depend very much on the hardware and the tweaks you use, which implies that a certain measure of expertise is required if you’re going to see good results.

The converse of that is, it will take some time to learn what works and in the mean time, there is the possibility of screwing things up royally — as in, dead hard drive.

I leave it to you to decide if hdparm is worth tinkering with. Newer drives probably won’t see much improvement; old, old ones will go from junk to jewel with it.

And as a Parthian shot, I will only suggest this over a decrepit hard drive — with or without hdparm — any day of the week. 😐

fdisk: One that’s not from coreutils

I have fdisk on my list of applications to include, and I suppose it warrants inclusion, even if I have a personal reason for writing about it. This is out of util-linux, not coreutils, which is a change … over the past few days, anyway. 🙄

Or maybe not. fdisk is a tool for “creating and manipulating partition tables,” which means two things — first, it doesn’t belong in coreutils 😉 ; and second, it has the potential to completely destroy your system if you use it wrong.

2013-11-06-lv-r1fz6-fdisk

Of course, you could say that about a lot of things. That doesn’t mean fdisk is something you should avoid. Live a little. Don’t be afraid to try something new. If you need a completely sterile, padded and antiseptic existence, I hear Windows 8.1 is a lot like a child’s pull toy. 😈

The easiest and probably most popular use for fdisk is checking what hard drives are connected to your computer. As you can see in the screenshot, if you tack on the -l flag, you’ll get a neatly formatted list of drives and partitions, along with sensitive and personal information for each.

fdisk can also manipulate or create partitions, and if you start it and aim it at a device label, you’ll have the option to delete, create, modify or adjust partitions on that device.

I suppose it should go without saying that you’ll need superuser permissions or root account access to do any real damage to your system. And for goodness sake and all that is holy, don’t use fdisk lightly. And don’t complain to me if you destroy your collection of family photos by tinkering with the partitions on your external drive.

There’s more you can do with fdisk, but I should probably admit that when it comes time to arrange partitions, on a new drive or at installation time. I usually rely on cfdisk, which is also part of util-linux.

I know there are hard-core Linux geeks out there who wouldn’t dream of using anything but fdisk to set up a drive, just like they wouldn’t dream of using anything but ed to edit a text file.

I just prefer the arrangement and the dialogs. It’s more intuitive for me.

So what’s my personal reason for including fdisk here? Well, you see, fdisk got something lately — in version 2.24 in Arch — that I really like. And if you looked at the screenshot you probably already know what it is. …

Color! :mrgreen:

P.S., sorry, Debian fans. You’re still stuck at 2.20 in Wheezy. …