Hard drives

From Elvanör's Technical Wiki
Revision as of 20:44, 16 November 2009 by Elvanor (talk | contribs)
Jump to navigation Jump to search

This article discusses the monitoring of hard drives, the best way to deal with hard drive failures, and general hard drive information. It explains how to make a complete backup of your Gentoo system into another hard drive.

Filesystems

  • ext4 by default reserves a certain number of blocks for the super-user (5% by default). You can override that setting with tune2fs /dev/sdd1 -m 1 for example (it would set the number of blocks to 1%).

Monitoring your hard drives using SMART

Modern hard drives come with a self monitoring system called SMART. This system will apparently report problems and can detect in advance about 2/3 of hard drive failures. Under Linux, a set of tools, smartmontools, may be used to diagnose your hard drives. You can use the program smartctl manually, or install a daemon that will always run on your system and report failures.

Backing up your data and system

Making a stage4

Under Linux everything is a file so it is easy to create a complete backup of your system. With Gentoo the best way is to generate a personal "stage4" file. Follow this guide on the Gentoo Wiki to do just that.

  • Warning: don't exclude "/usr/src/*" from the stage 4 as stated by the guide! /usr/src contains the kernel source, used by several packages, and more importantly, it also contains the kernel's .config file. If you exclude /usr/src in your stage4, you'll have to reedit your kernel configuration.
  • Be very careful about the /dev/null and /dev/console nodes. They are indeed needed to boot currently, even with udev. So it is mandatory to create these nodes statically, in the "real" /dev of the new hard drive. If you just follow the guide's instructions, you'll create the nodes after /dev points to something, so they won't reside on the real /dev directory of the hard drive. I advise to create them before chrooting and binding the /dev of the LiveCD.

Just copying everything

  • Copying everything using cp -ar will result in a working system. Just exclude dev, proc, sys directories. Even with a recent udev, you still need to create the /dev/null and/dev/console nodes in /dev. This is because they are needed *before* udev is started.

Useful Links