Difference between revisions of "AddExtraHardDisk"

From SME Server
Jump to navigation Jump to search
m (→‎Notes about RAID: Minor mod)
m (Corrected typo "expand-templates" to "expand-template")
 
(48 intermediate revisions by 11 users not shown)
Line 1: Line 1:
==Add extra harddisk==
+
{{Languages|AddExtraHardDisk}}
 +
{{Level|Advanced}}
 +
{{usefulnote}}
 +
 
 
This HowTo are based on [http://mirror.contribs.org/smeserver/contribs/mblotwijk/HowToGuides/AddExtraHardDisk.htm Michiel Blotwijk original].
 
This HowTo are based on [http://mirror.contribs.org/smeserver/contribs/mblotwijk/HowToGuides/AddExtraHardDisk.htm Michiel Blotwijk original].
  
ATTENTION! It is not yet tested by myself in this new form, but it will be soon.
+
== Description ==
<br> I may have missed something....
+
How to add an extra hard disk to an existing (running) SME server 7.x.
 +
 
 +
{{Warning box|If you were looking for the details of Adding a larger Hard Disk Drive (HDD) to an existing Raid or Upgrading the HDD of an existing RAID  array - Look Here: http://wiki.contribs.org/Raid#Upgrading_the_Hard_Drive_Size}} 
 +
 
 +
{{Warning box|'''Adding a Single Disk (or non-raid disks):''' If you are adding only a single or non-raid disk then please note that the added harddrive will NOT take part of a RAID-array and hence get no redundancy.  
  
== Description ==
+
If you do have a disk failure (or complete raid array failure) of this additional unit, then it can also halt the boot process. See the note on configuring fstab.
How to add an extra hard disk to an existing SME server.
+
 
 +
It's intended for special purposes only where you can benefit from mounting a dedicated harddrive to an ibay.}}
 +
 
 +
{{Warning box|If you do a complete re-install at a later time, please recall that all available disks will be used at that time including these new additions. If you do a re-install and wish to preserve this data then ensure you remove these hard drives at that time.}}
 +
 
 +
== Assumptions ==
 +
{{Note box|This HowTo uses the default naming of Hard Disks with PATA (IDE), when you have Sata Hard Disks the names of these drives are '''sda (/dev/sda)''' for the first, '''sdb (/dev/sdb)''' for the second, '''sdc (/dev/sdc)''' for the third...etc. You have to adjust these command lines to match the naming of your drives.}}
 +
 
 +
*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.
  
It assumes adding one PATA harddrive, but the process will be similar in other situations.
+
*If you want the new drive to be part of the SME 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.
  
The harddrive will be named bigdisk, you can choose whatever, just keep track of the name.
+
*For more info about RAID and disk management, take a look in the [[SME_Server:Documentation]].
  
 
== Step-by-step HowTo ==
 
== Step-by-step HowTo ==
  
=== 1 Preparation ===
+
=== Preparation ===
 
1.0 Mount the harddrive and fire up your machine.
 
1.0 Mount the harddrive and fire up your machine.
  
1.1 Get shell access and login as root.
+
1.1 Get direct shell access and login as root.
  
1.2 Switch to single-user mode.
+
1.2 Tell init to go to single-user mode. (Optional, if the drives are complete clean, this is not necessary)
  
 
  telinit 1
 
  telinit 1
  
=== 2 Partition ===
+
This will make you loose connection if you working through an ssh-client (like Putty). You need direct access to the shell to proceed.
 +
 
 +
{{Note box| All these operations should work through a remote SSH connexion, so you doesn't need a direct access to the server, except to mount a new hard disk}}
 +
 
 +
=== Partition ===
 +
====Identifying the disks====
 +
 
 
2.0 Now you need to identify the device name of the new disk.  
 
2.0 Now you need to identify the device name of the new disk.  
 +
 +
As a safety measure, identify and mark your disks. The following smartctl command will identify various parameters including the serial number which can be matched to the serial number on the physical package.
 +
smartctl -i /dev/hdc
  
 
The following command will show you all the drives on your server (including any USB drives you might have).
 
The following command will show you all the drives on your server (including any USB drives you might have).
Line 30: Line 65:
 
  fdisk -l | more  
 
  fdisk -l | more  
  
Overwiev of harddrives:
+
{| border="1"
<br>Role IDE Device
+
|+Partition overwiev
<br>Master 1 /dev/hda
+
|-
<br>Slave 1 /dev/hdb
+
!Role
<br>Master 2 /dev/hdc
+
!IDE controller
<br>Slave 2 /dev/hdd
+
!Device name
 +
|-
 +
|Master
 +
|align="center"|1
 +
|align="center"|/dev/hda
 +
|-
 +
|Slave
 +
|align="center"|1
 +
|align="center"|/dev/hdb
 +
|-
 +
|Master
 +
|align="center"|2
 +
|align="center"|/dev/hdc
 +
|-
 +
|Slave
 +
|align="center"|2
 +
|align="center"|/dev/hdd
 +
|}
  
''My intention was to have a nice table instead, but I couldn't get it right. You can see it at the end.''
+
{{Note box|If you are setting up a raid array, it is a really good idea to eliminate single points of failure. For example try to avoid putting to disks of the same raid array on the same ribbon cable. }}
  
 +
====Partitioning the disk====
 
2.1 Let's assume you installed the disk as master on the second IDE controller.
 
2.1 Let's assume you installed the disk as master on the second IDE controller.
 
<br>This means you have to partition /dev/hdc
 
<br>This means you have to partition /dev/hdc
Line 47: Line 100:
  
 
  n (to add a new partition)
 
  n (to add a new partition)
  p (to make a primary partion)
+
  p (to make a primary partition)
 
  1 (that's the number one, the number you want to assign to the partition)
 
  1 (that's the number one, the number you want to assign to the partition)
 +
 +
Only if you will be adding this disk to to a RAID set, then you will also need to change the partition type.
 +
t (to change partition type)
 +
L (within t's prompt to list available partition type)
 +
fd (normally the partition type is fd but verify from the L command and look for "Linux raid autodetect"
  
 
Accept the suggested first & last cylinder values
 
Accept the suggested first & last cylinder values
Line 56: Line 114:
 
This will create the primary partition /dev/hdc1, using the entire disk space.
 
This will create the primary partition /dev/hdc1, using the entire disk space.
  
2.2 Format the new partition:
+
You will need to do this for each new disk you added.
 +
 
 +
====Formating for a non-raid disk====
 +
2.2 For a non-raid disk, Format the new partition to ext3:
 +
mkfs.ext3 /dev/hdc1
 +
 
 +
 
 +
====Additional steps to create a raid array from multiple disks====
 +
 
 +
2.3 When you create an array, the various disks you added will be combined and be represented as a single entity typically identified as /dev/mdxx where xx is a number. For example, the SME Raids are typically on md1, md2, and in some cased md0.
 +
 
 +
For your purposes, you will choose an available one. In this example we will use md11 in an attempt to not get in the way of future changes to SME and make it easy to identify your new set.
 +
 
 +
First we need to add the newly (and identically) partitioned disks to the raid device:
 +
mdadm --create --verbose /dev/md11 --level=1 --raid-devices=2 /dev/hdc1 /dev/hdd1
 +
 
 +
At this point the Raid will begin building.
 +
 
 +
Next you will need to format the new array:
 +
mkfs.ext3 /dev/md11
  
  mkfs -t ext2 /dev/hdc1
+
You can verify that all is good with the following commands:
 +
  cat /proc/mdstat
 +
mdadm --detail --scan --verbose
  
2.3 Convert the partition to the ext3 format:
+
next you will need to edit the /etc/mdadm.conf file to add your array with the following after the other ARRAY entries:
  tune2fs -j /dev/hdc1
+
  # added by <your name here> -- so you can identify later you did this.
   
+
ARRAY /dev/md11
=== 3 Mount ===
+
 
Create a mounting point for the new disk  
+
Alternatively you could add the output of
 +
  mdadm --detail --scan --verbose
 +
 
 +
to this file instead to be more specific. I have not tried this.
 +
 
 +
=== Mount ===
 +
3.0 Create a mounting point for the new disk  
 +
 
 +
{{Note box|This method uses fstab to mount your disk and forces an fsck. This method ensures that the disk is up and available early and has been verified for consistancy. However, the side effect is if there is a fatal error with the added single disk or the entire added raid array, then the system will stop at the fsck step in the boot process. If this happens, you will be given an option to log into the shell where you can perform recovery operations or modify fstab to prevent the disk from mounting and continue without the disk so that you can rectify the situation at your leisure while allowing the core system to run.}}
  
 
A mounting point is just an empty directory that will link to your new disk.
 
A mounting point is just an empty directory that will link to your new disk.
Line 70: Line 157:
 
<br>In step 4 you will see a much better method to link your /home directory to the second disk.
 
<br>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
+
3.1 Create a directory underneath /mnt
  mkdir /mnt/bigdisk
+
  mkdir /mnt/newdisk
  
3.1 Automount at boot time
+
3.2 Automount at boot time
 
<br>To automatically mount the partition at boot time, you need to add the following line to the file /etc/fstab  
 
<br>To automatically mount the partition at boot time, you need to add the following line to the file /etc/fstab  
<br>It can be done in the text editor Pico
 
  
pico /etc/fstab /dev/hdc1 /mnt/bigdisk ext3 usrquota,grpquota 1 2  
+
This entry assumes among other things that you will be running user and group quota, the "1" indicates it is a disk that should be backed up with dump, the "2" indicates fsck should be run as a second priority. If you wish to modify these parameters, ensure you fully understand them as these are crucial to your system's operation.
  
Make sure you end this line with a newline. Hit <ctrl-x> to exit the editor
+
It can be done in the text editor nano for SME8 and pico SME7
  
3.2 Mount manually (this time) all filesystems listed in /etc/fstab
+
nano /etc/fstab
 +
Add the following data to the file for a SINGLE disk (separate columns with a hit on the space-bar):
 +
/dev/hdc1 /mnt/newdisk ext3 usrquota,grpquota 1 2
 +
 
 +
or for a RAID array:
 +
/dev/md11 /mnt/newdisk ext3 usrquota,grpquota 1 2
 +
 
 +
Make sure you end this line with a newline (with enter).
 +
<br>Hit <ctrl-x> to exit the editor, y and enter to save.
 +
 
 +
3.3 Mount manually (this time) all filesystems listed in /etc/fstab
  
 
  mount -a
 
  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.
+
3.4 Report the amount of free disk space available on all mounted filesystems + the type of each filesystem, check if it looks OK.
 
  df -T
 
  df -T
  
Line 91: Line 187:
 
  /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 (or /dev/md11 if it is raid), something went wrong.
 
<br>Go back to step 2 and check if you followed all instructions correctly.
 
<br>Go back to step 2 and check if you followed all instructions correctly.
  
=== 4 Mapping ===
+
=== Mapping ===
4.0 Alternatives
+
'''4.0 Alternatives'''
  
Alternative 1: Use /home to mount the new disk
+
====Alternative 1: Use /home/e-smith/files to mount the new disk====
 +
 
 +
Ideal if you wish to have one set of disks run SME and another set to be the user and ibay data.
  
 
On standard Linux machines, the /home directory contains the user's directories and is therefore a popular place to mount a bigger 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:
+
However, on SME server this is not a good idea:
  
 
SME stores all its configuration files in /home/e-smith/db.  
 
SME stores all its configuration files in /home/e-smith/db.  
 
<br>If for whatever reason your disk doesn't mount, the configuration files will no longer be accessible, causing all kinds of nasty problems.
 
<br>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.
+
Mounting under /home/e-smith/files however is useful if you wish your secondary disk to be your primary data repository for ibays and users.
<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.
+
Mounting your second disk to /home/e-smith/files effectively means that your first disk will no longer be used to store user files.
 +
<br>In some cases that might be a good idea (system vs data seperation), but in many cases you are just wasting the remaining space of your first disk. <br> An additional benefit is that SME processes will work seemlessly (see also Option Steps).
  
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.
 
  
The following example shows you how to place the mp3 ibay on the second disk.
 
  
4.1 Create the necessary subdirectories on your second disk
+
====Alternative 2: Mounting a specific ibay or user====
mkdir -p /mnt/bigdisk/ibays/mp3
 
  
 +
Similar to alternative 1, you can simply mount the disk for a specific iBay. If you need multiple iBays covered though it implies you have to create multiple partitions on the disk. The benefit like alternative one is simplicity of standard SME processes while limiting waste on your primary disk. The down side is inflexibility and waste on the secondary disk.
  
4.2 Check the ownerships and permissions on the original directory
+
==== Alternative 3: Mounting and Symlinking ====
ls -l /home/e-smith/files/ibays/mp3
+
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 benefit is flexibility and efficient usage of the all disks. The down side is that you may have to make more modifications to ensure SME services and contribs work as expected (see also Optional Steps).
  
drwxrwxr-x 18 admin allstaff 4096 Sep 23 14:48 mp3
+
The following example shows you how to place the IBAYNAME ibay on the second disk using Alternative (3).
  
4.3 Change ownership as in the original.
+
===== Create the necessary subdirectories on your second disk =====
  chown admin:allstaff /mnt/bigdisk/ibays/mp3
+
  mkdir -p /mnt/newdisk/ibays/IBAYNAME
  
4.4 Set permissions to the ibay mp3 as in the original.
+
===== Check the ownerships and permissions on the original directory =====
  chmod 775 /mnt/bigdisk/ibays/mp3
+
  ls -l /home/e-smith/files/ibays/IBAYNAME
  
4.5 Copy the content to your new disk
+
drwxrwxr-x 18 admin allstaff 4096 Sep 23 14:48 IBAYNAME
cp -rip /home/e-smith/files/ibays/mp3/* /mnt/bigdisk/ibays/mp3
 
  
4.6 Check if all files have been copied correctly
+
===== Change ownership as in the original =====
  diff -r /mnt/bigdisk/ibays/mp3 /home/e-smith/files/ibays/mp3
+
The "-R" (optional) means recursive, subdirectorys will be included in the command.
 +
  chown -R originaluser:originalgroup /mnt/newdisk/ibays/IBAYNAME
  
4.7 Remove the original files
+
===== Set permissions to the ibay IBAYNAME as in the original =====
  rm -rf /home/e-smith/files/ibays/mp3
+
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.8 Create a symlink to the new location
+
===== Copy the content to your new disk =====
ln -s /mnt/bigdisk/ibays/mp3 /home/e-smith/files/ibays/mp3
+
a=archive option to preserve owner/group/permissions/links; i=interactive:
 +
cp -ai /home/e-smith/files/ibays/IBAYNAME/* /mnt/newdisk/ibays/IBAYNAME
  
4.9 Test the new location
+
===== Check if all files have been copied correctly =====
  ls /home/e-smith/files/ibays/mp3
+
  diff -r /mnt/newdisk/ibays/IBAYNAME /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:
+
===== Remove the original files =====
  mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
+
  rm -rf /home/e-smith/files/ibays/IBAYNAME
  
  echo Options FollowSymLinks >> /etc/e-smith/templates custom/etc/httpd/conf/httpd.conf/85DefaultAccess
+
===== Create a symlink to the new location
 +
  ln -s /mnt/newdisk/ibays/IBAYNAME /home/e-smith/files/ibays/IBAYNAME
  
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
+
===== Enable Wide Links for Samba (SME9) =====
  
  /etc/init.d/httpd graceful
+
  config setprop smb WideLinks yes
 +
expand-template /etc/samba/smb.conf
 +
service smb restart
  
=== 5 Quota ===
+
===== Test the new location =====
 +
ls /home/e-smith/files/ibays/IBAYNAME
  
Next you might want to activate the quota on the disk (optional).  
+
=== Optional Steps to Extend services ===
This will only work if you activated quota management for at least one user (Server Manager > Collaboration > Quota Management).
+
==== Quota ====
 +
 
 +
5.1 Next you might want to activate the quota on the disk.  
 +
<br>This will only work if you activated quota management for at least one user (Server Manager > Collaboration > Quota Management).
  
 
  quotacheck -vugc /dev/hdc1
 
  quotacheck -vugc /dev/hdc1
 
If quotachecks comes back to the command prompt without errors, you're ready.
 
  
=== 6 Final check ===
+
If you get "quotacheck: Old file not found" you probably haven't activated quota management.
 +
<br>If quotachecks comes back to the command prompt without errors, you're ready.
 +
 
 +
==== Virus Scan ====
 +
5.2 By default virus scan only scans /home/e-smith/files and does not follow symlinks. If you wish to have the additional hard drive to be scanned then you either need to mount it under this directory or follow the guidelines in http://wiki.contribs.org/SME_Server:Documentation:FAQ#Virus_Scanning.
 +
 
 +
==== Apache ====
 +
5.3 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
 +
 
 +
==== Unknown ====
 +
There may be other steps or modifications to services not yet encountered. If you find some, please document it here.
 +
 
 +
=== Final check ===
  
 
Reboot your machine
 
Reboot your machine
Line 173: Line 292:
 
If it looks fine, relax and tell the world about it, you made it!
 
If it looks fine, relax and tell the world about it, you made it!
  
== Notes about RAID ==
+
== Notes about file permissions ==
*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.
 
 
 
*For more info about RAID and disk management, take a look in the [[SME_Server:Documentation]].
 
  
{| border="1"
+
*For help about chmod and file permissions, look at
|+Partition overwiev
+
[http://www.ss64.com/bash/chmod.html ss64] or [http://www.oreillynet.com/linux/cmd/cmd.csp?path=c/chmod oreillynet].
|-
 
!Role
 
!IDE controller
 
!Device name
 
|-
 
|Master
 
|1
 
|/dev/hda
 
|-
 
|Slave
 
|1
 
|/dev/hdb
 
|-
 
|Master
 
|2
 
|/dev/hdc
 
|-
 
|Slave
 
|2
 
|/dev/hdd
 
|-}
 
  
  
 
----
 
----
 
[[Category:Howto]]
 
[[Category:Howto]]
 +
[[Category:Administration:Storage]]

Latest revision as of 13:34, 1 October 2017


PythonIcon.png Skill level: Advanced
The instructions on this page may require deviations from standard procedures. A good understanding of linux and Koozali SME Server is recommended.


Is this article helpful to you?
Please consider donating or volunteering
Thank you!

This HowTo are based on Michiel Blotwijk original.

Description

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


  Warning:
If you were looking for the details of Adding a larger Hard Disk Drive (HDD) to an existing Raid or Upgrading the HDD of an existing RAID array - Look Here: http://wiki.contribs.org/Raid#Upgrading_the_Hard_Drive_Size



  Warning:
Adding a Single Disk (or non-raid disks): If you are adding only a single or non-raid disk then please note that the added harddrive will NOT take part of a RAID-array and hence get no redundancy.

If you do have a disk failure (or complete raid array failure) of this additional unit, then it can also halt the boot process. See the note on configuring fstab.

It's intended for special purposes only where you can benefit from mounting a dedicated harddrive to an ibay.



  Warning:
If you do a complete re-install at a later time, please recall that all available disks will be used at that time including these new additions. If you do a re-install and wish to preserve this data then ensure you remove these hard drives at that time.


Assumptions

  Note:
This HowTo uses the default naming of Hard Disks with PATA (IDE), when you have Sata Hard Disks the names of these drives are sda (/dev/sda) for the first, sdb (/dev/sdb) for the second, sdc (/dev/sdc) for the third...etc. You have to adjust these command lines to match the naming of your drives.


  • 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 the SME 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

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. (Optional, if the drives are complete clean, this is not necessary)

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.


  Note:
All these operations should work through a remote SSH connexion, so you doesn't need a direct access to the server, except to mount a new hard disk


Partition

Identifying the disks

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

As a safety measure, identify and mark your disks. The following smartctl command will identify various parameters including the serial number which can be matched to the serial number on the physical package.

smartctl -i /dev/hdc 

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


  Note:
If you are setting up a raid array, it is a really good idea to eliminate single points of failure. For example try to avoid putting to disks of the same raid array on the same ribbon cable.


Partitioning the disk

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 partition)
1 (that's the number one, the number you want to assign to the partition)

Only if you will be adding this disk to to a RAID set, then you will also need to change the partition type.

t (to change partition type)
L (within t's prompt to list available partition type)
fd (normally the partition type is fd but verify from the L command and look for "Linux raid autodetect"

Accept the suggested first & last cylinder values

w (write and exit)

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

You will need to do this for each new disk you added.

Formating for a non-raid disk

2.2 For a non-raid disk, Format the new partition to ext3:

mkfs.ext3 /dev/hdc1


Additional steps to create a raid array from multiple disks

2.3 When you create an array, the various disks you added will be combined and be represented as a single entity typically identified as /dev/mdxx where xx is a number. For example, the SME Raids are typically on md1, md2, and in some cased md0.

For your purposes, you will choose an available one. In this example we will use md11 in an attempt to not get in the way of future changes to SME and make it easy to identify your new set.

First we need to add the newly (and identically) partitioned disks to the raid device:

mdadm --create --verbose /dev/md11 --level=1 --raid-devices=2 /dev/hdc1 /dev/hdd1

At this point the Raid will begin building.

Next you will need to format the new array:

mkfs.ext3 /dev/md11

You can verify that all is good with the following commands:

cat /proc/mdstat
mdadm --detail --scan --verbose

next you will need to edit the /etc/mdadm.conf file to add your array with the following after the other ARRAY entries:

# added by <your name here> -- so you can identify later you did this.
ARRAY /dev/md11

Alternatively you could add the output of

mdadm --detail --scan --verbose

to this file instead to be more specific. I have not tried this.

Mount

3.0 Create a mounting point for the new disk


  Note:
This method uses fstab to mount your disk and forces an fsck. This method ensures that the disk is up and available early and has been verified for consistancy. However, the side effect is if there is a fatal error with the added single disk or the entire added raid array, then the system will stop at the fsck step in the boot process. If this happens, you will be given an option to log into the shell where you can perform recovery operations or modify fstab to prevent the disk from mounting and continue without the disk so that you can rectify the situation at your leisure while allowing the core system to run.


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.1 Create a directory underneath /mnt

mkdir /mnt/newdisk

3.2 Automount at boot time
To automatically mount the partition at boot time, you need to add the following line to the file /etc/fstab

This entry assumes among other things that you will be running user and group quota, the "1" indicates it is a disk that should be backed up with dump, the "2" indicates fsck should be run as a second priority. If you wish to modify these parameters, ensure you fully understand them as these are crucial to your system's operation.

It can be done in the text editor nano for SME8 and pico SME7

nano /etc/fstab

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

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

or for a RAID array:

/dev/md11 /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.3 Mount manually (this time) all filesystems listed in /etc/fstab

mount -a

3.4 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 (or /dev/md11 if it is raid), something went wrong.
Go back to step 2 and check if you followed all instructions correctly.

Mapping

4.0 Alternatives

Alternative 1: Use /home/e-smith/files to mount the new disk

Ideal if you wish to have one set of disks run SME and another set to be the user and ibay data.

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 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 under /home/e-smith/files however is useful if you wish your secondary disk to be your primary data repository for ibays and users. Mounting your second disk to /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 (system vs data seperation), but in many cases you are just wasting the remaining space of your first disk.
An additional benefit is that SME processes will work seemlessly (see also Option Steps).


Alternative 2: Mounting a specific ibay or user

Similar to alternative 1, you can simply mount the disk for a specific iBay. If you need multiple iBays covered though it implies you have to create multiple partitions on the disk. The benefit like alternative one is simplicity of standard SME processes while limiting waste on your primary disk. The down side is inflexibility and waste on the secondary disk.

Alternative 3: Mounting and Symlinking

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 benefit is flexibility and efficient usage of the all disks. The down side is that you may have to make more modifications to ensure SME services and contribs work as expected (see also Optional Steps).

The following example shows you how to place the IBAYNAME ibay on the second disk using Alternative (3).

Create the necessary subdirectories on your second disk
mkdir -p /mnt/newdisk/ibays/IBAYNAME
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

Change ownership as in the original

The "-R" (optional) means recursive, subdirectorys will be included in the command.

chown -R originaluser:originalgroup /mnt/newdisk/ibays/IBAYNAME
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 
Copy the content to your new disk

a=archive option to preserve owner/group/permissions/links; i=interactive:

cp -ai /home/e-smith/files/ibays/IBAYNAME/* /mnt/newdisk/ibays/IBAYNAME
Check if all files have been copied correctly
diff -r /mnt/newdisk/ibays/IBAYNAME /home/e-smith/files/ibays/IBAYNAME 
Remove the original files
rm -rf /home/e-smith/files/ibays/IBAYNAME 

===== Create a symlink to the new location

ln -s /mnt/newdisk/ibays/IBAYNAME /home/e-smith/files/ibays/IBAYNAME 
Enable Wide Links for Samba (SME9)
config setprop smb WideLinks yes
expand-template /etc/samba/smb.conf
service smb restart
Test the new location
ls /home/e-smith/files/ibays/IBAYNAME

Optional Steps to Extend services

Quota

5.1 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.

Virus Scan

5.2 By default virus scan only scans /home/e-smith/files and does not follow symlinks. If you wish to have the additional hard drive to be scanned then you either need to mount it under this directory or follow the guidelines in http://wiki.contribs.org/SME_Server:Documentation:FAQ#Virus_Scanning.

Apache

5.3 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

Unknown

There may be other steps or modifications to services not yet encountered. If you find some, please document it here.

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.