Some Harddrive Tools


Seeing as I’m just rebuilding my server at the moment, I’m starting to remember a number of commands that I’ve not used in quite a while. Here’s three dead handy commands that deal with hard drives and filesystems. Seriously, how I ever forgot them, I’ll never know 🙄

The first is the simplest. It shows you how much space you’ve used, and have free, on every storage medium attached to your machine. It’s four characters. Gotta love the simple things in life 😀

df -h

If you did it right, you should see something like this;

Filesystem Size Used Avail Use% Mounted on
/dev/sda2             6.0G  901M  4.8G  16% /
udev                  243M  164K  243M   1% /dev
/dev/sdc1             917G  615G  293G  68% /mnt/1000
/dev/sdb1             459G  199M  454G   1% /home

The next is a tool that does far too many things for me to understand, including some things which will DESTROY your data and maybe even physical harddrive. So be careful what you type. I however, use it as a performance tool.

hdparm -Tt /dev/sda

Obviously, change /dev/sda to whatever drive you like (you can find it with df -h ;)). Again, if you’ve done it right, you’ll see something like this;


Timing cached reads: 792 MB in 2.00 seconds = 395.34 MB/sec
 Timing buffered disk reads: 340 MB in 3.00 seconds = 113.16 MB/sec

The first reading (-T), shows, according to the man page, “is essentially an indication of the throughput of the processor, cache, and memory of the system under test”. The second reading (-t) is the more true speed of the drive, the actual speed a file can be read from the disk, without any caches. So obviously, this little command is great for those like me, who love comparing various computers, disks and setups.

The last command is another multipurpose tool, which deals with ext filesystem settings, rather than harddrive settings as hdparm does.

However, before I tell you what it is, we must do some homework. Ext based filesystems (and a few others) reserve space on the drive for the system. It’s main use is that when you accidentally “fill” the drive, there’s still some secret space left over for the system to use, preventing it from freezing up. By default, it’s set to 5%. Now on a root drive, that’s a good setting to have, but it’s not quite necessary on a drive that’s simply being used to store bulk data. In such a case, it’s safe enough to reduce that secret reserved space back to 1% in order to win back some previous MBs.

Without futher ado, here it is;

tune2fs -m 1 /dev/sda1

Again, change /dev/sda1 to whatever you need yourself. The 1 after the -m flag donates setting a reserved space of 1%. For example, on a terabyte harddrive, changing from the defaults of 5% to 1% should give you a gain of 37GB or so.

Right, well that’s it for now. Hopefully, I’ll keep posting bits and pieces. No promises though 🙄


2 Responses to “Some Harddrive Tools”

  1. Have you ever thought about including a little bit more than just
    your articles? I mean, what you say is valuable
    and all. But think about if you added some great pictures or video clips to give your posts more, “pop”!

    Your content is excellent but with pics and video clips, this website could certainly be
    one of the greatest in its field. Good blog!

%d bloggers like this: