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😀
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;
/dev/sdb: 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🙄
Filed under: Debian, Posts, Server | 2 Comments
Tags: df -h, harddrive, hdparm, postaday, reserved space, Server, tune2fs