Storage devices in Linux

This page describes different kinds of storage devices in Linux. I can also recommend using Network Attached Storage (NAS)
[ Top | Bottom ]

Performance tuning

To get maximum performance, you will have to enable DMA and a few other things. In order to check the performance use: hdparm -Tt /dev/hdX (where X is your hard drive or CD/DVD drive). Now you are ready to tweak your settings.

NOTE! The performance of the drives in your system depends on several things, among those are the kernel version and patch set you are using.

If you are using RedHat/Fedora you can configure each drive by using these settings in /etc/sysconfig/harddiskhdX (where X is your drive, e.g. in my case e and g):
USE_DMA=1
MULTIPLE_IO=16
EIDE_32BIT=3
LOOKAHEAD=1
EXTRA_PARAMS=-S242 # sleep setting.
Code listing 2.1
NOTE! See the hdparm manual page for more information!
If you are using Gentoo you can edit /etc/conf.d/hdparm, and add a line for each drive:
disc0_args="-d1 -m16 -c3 -S242 -u1"
disc1_args="-d1 -m16 -c3 -S180 -u1"
cdrom0_args="-d1"
Code listing 2.2
NOTE! See the hdparm manual page for more information!

Using these settings gives me a performance of (Tested using hdparm -Tt /dev/hdX):

A7V mothetboard, Promise ATA100, Maxtor 120GB, kernel 2.6.10 from kernel.org:
/dev/hde:
 Timing cached reads:   728 MB in  2.00 seconds = 363.15 MB/sec
 Timing buffered disk reads:  156 MB in  3.01 seconds =  51.85 MB/sec
Code listing 2.3
[ Top | Bottom ]

Hard drive partitioning

Partitions overview

I recommend using Logical Volume Management instead of regular static partitions. But if you do not have the possibility to use LVM2 I would recommend the partition scheme in table 3.1 for a desktop Gentoo system.

NOTE! /opt, /usr and /var doesn't have to be separate partitions, I just prefer it that way

I prefer to use the ext3 filesystem on my root partition, and ext2 on /boot. Ext2 uses less space, because it does not use a journal. On the rest of the partitions I prefer a fast filesystem like ReiserFS or SGI's xfs.

Mount point Size Comment
/boot100MBFor kernels, I currently use 12MB, so less is ok
/400MBShould be larger if it should hold /opt, /usr and /var
/homeRest of driveAs much as you need for your documents, music, movies and so on. If you have Wine installed and use a folder in your home directory for Windows applications, remember to have extra space for those. I currently have a couple of games installed, and they use about 6GB of space
/opt1GBUsed for applications like Opera, VMWare, Java and OpenOffice.org
/usr4GBHere is the largest part of the system installed, I currently use 2,7GB on my workstation
/var2GBIs enough space to compile X.org and KDE
swapSize of you memoryE.g. 512MB swap with 512MB ram
Table 3.1 : Recommended partitions layout for a desktop Gentoo system

For more information:

Logical Volume Management 2 (LVM2)

LVM2 is a simple and elegant way to manage you partitions. Normal PC partitions are "hardcoded" to the disc, e.g. if one of your partitions run out of space you will have to either: 1) repartition your whole hard drive (e.g. back all data up, repartition, reinstall, restore data) or 2) buy a new hard drive and move your data to that disk. With LVM2 you could just resize your partitions (Called Logical Volumes in LVM) on the fly, without rebooting!. And if your drive is completely full, just add a new drive and expand your logical volume to include this new disk.

To use LVM2 you will need kernel support for it:
Device Drivers  --->
    Multi-device support (RAID and LVM)  --->
        [*] Multiple devices driver support (RAID and LVM)
	<*>   Device mapper support
Code listing 3.1
I currently use the xfs and ReiserFS filesystems on my logical volumes.

For more information:

[ Top | Bottom ]

Quality and noise

