Hard drives: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
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.
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.
= Partitions =
* With the old (BIOS) partition table format, it is impossible to create a partition of more than 2TB. In order to create such a partition, you need to activate EFI GUID partition support in the kernel. Then you need to use GNU parted (and not fdisk) to create the partition:
parted /dev/sdb
mklabel gpt
mkpart primary ext4 0 -1


= Filesystems =
= Filesystems =
Line 17: Line 25:
= Backing up your data and system =
= Backing up your data and system =


= Making a stage4 =
== 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 [http://gentoo-wiki.com/HOWTO_Custom_Stage4 this guide] on the Gentoo Wiki to do just that.
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 [http://gentoo-wiki.com/HOWTO_Custom_Stage4 this guide] on the Gentoo Wiki to do just that.
Line 25: Line 33:
* 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.
* 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 =
== 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.
* 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.

Revision as of 19:36, 15 April 2012

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.

Partitions

  • With the old (BIOS) partition table format, it is impossible to create a partition of more than 2TB. In order to create such a partition, you need to activate EFI GUID partition support in the kernel. Then you need to use GNU parted (and not fdisk) to create the partition:
parted /dev/sdb
mklabel gpt
mkpart primary ext4 0 -1

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%). You can see the current parameters by running:
tune2fs -l /dev/sdd1
  • To reboot and check the filesystem (force a fsck), issue:
shutdown -Fr
  • Never check (fsck) a mounted filesystem.

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