Koozali.org: home of the SME Server

adding a hard drive

billr

adding a hard drive
« on: May 29, 2002, 07:46:57 PM »
Here is a procedure that worked for me to add an new drive to e-smith and make all of it the /home directory.
Any feed back is welcome.

Install the hard drive

To see if the system can see the drive run after logging on as root  

   kudzu

To partion the the drive (hdb is the second isa drive)

   fdisk /dev/hdb

To make the file system on the disk (format the disk)

   mke2fs /dev/hdb1
If  you are  replacing a directory, move it to a different name

   mv /home /home.old

To label the disk (if appropriate - this affects how you mount it in the fstab  file)

   tune2fs -L /home /dev/hdb1

edit the fstab file to mount drive

   pico fstab
Sample /etc/fstab:




LABEL=/                 /                       ext2    usrquota,grpquota        1 1

LABEL=/boot             /boot                   ext2    defaults        1 2

/dev/cdrom              /mnt/cdrom              iso9660 noauto,owner,ro 0 0

/dev/fd0                /mnt/floppy             auto    noauto,owner    0 0

none                    /proc                   proc    defaults        0 0

none                    /dev/pts                devpts  gid=5,mode=620  0 0

/dev/hda5               swap                    swap    defaults        0 0

LABEL=/home      /home         ext2   defaults   1 2