Losing data sucks, and some hard drives appear to be more prone to data lose than others. The noise levels of hard drives are also interesting, especially when you are building a Home Theater PC for the living room. The following table lists my experiences with a couple of hard drives.
Manu. Model Size Specs. Status Noise
IBMDeskstar GXP7530GB2MB cache, ATA100, 7200RPMDead (1)Very noisy, high pitched spinning sound, high seeking sound
IBMDeskstar GXP12040GB2MB cache, ATA100, 7200RPMDead (1)Very noisy, high pitched spinning sound, high seeking sound
MaxtorDiamondMax Plus 9 (6Y120P0)120GB8MB cache, ATA133, 7200RPMRunning fine (2)Low noise, low seeking sound
Maxtor541/DX (2B020H1)20GB2MB cache, ATA100, 5400RPMRunning fine (3)Rather noisy, high seeking sound
SeagateBarracuda 7200.7 Plus160GB8MB cache, ATA100, 7200RPMRunning fine (4)Very low noise, almost no seeking sound
IBMIBM-DJSA-21010GBATA66, 4200RPMRunning fine (5)Very low noise, no seeking sound (it's a laptop drive)
IBMTravelstar 3XP3GB96KB cache, 4000RPMRunning fine (6)Rater low noise, no seeking sound (it's a laptop drive)
Table 4.1 : Overview of different hard drives I own

For more information:

  • For reviews of silent hardware, not only hard drives checkout Silent PC Review

Monitoring health

Must modern hard drives support S.M.A.R.T (Self-Monitoring, Analysis and Reporting Technology System), which report the health of the drive. And there is and excellent tool available for Linux to do this, and it's called smartmontools.

For more information:

[ Top | Bottom ]

CD/DVD drives

You can use almost the performance tuning option for hdparm as with your hard drive, you should at least enable DMA, so that your DVDs don't skip :)
[ Top | Bottom ]

CD-rom burners

Generic CD-R/RW drives

I currently does not have a CD-R/RW drive installed in any of my computers, but I use an external burner connected via USB.

For instructions on how to burn CDs in Linux please read my CD burning guide.

[ Top | Bottom ]

USB storage

Probably the most widely used USB storage devices are USB keys/memory sticks, which provide a nice alternative to floppys. But USB storage devices are not limited to this. I have a old 4x speed CD-R/RW drive that I share between my workstation and my Powerbook. It's mounted in an external Qtec 756C USB 2.0 CD/RW 5.25" case. There exists several different types of external device cases, the Qtec uses USB, but there also exist cases that uses Firewire, which makes them ideal for use with Powerbooks.

To utilise an external device case in Linux (containing either a CD-rom, CD-R/RW or hard drive), you first of all need generic USB support or Firewire support. Then the following should be enabled in your kernel:

Device Drivers  --->
    ATA/ATAPI/MFM/RLL support  --->
        <*> ATA/ATAPI/MFM/RLL support
        <*>   Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
        <M>     SCSI emulation support
    SCSI device support  --->
        <M> SCSI device support
	<M>   SCSI disk support
	<M>   SCSI CDROM support
	<M>   SCSI generic support
    USB support  --->
        <M>   USB Mass Storage support
Code listing 7.1
Load the modules with:
modprobe usb-storage
modprobe sd_mod
modprobe scsi_mod
modprobe sg
modprobe sr-mod
Code listing 7.2
The devices should appear in /dev as sdaX or sdbX (X is a number) depending on how many other SCSI devices you have in your system. You can mount the device with: mount /dev/sdaX /mnt/usb-storage/ -t vfat or what ever file system the drive is using.
Next you can add this line to your /etc/fstab
/dev/sdaX /mnt/usb-storage/ vfat  noauto,user,quiet,defaults,sync 0 0
Code listing 7.3
The sync option makes sure that data is written directly to the device, and not just buffered.

udev as device manage is a good choice to ensure that your USB device always get the same /dev entry.

[ Top | Bottom ]
Hi! you have reached the old part of my homepage, be sure to checkout my new site