====== Add an Additional Hard Drive to SME Server ======
:!: Here we utilize an additional disk drive to expand the storage of an existing SME Server. We demonstrate using '/home' as the mount point, however the choice of mount point is arbitrary.
:!: We also use this technique in virtualized server installations. For example, if you create a VM using a single large virtual disk, you may easily get to a point where you can't snapshot it due to lack of free disk space. Using this technique, you can temporarily disconnect the second large 'data' disk, take a snapshot, then reconnect the virtual disk when done. Just one of the reasons why you should use (expensive) shared storage for your virtualization projects...
===== Installation =====
Shut down the SME Server and physically install the new disk while turned off, then boot it back up.
Partition the drive with one large partition. Use a [[computing:storage:disk_partitioning|GPT partition table]] if the drive is over 2TB.
fdisk -l
fdisk /dev/sdx # where x is your new drive
:!: Use EXT4 for SME Server version 9.
Format the partition and mount it to a temporary location:
mkfs.ext3 -L Home /dev/sdx1 # where 'Home' is an arbitrary name
mount /dev/sdx1 /mnt/
Now we copy all the existing data from the mount point (/home in this case):
rsync -avr /home/* /mnt/
Then we edit the /etc/fstab file so the new drive is mounted where we want it after a reboot:
vim /etc/fstab
Append this line to the end of the file and save it:
LABEL=Home /home ext3 usrquota,grpquota 1 2
Now we dismount the new partition from the temporary mount point and remount it normally:
umount /mnt
mount -a
mount
You should see the new partition mounted as you wish.
Now we enable quotas on the new filesystem and we are done:
quotacheck -cug /home
quotaon -avug
===== Final Steps =====
Once we test the new configuration, including at least one reboot, we can take steps to recover the disk space occupied by the original /home data.
:!: If this is a clean SME Server install and you realize there is little space to be gained, stop right now.
Carefully:
df -h # just to check the current disk utilization
umount /home
mount # just to make sure the new partition is no longer mounted
du -sh /home/* # just to see what we are about to delete
rm -rf /home/*
mount -a
df -h # compare the results with the first command