<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>FritzHotSwapDrive</title><revhistory><revision><revnumber>1</revnumber><date>2012-12-15 07:38:46</date><authorinitials>ClintonEbadi</authorinitials><revremark>basic information on replacing drives in fritz, for future reference</revremark></revision></revhistory></articleinfo><para>Replacing a drive in fritz's main array is somewhat complicated since we're using software raid on top of partitioned disks. </para><para>To simplify things, attempt to acquire identical disks, or at least ones with the same block counts. We had good luck with <ulink url="http://www.xbyte.com/">Xbyte</ulink> when the first drive failed in production. This is true for both RAIDs. </para><para>Inserting the disks is straightforward: if using a new bay, just pry out the drive blank and insert the drive. If the drive is not in a hotswap sled, there are four screws and the rest is obvious from the design of the sled. </para><section><title>md2 (AFS)</title><para>This is easy since we're using md on top of the entire disk: <code>mdadm --fail /dev/md2 $FAILED-DRIVE</code>, remove the drive, insert the replacement, and <code>mdadm /dev/md2 --add $NEW-DRIVE</code> to insert the new drive. </para><para>Alternatively, leave the failed drive in, add the new drive to the array, and then fail the dying drive. </para></section><section><title>md0 and md1 (/ and swap)</title><para>This array is complicated, because we weren't so familiar with software raid and lvm at install time, and partitioned the disk, running an array on each partition. </para><para>In the examples, we will use <code>$CURRENT</code> for the non-failed drive in the array, <code>$FAILED</code> for the failed drive, and <code>$NEW</code> for the new drive. Substitute with the appropriate <code>/dev/sdX</code>. </para><section><title>Partitioning</title><para>If you managed to find a drive with the same block count, your life is easy. Determine the <code>/dev/sdX</code> names of each disk. </para><para>To dump information on the total block count of the drive for verification, run <code>sfdisk -s $DISK</code> on the living drive and the new drive. </para><para>If the block counts agree, there's one step: <code>sfdisk -d $CURRENT | sfdisk --force $NEW</code>. sfdisk may complain about paritions not ending on cylinder boundaries, but the warning is harmless. You may want to use <code>sfdisk -n</code> to do a dry run. If you enter the wrong device node you will destroy the target disk. Proceed with caution! </para></section><section><title>Adding to RAID</title><para>Use <code>mdadm /dev/$array --add $newN</code> to add partitions $new3 to md1 (rootfs), $new2 to md0 (swap). $new1 is intended to be a mirror of <code>sda1</code>, but we did not install md onto the device and need to fix that. </para><!--rule (<hr>) is not applicable to DocBook--><para> <ulink url="https://wiki.hcoop.net/FritzHotSwapDrive/CategorySystemAdministration#">CategorySystemAdministration</ulink> </para></section></section></article>