Hard disk

DMA (Direct Memory Access)

DMA allows coping data from the hard disk to the memory without passing it thought the CPU bottleneck. Enabling DMA increases hard disk access performance significant (using hdparm -tT > more than factor 10).

Enabling DMA is done with the hdparm command, but also the kernel has to be configured to support DMA and the DMA controller on the motherboard has to be selected.

hdparm /dev/hda shows data about your hard disk

hdparm -d /dev/hda shows DMA status

hdparm -d 1 /dev/hda turns DMA on

hdparm -d 0 /dev/hda turns DMA off

hdparm -i /dev/hda displays DMA mode info

hdparm -tT /dev/hda tests it


To create partitions the basic fdisk, or the bit advanced cfdisk, parted or sfdisk can be use. The hard disk is not allowed to be mounted and be aware when you write you loose your data.

To see what you have (before doing the damage) fdisk -l or df -h lists all the devices.

For parted there is the GUI qtparted.

A typical sequence to partition ssd sd for a UEFI-only system not swapping to the SSD could look as follows:


print devices

parted -a optimal /dev/sda

mklabel gpt

unit mib

mkpart primary 1 64 0 to 1 might be critical or / not possible and not per-formant

name 1 boot

mkpart primary 64 -1

name 2 rootfs

set 1 boot on


Model: Jmicron Corp. (scsi) Disk /dev/sdg: 114473MiB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1.00MiB 64.0MiB 63.0MiB boot boot, esp 2 64.0MiB 114472MiB 114408MiB rootfs


mkfs.ext4 /dev/sdg2

mkfs.vfat /dev/sdg1

Test programs

More advanced test programs as hdparm -tT /dev/hda are the classic bonnie or the C++ version bonnie++.

If you like to know where the big files and directories are that have filled up your hard disk:

emerge filelight

and you get a graphical picture of it

Show bad blocks: dumpe2fs -b /dev/hda3

Show superblock: dumpe2fs -h /dev/hda3

Show all stuff: dumpe2fs /dev/hda3

Show filesystem stuff: mke2fs -n /dev/hda3

To change the parameters for automatic testing use tune2fs -c or tune2fs -i

The following programs check the "unmounted" file systems. Boot from a live-CD as http://www.knopper.net/knoppix/ and run them:

A front end for various checkers: fsck /dev/hda3

Force check even it is clean: e2fsck -f /dev/hda3

Look for bad blocks: e2fsck -c /dev/hda3

Automatic repair: e2fsck -p /dev/hda3

Search for bad blocks (with the show option): badblocks -s /dev/hda3

A "mounted" filesystem can be checked using the readonly option -n:

e2fsck -n /dev/hda3

The ext3 file system has journaling function that should not require a manual check by definition.

The kjournal is a daemon doing the stuff in background.

To test the disk: emerge testdisk

Interesting to know is also how often your disk is accessed, the command vmstat -d will show that and can be used to move data from one disk to an other to e.g reduce write access to SSD devices.

e2label /dev/<disk> shows disk name on e2 partitions e2label /dev/<disk> <name> sets it

SMART (Self-Monitoring Analysis and Reporting Technology)

Check if your drive supports SMART hdparm -I /dev/<sd?> | grep SMART, then emerge smartmontools and do smartctl -i /dev/sda for get the info and smartctl -H /dev/sda to do the health test. To get all kinds of stuff smartctl -A /dev/sda.

To do a self-test (you can still work normally with it)

smartctl -t short /dev/sda

When done

smartctl -l selftest /dev/sda

Desktop environment come also with GUI's as gnome-disk-utility

Linurs Servernest startpage