Difference between revisions of "AddExtraHardDisk"

From SME Server
Jump to navigationJump to search
(symlink method changed, raid note moved up, file permissions pruned)
m (Minor changes for logical naming)
Line 6: Line 6:
  
 
== Assumptions ==
 
== Assumptions ==
It assumes adding one PATA (IDE) harddrive as master on the second IDE controller, but the process will be similar in other situations. More on that in step 2.1.
+
*It assumes adding one PATA (IDE) harddrive as master on the second IDE controller, but the process will be similar in other situations. More on that in step 2.1.
  
The harddrive will be named bigdisk, this name will not be visible to the user.
+
*The harddrive will be named newdisk, this name will not be visible to the user.
  
You already have an ibay named mp3, this will be redirected to the new disk (together with its content). This name may be visible to the user (depending on the permissions).
+
*You already have an ibay named IBAYNAME, this will be redirected to the new disk (together with its content). This name may be visible to the user (depending on the permissions).
  
You can replace the names bigdisk and mp3 with whatever valid name, just keep track of the names.
+
*You can replace the names newdisk and IBAYNAME with whatever valid name, just keep track of the names.
  
 
== Notes about RAID ==
 
== Notes about RAID ==
Line 96: Line 96:
  
 
3.0 Create a directory underneath /mnt
 
3.0 Create a directory underneath /mnt
  mkdir /mnt/bigdisk
+
  mkdir /mnt/newdisk
  
 
3.1 Automount at boot time
 
3.1 Automount at boot time
Line 104: Line 104:
 
  pico /etc/fstab
 
  pico /etc/fstab
 
Add the following data to the file (separate columns with a hit on the space-bar):
 
Add the following data to the file (separate columns with a hit on the space-bar):
  /dev/hdc1 /mnt/bigdisk ext3 usrquota,grpquota 1 2  
+
  /dev/hdc1 /mnt/newdisk ext3 usrquota,grpquota 1 2  
 
Make sure you end this line with a newline (with enter).
 
Make sure you end this line with a newline (with enter).
 
<br>Hit <ctrl-x> to exit the editor, y and enter to save.
 
<br>Hit <ctrl-x> to exit the editor, y and enter to save.
Line 118: Line 118:
 
  /dev/hda3  ext3 39151724  28441348 8721532  77%  /
 
  /dev/hda3  ext3 39151724  28441348 8721532  77%  /
 
  /dev/hda1  ext3 101089    8953    86917    10%  /boot
 
  /dev/hda1  ext3 101089    8953    86917    10%  /boot
  /dev/hdc1  ext3 38474956  27948    38447008  0%  /mnt/bigdisk
+
  /dev/hdc1  ext3 38474956  27948    38447008  0%  /mnt/newdisk
  
 
If you don't see a line for /dev/hdc1, something went wrong.
 
If you don't see a line for /dev/hdc1, something went wrong.
Line 138: Line 138:
 
<br>In some cases that might be a good idea, but in most cases you are just wasting the remaining space of your first disk.
 
<br>In some cases that might be a good idea, but in most cases you are just wasting the remaining space of your first disk.
  
Alternative 2: A much better approach is to leave the second disk mounted at /mnt/bigdisk and to create symlinks (symbolic links) for specific ibays or user folders.  
+
Alternative 2: A much better approach is to leave the second disk mounted at /mnt/newdisk and to create symlinks (symbolic links) for specific ibays or user folders.  
  
The following example shows you how to place the mp3 ibay on the second disk.  
+
The following example shows you how to place the IBAYNAME ibay on the second disk.  
  
 
4.1 Create the necessary subdirectories on your second disk
 
4.1 Create the necessary subdirectories on your second disk
  mkdir -p /mnt/bigdisk/ibays/mp3
+
  mkdir -p /mnt/newdisk/ibays/IBAYNAME
  
  
 
4.2 Check the ownerships and permissions on the original directory
 
4.2 Check the ownerships and permissions on the original directory
  ls -l /home/e-smith/files/ibays/mp3
+
  ls -l /home/e-smith/files/ibays/IBAYNAME
  
drwxrwxr-x 18 admin allstaff 4096 Sep 23 14:48 mp3
+
drwxrwxr-x 18 admin allstaff 4096 Sep 23 14:48 IBAYNAME
  
 
4.3 Change ownership as in the original. The "-R" (optional) means recursive, subdirectorys will be included in the command.
 
4.3 Change ownership as in the original. The "-R" (optional) means recursive, subdirectorys will be included in the command.
  chown -R admin:allstaff /mnt/bigdisk/ibays/mp3