To copy the contents of the old directory to the new - verbosely retaining attributes,  Recursively  


   cp home.old/* /home -vpR
To remove the old directory (after testing)
   rm home.old -R

guck puppy

[feedback] Re: adding a hard drive
« Reply #1 on: June 15, 2002, 12:14:31 AM »
Very useful, worked like a charm for me...

Might point out tho, that cfdisk is a much easier, friendly and apparently preferred method of partitioning than plain old fdisk.

and adding :

mount /home

to the end of the list of things to do - so that you don't have to restart your server to get the new drive mounted

Also, when it comes to deciding what is going to go onto your new drive, and where it sits in the filesytem (/, /home, /etc, etc :) it's perhaps worth noting that when you label your disk, in anticipation of adding it to your /etc/fstab file, you can't add a label like :

/home/e-smith/files/users/guck/home/extra

even if that's eventually where you plan to mount it - the label can not be that long (don't know how long it can be but rtfm...)

it brings up a more general point - where should you mount your new additional drive?

If I understand the default sme server filesystem correctly, there's 3 partitions on your primary disk :

/ (where everything goes)
/boot (a very small partition where your boot kernels(?) go)
swap (your "swap file" partition)

billr implied in this thread that you'd want to move your home directories to the new drive (so you mount your new drive at /home ).
Indeed, that probably makes most sense, since the /home dir on an sme server also contain the ibays, the samba shares and basically all the *data* on your server.

If installing applications were more your interest, I guess you would mount your new drive on ... /usr (?)

maybe you need a really, really, really big /tmp for storing really, really, really big temp files...

I have the situation where I'm using two 2.1GB drives in an old P-90 machine - I had one 2.1GB, I added another 2.1GB. I have 1.1GB in my /home so if I were to move it to the new drive, I leave a 1.1GB hole on my primary drive and only have effectively 1GB more space in my home dirs.

Unless anyone has a neat way of making /home "span" onto the new drive, I guess I have to mount my new drive to someplace like /home2 and then make a bunch of symbolic links inside users home directories so that they have folders marked "extra" that would point to "extra" space on the new drive...

And I wonder about quotas on the new drive... unless you specify quota information in /etc/fstab for mounting the new drive, how would the quota details for your primary drive relate to the quota details for your secondary?

interesting stuff, and thanks a bunch for the "howto"!

Guck

Steve Davis

Re: adding a hard drive
« Reply #2 on: November 24, 2003, 05:14:39 PM »
You seem to be the one to ask this continuing question.

I used simple mirror RAID on my e-smith 5.6 server. One of the drives died, I replaced it but on reboot the os did not detect and resurrect the mirror.

Can you tell me what to do?

Steve



billr wrote:
>
> Here is a procedure that worked for me to add an new drive to
> e-smith and make all of it the /home directory.
> Any feed back is welcome.
>
> Install the hard drive
>
> To see if the system can see the drive run after logging on
> as root
>
>    kudzu
>
> To partion the the drive (hdb is the second isa drive)
>
>    fdisk /dev/hdb
>
> To make the file system on the disk (format the disk)
>
>    mke2fs /dev/hdb1
> If  you are  replacing a directory, move it to a different
> name
>
>    mv /home /home.old
>
> To label the disk (if appropriate - this affects how you
> mount it in the fstab  file)
>
>    tune2fs -L /home /dev/hdb1
>
> edit the fstab file to mount drive
>
>    pico fstab
> Sample /etc/fstab:
>
>
>
>
> LABEL=/                 /                       ext2  
> usrquota,grpquota        1 1
>
> LABEL=/boot             /boot                   ext2  
> defaults        1 2
>
> /dev/cdrom              /mnt/cdrom              iso9660
> noauto,owner,ro 0 0
>
> /dev/fd0                /mnt/floppy             auto  
> noauto,owner    0 0
>
> none                    /proc                   proc  
> defaults        0 0
>
> none                    /dev/pts                devpts
> gid=5,mode=620  0 0
>
> /dev/hda5               swap                    swap  
> defaults        0 0
>
> LABEL=/home      /home         ext2   defaults   1 2
>
>
>
>
> To copy the contents of the old directory to the new -
> verbosely retaining attributes,  Recursively
>
>
>    cp home.old/* /home -vpR
> To remove the old directory (after testing)
>    rm home.old -R

Henrik

Re: adding a hard drive
« Reply #3 on: November 24, 2003, 11:56:14 PM »

Steve Davis

Re: adding a hard drive
« Reply #4 on: December 03, 2003, 05:53:39 PM »
Thanks Henrick,

But this page does not come up. I have tried over several days with no luck. If you have a cached copy, could you please send it to me?

Steve Davis
steve@zio.com

Henrik wrote:
>
> il help ya:
> http://lordsfam.net/staticpages/index.php?page=20031009123738266
>
> GL m8
>
> /Henrik

Graeme Fleming

Re: adding a hard drive
« Reply #5 on: December 04, 2003, 06:34:57 PM »
.. page came up fine for me!

Here tis in all its glory:

RAID1 Recovery HowTo
 Suitable for: e-smith 4.1.2/Mitel SME5
Author:  Darrell May
Contributor:  
Problem:  You want to easily recover from a RAID1 failure.

Solution:  Implement the steps outlined in the RAID1 Monitor HowTo.  Next follow these steps:
 

--------------------------------------------------------------------------------
 
STEP 1:  Backup your computer!
I can not stress this point strongly enough.  Your first priority on a failed RAID1 system should be to perform an immediate backup.

So, DO IT NOW!

[root@myezserver /root]# /sbin/e-smith/backup
 

--------------------------------------------------------------------------------
 
STEP 2: Power down, replace the failed drive, power up.
First, before we continue, I just want to show you that for testing purposes only, to completely erase a drive, do the following:

[root@myezserver /root]# dd if=/dev/zero of=/dev/hdb

This will write zeroes across the entire /dev/hdb drive.  Remember for all command-line entries in this HowTO to substitute your correct /dev/hdX where:
/dev/hda = primary master
/dev/hdb = primary slave
/dev/hdc = secondary master
/dev/hdd = secondary slave
 

--------------------------------------------------------------------------------
 
Step 3: Recover the partition information and use this information to quickly prepare the replacement drive.
[root@myezserver /root]# cat /root/raidmonitor/sfdisk.out
# partition table of /dev/hda
unit: sectors

/dev/hda1 : start=       63, size=  530082, Id=fd, bootable
/dev/hda2 : start=   530145, size=39487770, Id= 5
/dev/hda3 : start=        0, size=       0, Id= 0
/dev/hda4 : start=        0, size=       0, Id= 0
/dev/hda5 : start=   530208, size=   32067, Id=fd
/dev/hda6 : start=   562338, size=39455577, Id=fd
# partition table of /dev/hdb
unit: sectors

/dev/hdb1 : start=       63, size=  530082, Id=fd, bootable
/dev/hdb2 : start=   530145, size=39487770, Id= 5
/dev/hdb3 : start=        0, size=       0, Id= 0
/dev/hdb4 : start=        0, size=       0, Id= 0
/dev/hdb5 : start=   530208, size=   32067, Id=fd
/dev/hdb6 : start=   562338, size=39455577, Id=fd
Cut and paste your correct # partition table of /dev/hdX.  In my case I am replacing /dev/hdb so this is the information I need to transfer into a file for quick import:

[root@myezserver /root]# pico hdb.out

Which now contains the following entries, right?:

# partition table of /dev/hdb
unit: sectors

/dev/hdb1 : start=       63, size=  530082, Id=fd, bootable
/dev/hdb2 : start=   530145, size=39487770, Id= 5
/dev/hdb3 : start=        0, size=       0, Id= 0
/dev/hdb4 : start=        0, size=       0, Id= 0
/dev/hdb5 : start=   530208, size=   32067, Id=fd
/dev/hdb6 : start=   562338, size=39455577, Id=fd

Next perform the partition table import using the sfdisk command as shown below:

[root@myezserver /root]# sfdisk /dev/hdb < hdb.out
Checking that no-one is using this disk right now ...
OK

Disk /dev/hdb: 2491 cylinders, 255 heads, 63 sectors/track
Old situation:
Empty

New situation:
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End  #sectors  Id  System
/dev/hdb1   *        63    530144    530082  fd  Linux raid autodetect
/dev/hdb2        530145  40017914  39487770   5  Extended
/dev/hdb3             0         -         0   0  Empty
/dev/hdb4             0         -         0   0  Empty
/dev/hdb5        530208    562274     32067  fd  Linux raid autodetect
/dev/hdb6        562338  40017914  39455577  fd  Linux raid autodetect
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
 

--------------------------------------------------------------------------------
 
STEP 4:  Review your last known good RAID configuration:
[root@myezserver /root]# /usr/local/bin/raidmonitor -v

ALARM! RAID configuration problem

Current configuration is:

Personalities : [raid1]
read_ahead 1024 sectors
md2 : active raid1 hda1[0] 264960 blocks [2/1] [U_]
md0 : active raid1 hda5[0] 15936 blocks [2/1] [U_]
md1 : active raid1 hda6[0] 19727680 blocks [2/1] [U_]
unused devices:

Last known good configuration was:

Personalities : [raid1]
read_ahead 1024 sectors
md2 : active raid1 hdb1[1] hda1[0] 264960 blocks [2/2] [UU]
md0 : active raid1 hdb5[1] hda5[0] 15936 blocks [2/2] [UU]
md1 : active raid1 hdb6[1] hda6[0] 19727680 blocks [2/2] [UU]
unused devices:
 

--------------------------------------------------------------------------------
 
STEP 5:  Add your newly prepared and correctly partitioned hard drive into the RAID1 array.  You use the information above as your guide:
[root@myezserver /root]# /sbin/raidhotadd /dev/md2 /dev/hdb1
[root@myezserver /root]# /sbin/raidhotadd /dev/md0 /dev/hdb5
[root@myezserver /root]# /sbin/raidhotadd /dev/md1 /dev/hdb6
 

--------------------------------------------------------------------------------
 
STEP 6:  Use raidmonitor to watch the recovery process.  Note this information will also be e-mailed to root every 15 min. until the recovery is completed.
[root@myezserver /root]# /usr/local/bin/raidmonitor -v

ALARM! RAID configuration problem

Current configuration is:

Personalities : [raid1]
read_ahead 1024 sectors
md2 : active raid1 hdb1[1] hda1[0] 264960 blocks [2/2] [UU]
md0 : active raid1 hdb5[1] hda5[0] 15936 blocks [2/2] [UU]
md1 : active raid1 hdb6[2] hda6[0] 19727680 blocks [2/1] [U_] recovery=5% finish=10.0min
unused devices:

Last known good configuration was:

Personalities : [raid1]
read_ahead 1024 sectors
md2 : active raid1 hdb1[1] hda1[0] 264960 blocks [2/2] [UU]
md0 : active raid1 hdb5[1] hda5[0] 15936 blocks [2/2] [UU]
md1 : active raid1 hdb6[1] hda6[0] 19727680 blocks [2/2] [UU]
unused devices:
 

--------------------------------------------------------------------------------
 
STEP 7:  Recover and restore the last known good master boot record (MBR) onto the drive you just replaced:
[root@myezserver /root]# /sbin/lilo -C /root/raidmonitor/lilo.conf -b /dev/hdb
 

--------------------------------------------------------------------------------
 
STEP 8:  Shutdown the server, reboot and test the RAID functions
If you have the time, you should test the RAID functionality to make sure the server will boot under simulated hdd failures.

start by booting with both drives attached
power down, disconnect one of the drives, power up, check boot
power down, reconnect the drive, power up and rebuild the array as above repeating steps 5 and 6 only
power down, disconnect the other drive, power up, check boot
power down, reconnect the drive, power up and rebuild the array as above repeating steps 5 and 6 only
OK, now you can confidently say your ready for anything.  Remember if anything goes wrong here, you simply reconnect all the hardware, perform a fresh RAID install and then restore from your backup tape.  You did perform STEP 1 correct?
 

--------------------------------------------------------------------------------
 
STEP 9:  When all looks well, re-initialze raidmonitor:
[root@myezserver /root]# /usr/local/bin/raidmonitor -iv
 

--------------------------------------------------------------------------------
 
STEP 10: Go have drink.  Job well done ;->