+
  chown -R admin:allstaff /mnt/newdisk/ibays/IBAYNAME
  
4.4 Set permissions to the ibay mp3 as in the original. For help on this, look at bottom of this page. The "-R" (optional) means recursive, subdirectorys will be included in the command.  
+
4.4 Set permissions to the ibay IBAYNAME as in the original. For help on this, look at bottom of this page. The "-R" (optional) means recursive, subdirectorys will be included in the command.  
  chmod 775 -R /mnt/bigdisk/ibays/mp3
+
  chmod 775 -R /mnt/newdisk/ibays/IBAYNAME
  
 
4.5 Copy the content to your new disk
 
4.5 Copy the content to your new disk
  cp -rip /home/e-smith/files/ibays/mp3/* /mnt/bigdisk/ibays/mp3
+
  cp -rip /home/e-smith/files/ibays/IBAYNAME/* /mnt/newdisk/ibays/IBAYNAME
  
 
4.6 Check if all files have been copied correctly
 
4.6 Check if all files have been copied correctly
  diff -r /mnt/bigdisk/ibays/mp3 /home/e-smith/files/ibays/mp3
+
  diff -r /mnt/newdisk/ibays/IBAYNAME /home/e-smith/files/ibays/IBAYNAME
  
 
4.7 Remove the original files
 
4.7 Remove the original files
  rm -rf /home/e-smith/files/ibays/mp3
+
  rm -rf /home/e-smith/files/ibays/IBAYNAME
  
 
4.8 Create a symlink to the new location
 
4.8 Create a symlink to the new location
  ln -s /mnt/bigdisk/ibays/mp3 /home/e-smith/files/ibays/mp3
+
  ln -s /mnt/newdisk/ibays/IBAYNAME /home/e-smith/files/ibays/IBAYNAME
  
 
4.9 Test the new location
 
4.9 Test the new location
  ls /home/e-smith/files/ibays/mp3
+
  ls /home/e-smith/files/ibays/IBAYNAME
  
 
4.10 If you want the ibay to be accessible from the internet, you also need to enable "follow symlinks" in apache:
 
4.10 If you want the ibay to be accessible from the internet, you also need to enable "follow symlinks" in apache:

Revision as of 15:47, 10 August 2007

Add extra harddisk

This HowTo are based on Michiel Blotwijk original.

Description

How to add an extra hard disk to an existing (running) SME server 7.x.

Assumptions

  • It assumes adding one PATA (IDE) harddrive as master on the second IDE controller, but the process will be similar in other situations. More on that in step 2.1.
  • The harddrive will be named newdisk, this name will not be visible to the user.
  • You already have an ibay named IBAYNAME, this will be redirected to the new disk (together with its content). This name may be visible to the user (depending on the permissions).
  • You can replace the names newdisk and IBAYNAME with whatever valid name, just keep track of the names.

Notes about RAID

  • When you install SMEserver, ALL connected harddrives will be part of an RAID-array.
  • When you add a drive to a running system, it will not take part of anything unless you do something about it. This is the case in this HowTo. Note that it will NOT take part in any RAID array and hence, get no redundancy.
  • If you want the new drive to be part of an RAID array instead, get shell access, login as admin and select "5. Manage disk redundancy" and follow the instructions. The new disk should be empty and contain no partitions before doing this.

Step-by-step HowTo

1 Preparation

1.0 Mount the harddrive and fire up your machine.

1.1 Get direct shell access and login as root.

1.2 Tell init to go to single-user mode.

telinit 1

This will make you loose connection if you working through an ssh-client (like Putty). You need direct access to the shell to proceed.

2 Partition

2.0 Now you need to identify the device name of the new disk.

The following command will show you all the drives on your server (including any USB drives you might have).

fdisk -l | more 
Partition overwiev
Role IDE controller Device name
Master 1 /dev/hda
Slave 1 /dev/hdb
Master 2 /dev/hdc
Slave 2 /dev/hdd


2.1 Let's assume you installed the disk as master on the second IDE controller.
This means you have to partition /dev/hdc

fdisk /dev/hdc

and when prompted:

n (to add a new partition)
p (to make a primary partion)
1 (that's the number one, the number you want to assign to the partition)

Accept the suggested first & last cylinder values

w (write and exit)

This will create the primary partition /dev/hdc1, using the entire disk space.

2.2 Format the new partition to ext3:

mkfs.ext3 /dev/hdc1

3 Mount

Create a mounting point for the new disk

A mounting point is just an empty directory that will link to your new disk.
This can be any valid directory on your server, but it is recommended not to use /home or one of its subdirectories.
In step 4 you will see a much better method to link your /home directory to the second disk.

3.0 Create a directory underneath /mnt

mkdir /mnt/newdisk

3.1 Automount at boot time
To automatically mount the partition at boot time, you need to add the following line to the file /etc/fstab
It can be done in the text editor Pico

pico /etc/fstab

Add the following data to the file (separate columns with a hit on the space-bar):

/dev/hdc1 /mnt/newdisk ext3 usrquota,grpquota 1 2 

Make sure you end this line with a newline (with enter).
Hit <ctrl-x> to exit the editor, y and enter to save.

3.2 Mount manually (this time) all filesystems listed in /etc/fstab

mount -a

3.3 Report the amount of free disk space available on all mounted filesystems + the type of each filesystem, check if it looks OK.

df -T
Filesystem Type 1k-blocks Used     Available Use% Mounted on
/dev/hda3  ext3 39151724  28441348 8721532   77%  /
/dev/hda1  ext3 101089    8953     86917     10%  /boot
/dev/hdc1  ext3 38474956  27948    38447008   0%  /mnt/newdisk

If you don't see a line for /dev/hdc1, something went wrong.
Go back to step 2 and check if you followed all instructions correctly.

4 Mapping

4.0 Alternatives

Alternative 1: Use /home to mount the new disk

On standard Linux machines, the /home directory contains the user's directories and is therefore a popular place to mount a bigger disk.

However, on a SME server this is not a good idea:

SME stores all its configuration files in /home/e-smith/db.
If for whatever reason your disk doesn't mount, the configuration files will no longer be accessible, causing all kinds of nasty problems.

Mounting your second disk to /home or even /home/e-smith/files effectively means that your first disk will no longer be used to store user files.
In some cases that might be a good idea, but in most cases you are just wasting the remaining space of your first disk.

Alternative 2: A much better approach is to leave the second disk mounted at /mnt/newdisk and to create symlinks (symbolic links) for specific ibays or user folders.

The following example shows you how to place the IBAYNAME ibay on the second disk.

4.1 Create the necessary subdirectories on your second disk

mkdir -p /mnt/newdisk/ibays/IBAYNAME


4.2 Check the ownerships and permissions on the original directory

ls -l /home/e-smith/files/ibays/IBAYNAME

drwxrwxr-x 18 admin allstaff 4096 Sep 23 14:48 IBAYNAME

4.3 Change ownership as in the original. The "-R" (optional) means recursive, subdirectorys will be included in the command.

chown -R admin:allstaff /mnt/newdisk/ibays/IBAYNAME

4.4 Set permissions to the ibay IBAYNAME as in the original. For help on this, look at bottom of this page. The "-R" (optional) means recursive, subdirectorys will be included in the command.

chmod 775 -R /mnt/newdisk/ibays/IBAYNAME 

4.5 Copy the content to your new disk

cp -rip /home/e-smith/files/ibays/IBAYNAME/* /mnt/newdisk/ibays/IBAYNAME 

4.6 Check if all files have been copied correctly

diff -r /mnt/newdisk/ibays/IBAYNAME /home/e-smith/files/ibays/IBAYNAME 

4.7 Remove the original files

rm -rf /home/e-smith/files/ibays/IBAYNAME 

4.8 Create a symlink to the new location

ln -s /mnt/newdisk/ibays/IBAYNAME /home/e-smith/files/ibays/IBAYNAME 

4.9 Test the new location

ls /home/e-smith/files/ibays/IBAYNAME

4.10 If you want the ibay to be accessible from the internet, you also need to enable "follow symlinks" in apache:

db accounts setprop IBAYNAME FollowSymLinks enabled
signal-event ibay-modify IBAYNAME

5 Quota (optional)

Next you might want to activate the quota on the disk.
This will only work if you activated quota management for at least one user (Server Manager > Collaboration > Quota Management).

quotacheck -vugc /dev/hdc1

If you get "quotacheck: Old file not found" you probably haven't activated quota management.
If quotachecks comes back to the command prompt without errors, you're ready.

6 Final check

Reboot your machine

reboot

Check if the drive was mounted correctly with

df -T

and/or surf to your ibay.

If it looks fine, relax and tell the world about it, you made it!

Notes about file permissions

  • For help about chmod and file permissions, look at

ss64 or oreillynet.