Changes

From Amahi Wiki
Jump to: navigation, search
<center>{{MessageBox|
backgroundcolor = #faa|
image =Warning.png|
heading =WARNING|
message = This is recommended only for ''Advanced'' users, proceed with caution.}}</center>
<div style="border: 1px solid #A3B1BF; padding: .8em 1em; background-color: #E6F2FF; margin: 0px 1em;">
'''NOTE:''' The Amahi [https://www.amahi.org/apps/disk-wizard Disk Wizard] application (under Amahi 8 or greater '''ONLY'Development'') will provide provides this functionality via Amahi 7 capability from the Dashboard in the futureUI.
</div>
<br />
More The purpose of this tutorial is to make partitioning, formatting, and mounting hard drives can be added in your the Amahi HDA server simple for additional storage space. We'll detail how to add such hard drives, and how to put them those new to good useLinux.
In order to keep this process simple, it's important ''<big><u>Alternative Tutorial</u></big>'NOT''* ''Rookie'' - to connect additional hard drive(s) until the end of the [[Adding_Hard_Drives_101Adding_a_second_hard_drive_to_your_HDA#Preparation|Adding hard drives 101Preparation]] is a simple guide designed for users with little or no Linux experience.   '''NOTE:''' Recommend you choose <u>ONLY</u> one tutorial to followstep. Missing steps between them may corrupt your HDA.
=Disclaimer=
 
* [https://www.amahi.org Amahi] cannot be held responsible for any data breakage or destruction arising from the use or misuse of this script. We provide it as a service in good will. You accept this automatically if you use the script.
* GUID-partitioned drives (such as drives previously in a Mac or have GPT partition tables) are not supported in this tutorial.
* ''nano'' is used as the command-line text editor (refer to [http://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ beginners guide to nano] as needed).
 
=OS Detects Drive =
 
[[Open Terminal as root|In a Terminal, as root]], and type the following command:
 
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
ls -1 /dev/disk/by-id/ | egrep -v "part|scsi"
</div>
 
Look for the line that matches the hard drive you added.
 
IDE and SATA hard drives will start with '''ata-''' and USB hard drives will start with '''usb-'''.<br/>
Look for your hard drive model and serial number.
Example* [http://en.wikipedia.org/wiki/GUID_Partition_Table GUID-partitioned] hard drives (such as those previously used in a Mac or have GPT partition tables) are not supported in this tutorial.
<div style="border: 1px solid #A3B1BF; padding* [http: //en.wikipedia.5em 1em; color: #000; backgroundorg/wiki/GNU_nano nano] is used as the command-colorline text editor (refer to [http: #E6F2FF; margin: 3px 3px 1em 3px;"> [gb@hda ~]$ ls -1 /dev/diskwww.howtogeek.com/howto/by-id42980/ | egrep -v "part|scsi" atathe-Hitachi_HDS722020ALA330_JK1131YAGDU37V atabeginners-ST31000528AS_6VP08W65 ataguide-ST3750640A_3QD0LJN8 atato-ST3750640A_5QD27A57 atanano-WDC_WD10EADSthe-00L5B1_WDlinux-WCAU4C700358 usbcommand-ST310003_33AS_9E1CA6FFFFFF-0:0 usbline-ST375064_0A_2009031309E2text-0:0<editor/div>beginners guide to nano] as needed).
=Prerequisites=
[[Open Terminal as root|In a Terminal, as root]], verify disk tools are installed by executing:<br />
Verify disk tools are installed by executing: * Fedora
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; text-align: left">
yum dnf -y install pmount fuse fuse-libs ntfs-3g util-linux-ng parted nano
</div>
* :'''NOTE:''' <code>yum</code> (deprecated) has been replaced with <code>dnf</code> as the package manager for Fedora 23 and greater.Ubuntu
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; text-align: left">
sudo apt-get -y install gparted
</div>
:'''NOTE:''' Drives Hard drives must be formatted as '''MBR''' not '''GUID/GPT''' for ''hda-diskmount '' to recognize the diskwork correctly.
=Partition and Format Hard DrivePreparation=[[Open_Terminal_as_root|In terminal as root]], execute the following to capture current hard drive configuration:<div style="border: 1px solid #A3B1BF; padding: .5em 1em; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"> ls -l /dev/disk/by-id/ > before.txt cat before.txt</div>
This step is optional, and should only be executed if you want to delete the content of your new hard drive, or if the hard drive has not yet been formatted:EXAMPLE: lrwxrwxrwx 1 root root 9 2010-02-18 03:24 ata-Hitachi_HDS722020ALA330_JK1131YAGDU37V -> ../../sda lrwxrwxrwx 1 root root 10 2010-02-18 03:24 ata-Hitachi_HDS722020ALA330_JK1131YAGDU37V-part1 -> ../../sda1
You should (unless you have a good reason not to) use GParted to partition Power ''OFF'' the HDA and format your install/connect any additional hard drive(s).<br/>Not having X installed would qualify as a good reason! In such cases, either use SSH X11 Forwarding (Google that if you'd like to use this), or [[Adding_a_second_hard_drive_to_your_HDA#Using_cfdisk|use cfdisk]] from a [[Open Terminal as root|Terminal, as root]].
You=Identify=Power 'll probably want to create a single partition, and format it as ''ext3ON''the HDA and collect data about the new hard drive configuration.<br/>Note that Windows can't read ext3 partitions Again, so if you want dual-boot Windows on your Amahi PC, or if you intend to connect save this hard drive to a Windows computer later, you should format as NTFS instead, and you should do that on Windows before you connect the drive in your HDA.<br/>Remember that using NTFS partitions on Linux will be slower that using ext3 partitions, so you should only use NTFS if you really need ittext file for reference.<br/>
To know what device (/dev/sdX) you need to partition and format, use the following command, in a [[Open Terminal as rootOpen_Terminal_as_root|Terminal, In a terminal as root]], execute the following to capture current hard drive configuration: <div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"> ls -l /dev/disk/by-id/> after.txt cat after.txt
</div>
Find the row corresponding to your hard drive, and look at the end of the line to identify the correct device to use. Example:<div style="borderEXAMPLE: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"><small> [gb@hda ~]$ ls -l /dev/disk/by-id/ total 0
lrwxrwxrwx 1 root root 9 2010-02-18 03:24 ata-Hitachi_HDS722020ALA330_JK1131YAGDU37V -> ../../sda
lrwxrwxrwx 1 root root 10 2010-02-18 03:24 ata-Hitachi_HDS722020ALA330_JK1131YAGDU37V-part1 -> ../../sda1
lrwxrwxrwx 1 root root 9 2010-02-18 03:24 ata-ST31000528AS_6VP08W65 -> ../../sdb
</small>
</div>
In the above example, :'''FYI:''' IDE/dev/sdb would be what I would select in GParted (or use on the cfdisk command). sda in my primary SATA hard drive, drives will start with '''ata-''' and sdb my second USB hard drivedrives will start with '''usb-'''.<br/>
==Using GParted (Ubuntu) =Partition/Format=From Compare the HDA desktop (or using VNC), [[Open Terminal as root]] difference between before.txt and type '''gparted''' after.txt to launch determine the GParted applicationnew hard drive(s) device name. This can be done automatically.
Select [[Open Terminal as root|In a Terminal, as root]], execute the device (following:<div style="border: 1px solid #A3B1BF; padding: .5em 1em; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"> diff before.txt after.txt</dev/sdX) that you found above.div>
In the above example, :EXAMPLE: lrwxrwxrwx 1 root root 9 2010-02-18 03:24 ata-ST31000528AS_6VP08W65 -> ../dev../sdb would be what I would select in GParted.
There At this point, partition and format the hard drive(s) if they are many easy new. For hard drive(s) that contain data to follow guides online on how to use GParted. You should Google for onebe preserved, skip to find one that seems clear to youthe [[Adding_a_second_hard_drive_to_your_HDA#Mount|Mount]] step.
Here==Command-line (Fedora)==To partition the hard drive(s), substitute sdX with hard drive device name, such as ''sdb''s a general introduction on [http://www.youtube.com/watch?v=vdWkdrnNGRg YouTube]. Just use ext3 or ext4 instead of fat32 in you follow that tutorial.
If you have [[Open Terminal as root|In a drive Terminal, as root]], execute the following:<blockquote> 2<div style="border: 1px solid #A3B1BF; padding: .5em 1em; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"> parted /dev/sdX</div></blockquote>Up to 2TB, at the ''(parted)'' prompt, enter:# mklabel msdos (answer ''yes'' if prompted)# mkpart primary 0 TB% 100%# quit<br />Greater than 2TB, at the ''(parted)'' prompt, there is an in-depth guide below enter:# mklabel gpt (that may be outdatedanswer ''yes'' if prompted)# mkpart primary 0% 100%# quit<br />Verify the new partition was created:<div style="border: 1px solid #A3B1BF; padding: . 5em 1em; background-color: #E6F2FF; margin: Instead, it is possible to use GParted with the following steps3px 3px 1em 3px;"> ls -l /dev/disk/by-id/</div>:EXAMPLE:* select the correct drive in the dropdown on the top right of GParted lrwxrwxrwx 1 root root 9 2010-02-18 03:24 ata-Hitachi_HDS722020ALA330_JK1131YAGDU37V -> ../../sda lrwxrwxrwx 1 root root 10 2010-02-18 03:24 ata-Hitachi_HDS722020ALA330_JK1131YAGDU37V-part1 -> ../../sda1* click Device lrwxrwxrwx 1 root root 9 2010-02-18 03:24 ata-ST31000528AS_6VP08W65 -> Create Partition Table../. ./sdb <span style="color:#FF0000"> Advanced '''lrwxrwxrwx 1 root root 9 2010-02-18 03:24 ata-ST31000528AS_6VP08W65-part1 -> (Choose ../../sdb1''gpt')* then create your partition as normally instructed** I use </ext4** add an appropriate labelspan>
The new partition is named sdX1 (i.e. sdb1 in <span style="color:#FF0000">'''RED'''</span>).
Format the partition, execute (can substitute ext3):<bblockquote>NOTE<div style="border:1px solid #A3B1BF; padding: .5em 1em; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"> mkfs.ext4 -j /dev/sdX1</div></bblockquote> GParted supports GUID-partitioned drives, however, these directions and script do not support it at the moment.
==Using cfdisk==From a Repeat the [[Open Terminal as rootAdding_a_second_hard_drive_to_your_HDA#Partition/Format|terminal, as rootPartition/Format]], type '''cfdisk /dev/sdX''' step for each hard drive to launch the cfdisk applicationbe partitioned and formatted.
If you have ==GParted (Ubuntu)==From the HDA desktop (or using VNC), [[Open_Terminal_as_root|In a GUID-partitioned drive, cfdisk will complain. GUID partitions are not supportedterminal as root]] and type '''gparted''' to launch the application.
Make sure to replace Here's a general introduction on [http:/dev/sdX with the actual device (egwww. youtube.com/dev/sdb) watch?v=vdWkdrnNGRg YouTube]. Just use ''ext3'' or ''ext4'' instead of ''fat32'' if you follow that you found abovetutorial.
If your For drives > 2.0 TB, following these steps:* Choose hard drive contains existing partitions, select them one by one at disk in the dropdown menu (top right)* Select Device > Create Partition Table... > Advanced > (using up/down arrow keys), then select the '''[ Delete ]'Choose 'gpt' action (using the left/right arrow keys), then hit ENTER.* Create partition
You should now only have Free Space listed at the top.<br/>
Select the '''[ New ]''' action, and accept the default (Primary, and size).
You should now have a single partition listed at the top, of type Linux.:<b>NOTE:<br/b>Select the ''' [ Write http://gparted.org GParted]''' actionsupports GUID-partitioned drives, however, then '''[ Quit ]'''the hda-mount script do not support currently.
Now that you partitioned your Repeat the [[Adding_a_second_hard_drive_to_your_HDA#Partition/Format|Partition/Format]] step for each hard drive, you need to format your newly created partitionbe partitioned and formatted.<br/>To format as EXT3, use this command:
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">Mount= mkfsMount the hard drive(s)/partition(s) for use in the HDA.ext3 -j /dev/sdX1</div>
Replace ext3 with ext4 in the above command :'''NOTE:''' If you prefer not to format your partition as EXT4 instead of EXT3use ''hda-diskmount'', refer to [[Adding_a_second_hard_drive_to_your_HDA#hda-diskmount|Troubleshooting ''hda-diskmount]].
'''/dev/sdX1''' in the above command refers to the partition your created in cfdisk.<br/>Go back in cfdisk, and check the ''Name'' column if you're unsure.<br/>If you see ''sdb1'' in the name column, you should use '''/dev/sdb1''' in the above command. ==Partition over 2.1TB==[[Partitions_Over_2.1_TB|Here is a work around]] for drives with partitions over 2.1TB like the new 3 & 4TB TB drives. =Mount Hard Drive= ==hda-diskmount script==A script is provided with Amahi that will look for unmounted partitions in your system, and mount any it finds. [[Open Terminal as root|In a Terminal, as root]], type execute the following command(it will create drive1, drive2, etc and mount the hard drive(s) automatically): <div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
hda-diskmount
</div>
Example:<div style="borderEXAMPLE: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; text-align: left;"><small> [root@hda ~]$ hda-diskmount
****************************************************************
Ignoring /dev/sda1 - already in /etc/fstab or mounted
You may want your system to mount it every time you boot.
To do so, add this line VERY CAREFULLY to /etc/fstab and reboot:
<strong style="color:blue">UUID=9d972abc547b073d-1639e591-44df4913-a60eb4fb-668618d40236 7c5084353979 /var/hda/files/drives/drive1 ext4 defaults 1 2</strong>
****************************************************************
All Linux, Windows and Mac partitions on non-removable disks have been mounted
</small>
</div>
 
Do '''not''' edit /etc/fstab just yet. What you'll need to add there will depend on how you want to use the extra storage. More about that below.<br/>
Just note down the information in bold (green, red and blue). We'll use them below.
 
Note about ext4 in the blue line above: that doesn't necessarily mean your partition is formatted as ext4. It means the ext4 driver will be used to mount your partition. Since that driver is backward compatible, it can be safely used to mount ext2, ext3 and ext4 partitions.
 
If you get something like ''Disk /dev/dm-0 doesn't contain a valid partition table'' or ''mount: unknown file system type 'lvm2pv''' its because you have LVM's that 'fdisk' can not recognize (or something similar). It's nothing to worry about if you get that when executing the hda-diskmount script.
 
:'''NOTE:''' If hda-diskmount does not recognize your new drive and you are trying to add a GPT partitioned 2+TB drive, you may need to edit your hda-diskmount script. You can a fix for this issue at this [https://forums.amahi.org/viewtopic.php?f=15&t=2326&p=11617 forum thread].
 
:Failure message to recognize GPT drive:
<blockquote><div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; text-align: left;">
<small>
[root@hda ~]$ hda-diskmount
****************************************************************
Ignoring /dev/sdf1 - already mounted
Ignoring /dev/sdf1 - already in /etc/fstab as UUID=b8c125e3-4199-4b56-a566-397fdd8bab8a
****************************************************************
No usable Linux, Windows or Mac partitions found on your disks.
</small>
</div></blockquote>
 
:How to fix /usr/sbin/hda-dismount
<blockquote><div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; text-align: left;">
<small>
# Now for the real work
drivesntfs=`fdisk -l 2> /dev/null | grep -i 'ntfs' | awk -F '/| ' '{print $3}'`
drivesfat=`fdisk -l 2> /dev/null | grep -i 'fat32' | awk -F '/| ' '{print $3}'`
driveshfs=`fdisk -l 2> /dev/null | grep -i 'HFS' | awk -F '/| ' '{print $3}'`
drivesext=`fdisk -l 2> /dev/null | <strong style="color:red">egrep -iw 'Linux|GPT'</strong> | egrep -v 'swap|LVM' | awk -F '/| ' '{print $3}'`
</small>
</div></blockquote>
 
If you have changed the order of your installed hard drives, hda-diskmount may return the following message:
 
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
Ignoring /dev/sda1 - already in /etc/fstab as /dev/sda1
This device appears to be commented out of your /etc/fstab. You will need to remove it from there for hda-diskmount to be able to mount it.
</div>
 
This might occur if you have made changes to the drive configuration order after you installed Amahi. If you want to stay with the reconfigured drive order, instructions on how to fix this are in [[Adding_a_second_hard_drive_to_your_HDA#Change_Disk_Mount_Order|Change Disk Mount Order]] section below.
 
==Test Hard Drive==
Optionally, you can test your new drive for bad blocks.<br/>
Note that this step can take a ''long'' time to complete! You'll probably want to start it in the evening, to have it completed in the morning.
 
To do so, [[Open Terminal as root|in a Terminal, as root]], type the following command. Replace <strong style="color:green">sdb1</strong> with the (green) value you received from hda-diskmount.
 
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
e2fsck -cn /dev/<strong style="color:green">sdb1</strong>
</div>
You'll receive a warning that says The line in <span style="WARNING!!! Running e2fsck on a mounted filesystem may cause SEVERE filesystem damage. Do you really want to continue (y/n)?color:#0000FF">'''BLUE'''<br/span>Answer is what you need to copy and add to the bottom of ''yes/etc/fstab''. The -cn option we This is '''REQUIRED'''re using can safely for the hard drive(s) to be used on permanently mounted filesystems.
=Use Hard Drive=There will be multiple lines for multiple hard drive(s) added. Ensure you copy and add '''ONLY''' those which were not present in the ''before.txt'' file.
You have a choice here on how to use your The new hard drive storage spacecan be used for [[Adding_a_second_hard_drive_to_your_HDA#All Shares|All Shares]], [[Adding_a_second_hard_drive_to_your_HDA#Some Shares|Some Shares]], or the [[Adding_a_second_hard_drive_to_your_HDA#Greyhole Storage Pool|Greyhole Storage Pool]]. We'll offer some examples Follow the guidance below based on desired usage for each hard drive.
==All sharesShares==Host '''ALL''' shares on the new hard drive.
If you want Move all your the shares data to be on your the new hard drive, herereplacing path in 's how to do that''<span style="color: red;">RED</span>''' with the path from the ''hda-diskmount'' output line in <span style="color:#0000FF">'''BLUE'''</span>.<br />
First, you'll want to move all you previous shares data, if any, into your new drive.<br/>You only need to do this next command if you have data that you care about in the /var/hda/files/* folders.<br/>[[Open Terminal as root|In a Terminal, as root]], type execute the following command. Replace the path in red with the path you received when you ran hda-diskmount.:
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
mv /var/hda/files/* <strong style="color:red">/var/hda/files/drives/drive1/</strong>
</div>
You'll get a warning about "cannot move `/var/hda/files/drives' to a subdirectory of itself"; that is fine, ignore that.
Next, you:'''NOTE:''' There may be a '''WARNING''' that can be ignored indicating ''ll need to unmount your new hard drive, and remount it as /var/hda/files/drives cannot be moved to a subdirectory of itself''.
Unmount the new hard drive:
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
umount /var/hda/files/drives/drive1/
</div>
Mount the new hard drive permanently as ''/var/hda/files'' by editing ''/etc/fstab'':<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
nano /etc/fstab
</div>
Add the line to ''/etc/fstab'' provided in the ''hda-diskmount'' output in '''<span style="color: blue;">BLUE</span>''' and change the second value (path) to ''/var/hda/files''.
In nano, you'll need to add a new line at the bottom. Take the line that :EXAMPLE hda-diskmount gave you (the blue one), and change the second value output (the pathOriginal).<br/>Replace the second value with '''/var/hda/files'''. hda-diskmount gave me:<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"> <span style="color:blue;">UUID=9d972abc547b073d-1639e591-44df4913-a60eb4fb-668618d40236 7c5084353979 <strong>/var/hda/files/drives/drive1</strong> ext4 defaults 1 2</span></div> So I should add this instead:<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; backgroundEXAMPLE hda-colordiskmount output (Modified): #E6F2FF; margin: 3px 3px 1em 3px;"> UUID=9d972abc547b073d-1639e591-44df4913-a60eb4fb-668618d40236 7c5084353979 <strong>/var/hda/files</strong> ext4 defaults 1 2</div> Make sure you do '''not''' change anything else from the blue line you received from hda-diskmount.<br/>It might not be the same thing as the above example; you need to use the values you've received. Save and exit nano (CTRL-X, Y, ENTER), and try your new mount:
:EXAMPLE /etc/fstab:
#
# /etc/fstab
# Created by anaconda on Sat Nov 9 01:46:39 2013
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=1ebbf241-528c-465e-889f-acc15400dd8c / ext4 defaults 1 1
UUID=087b15a5-c3ca-4615-b6ee-bf5f399a803e /boot ext4 defaults 1 2
UUID=75346b8e-b162-458c-b0e9-a8d48ec2bc82 swap swap defaults 0 0
UUID=ad85eeb9-18f0-4b85-9bfa-b88a5d1489b3 swap swap defaults 0 0
<span style="color:#0000FF">'''UUID=547b073d-e591-4913-b4fb-7c5084353979 /var/hda/files ext4 defaults 1 2'''</span>
Finally, execute the following:
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
mount -a
ls /var/hda/files/
</div>
 That The last command should show you will display contents of the content of you new hard drive. That's it. All your shares in /var/hda/files are now located on your the new hard drive.
==Some Shares==
Host '''SOME''' shares on the new hard drive.
If you want only Move some of your shares data to be on your the new hard drive, hereby executing the following command (replace path in '''<span style="color: red;">RED</span>''' with the path from the ''hda-diskmount'' output line in <span style="color:#0000FF">'''BLUE'''s how </span>; sharename will be the share to do thatmove to the new drive).<br />
First, you'll want to move your previous shares data, if any, into your new drive.<br/>You only need to do this next command if you have data that you care about in the /var/hda/files/* folders (that you want on the new drive).<br/>[[Open Terminal as root|In a Terminal, as root]], type execute the following command. Replace the path in red with the path you received when you ran hda-diskmount. Replace '''something''' with the name of the share you want to have on your new drive (the share should already exist).:
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
mv /var/hda/files/<strong>somethingsharename</strong> <strong style="color:red">/var/hda/files/drives/drive1/</strong>
</div>
Repeat the process with every share to be moved to the new drive.
Repeat with every share you want on your Unmount the new hard drive. Next, you'll need to make the mount permanent:
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
umount /var/hda/files/drives/drive1<br/> nano /etc/fstab
</div>
In nano, youMount the new hard drive permanently by editing ''ll need to add a new line at the bottom. Take the line that hda-diskmount gave you, and insert that.<br/> So, following previous examples, I should add thisetc/fstab'': <div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; text-align: left;"> <span style="color: blue;">UUID=9d972abc-1639-44df-a60e-668618d40236 nano /varetc/hda/files/drives/drive1 ext4 defaults 1 2</span>fstab
</div>
Add the line to ''/etc/fstab'' provided in the ''hda-diskmount'' output in '''<span style="color: blue;">BLUE</span>'''.
:EXAMPLE /etc/fstab:
#
# /etc/fstab
# Created by anaconda on Sat Nov 9 01:46:39 2013
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=1ebbf241-528c-465e-889f-acc15400dd8c / ext4 defaults 1 1
UUID=087b15a5-c3ca-4615-b6ee-bf5f399a803e /boot ext4 defaults 1 2
UUID=75346b8e-b162-458c-b0e9-a8d48ec2bc82 swap swap defaults 0 0
UUID=ad85eeb9-18f0-4b85-9bfa-b88a5d1489b3 swap swap defaults 0 0
<span style="color:#0000FF">'''UUID=547b073d-e591-4913-b4fb-7c5084353979 /var/hda/files/drives/drive1 ext4 defaults 1 2'''</span>
Verify the hard drive(s)/partition(s) configuration is correct in ''/etc/fstab''.
Save and exit nano (CTRL-XNext, Y, ENTER), and try your new mountexecute the following
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
mount -a
ls /var/hda/files/drives/drive1
</div>
The last command will display contents of the new hard drive. All shares are now located on the new hard drive.
That last command should show you the content of you new hard drive. Now, you need to update the location of the moved shares within Amahi. Go to your '''<strongu>Amahi HDA DashboardUpdate</strong>, click on <strongu>Setup<br /strong>, then <strong>Shares</strong>. ''' Click on one The location of the shares each share that you have was movedto the new hard drive will need updated. This will open a panel revealing Select ''Setup'' followed by the ''Shares'' section. Expand each share settings. Click on the location (the bit that is shown with a dotted underline) was moved individually and it will change to an edit box. Update the location to match the new share location(path) accordingly.
For example, the original movies location was: <span style="color:red">/var/hda/files/movies</span><br/>The but the new location might be: <span style="color:blue">/var/hda/files/drives/drive1/movies</span>.
Repeat for any other shares that you have movedto the new hard drive. Check that you can access Verify these shares are accessible from another machine within your network.
Finally, if you have '''NOTE:''' If any services that depend on the location of these sharesa moved share, make sure ensure they are configured to use the new share location. For example, if you have a [https://www.amahi.org/apps/dlna DLNA server ] is installed, check its the configuration files file to make sure that verify it can find any media folders that have been movedthe new share location. Secondly, <em>check validate that that all such services start correctly and behave as expected</em>. If the service doesn't start, it may be that it is testing 's looking for a specific share location during the service startup. Check the startup files in <strong>/etc/init.d</strong> to see if this is the case. That's it. Your share(s) are now on your new hard drivestart up.
==Greyhole Storage Pool==
Use new hard drive for [[Storage_pooling|Greyhole Storage Pool]].
If you want to add your new hard drive to your Greyhole storage pool, here's how to do that. First, you'll need to make the mount permanent. [[Open Terminal as root|In a Terminal, as root]], type mount the following commandnew hard drive permanently by editing ''/etc/fstab'': <div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"> umount /var/hda/files/drives/drive1
nano /etc/fstab
</div>
Add the line to ''/etc/fstab'' provided in the ''hda-diskmount'' output in '''<span style="color: blue;">BLUE</span>'''.
:EXAMPLE /etc/fstab:
#
# /etc/fstab
# Created by anaconda on Sat Nov 9 01:46:39 2013
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=1ebbf241-528c-465e-889f-acc15400dd8c / ext4 defaults 1 1
UUID=087b15a5-c3ca-4615-b6ee-bf5f399a803e /boot ext4 defaults 1 2
UUID=75346b8e-b162-458c-b0e9-a8d48ec2bc82 swap swap defaults 0 0
UUID=ad85eeb9-18f0-4b85-9bfa-b88a5d1489b3 swap swap defaults 0 0
<span style="color:#0000FF">'''UUID=547b073d-e591-4913-b4fb-7c5084353979 /var/hda/files/drives/drive1 ext4 defaults 1 2'''</span>
Verify the hard drive(s)/partition(s) configuration is correct in ''/etc/fstab''.
In nano, you'll need Refer to add a new line at the bottom. Take [[Greyhole#Amahi 6|Greyhole (Amahi 6)]] for Ubuntu or [[Greyhole#Amahi 7|Greyhole (Amahi 7)]] for Fedora to configure the line that hda-diskmount gave you, and insert that[[Storage_pooling|Greyhole Storage Pool]].<br/>
So, following previous examples, I should add this:=Verify/Test=Verify the hard drive/partition is mounted.
[[Open Terminal as root|In a Terminal, as root]], execute the following:<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; text-align: left;"> <span style="color: blue;">UUID=9d972abc-1639-44df-a60edf -668618d40236 /var/hda/files/drives/drive1 ext4 defaults 1 2</span>h
</div>
Save and exit nano (CTRL-X, Y, ENTER), and try your new mount:EXAMPLE: Filesystem Size Used Avail Use% Mounted on /dev/sda5 16G 4.3G 11G 30% / devtmpfs 493M 0 493M 0% /dev tmpfs 498M 84K 498M 1% /dev/shm tmpfs 498M 364K 498M 1% /run tmpfs 498M 0 498M 0% /sys/fs/cgroup tmpfs 498M 1.1M 497M 1% /tmp /dev/sda1 190M 75M 102M 43% /boot /dev/sdb1 917G 398G 473G 46% /var/hda/files/drives/drive1
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"> The hard drive(s) and the mount -a</div> '''<u>Ubuntu</u>'''<br />Finally, you'll need to configure Greyhole to select your new partition. To configure Greyhole, Advanced Settings must point (path) should be enabled under Settings. In the Storage Pool page of your Amahi dashboard, you'll see a list of mounted partitions, with checkboxes next to listed for each, allowing you to include those partitions in your storage poolhard drive addedYou should now have a new row in there If not, referring then further investigation will be needed to /var/hda/files/drives/drive1. Select it (click determine the checkbox)problemThat's it. Your new hard drive just increased your Greyhole storage pool capacity. '''<u>Fedora 19</u>'''<br />Refer to [[Amahi_7_Create_Manual_Greyhole_Setup|Amah 7 Greyhole Setup]] for guidance or use the Amahi [https://www.amahi.org/apps/greyhole-ui Greyhole UI] application.
=Tips=
==Change Disk Mount Order==The following guide will outline how to manually order your disks hard drives and mount drives them automatically on boot.
1. First[[Open Terminal as root|In a Terminal, as root]], get executing the following command to obtain the UUID for each hard drive by opening a terminal and entering command :<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"> blkid</div>:EXAMPLE: /dev/sda1: LABEL="Seagate-Alpha2TB" UUID="55d9333f-d801-425a-b2af-d65c5966d56f" TYPE="ext4" /dev/sdb1: LABEL="Seagate-Beta2TB" UUID="5bd5498f-30c1-4780-948e-ca46656507d2" TYPE="ext4" /dev/sdc1: LABEL="WD-Charlie2TB" UUID="a7337504-376a-4d36-9f7a-1a24c0f55fbd" TYPE="ext4" /dev/sdd1: LABEL="WD-Delta2TB" UUID="8d881dcb-8de3-4621-b9bd-00025196868a" TYPE="ext4" /dev/sde1: LABEL="root" UUID="4d6f8004-d190-4234-a03b-b68de988abf0" TYPE="ext4" /dev/sde3: LABEL="home" UUID="d0531fa1-9311-4d53-b838-f35898adbd98" TYPE="ext4" /dev/sde5: LABEL="swap" UUID="3c39206c-ba60-47ff-a1fe-f5821b2ab543" TYPE="swap"
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"><pre>gstreet@gstreet-MicroServer:~$ sudo blkid[sudo] password for gstreet:/dev/In this case, there are four data drives (sda1: LABEL="Seagate-Alpha2TB" UUID="55d9333f-d801-425a-b2af-d65c5966d56f" TYPE="ext4" /dev/, sdb1: LABEL="Seagate-Beta2TB" UUID="5bd5498f-30c1-4780-948e-ca46656507d2" TYPE="ext4" /dev/, sdc1: LABEL="WD-Charlie2TB" UUID="a7337504-376a-4d36-9f7a-1a24c0f55fbd" TYPE="ext4" /dev/, sdd1: LABEL="WD-Delta2TB" UUID="8d881dcb-8de3-4621-b9bd-00025196868a" TYPE="ext4" /dev/sde1: LABEL="root" UUID="4d6f8004-d190-4234-a03b-b68de988abf0" TYPE="ext4" /dev/sde3: LABEL="home" UUID="d0531fa1-9311-4d53-b838-f35898adbd98" TYPE="ext4" /dev/sde5: LABEL="swap" UUID="3c39206c-ba60-47ff-a1fe-f5821b2ab543" TYPE="swap"</pre></div>) and the Operating system assigned to a fifth drive, sde.
In this case, the user has four data drives (sda1, sdb1, sdc1, sdd1) and the Operating system assigned to a fifth drive, sde. Take note of the UUID's for each drive. Easiest to cut and paste UUID's straight from the terminal - no typo's! 2. Then edit /etc/fstab to mount each drive - for novices, easiest to do this using a graphical editor. You might consider first making a copy called fstab.bak (use the "save as" command, close file and then gedit the original fstab again) so that you can recover the original fstab file if you make mistakes.
Edit ''/etc/fstab'' to mount each drive:
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
sudo nano /etc/fstab
</div>
Then '''very carefully''' add the following line for each disk into the end of the fstab file. Ensure correct UUID, hard drive number and hard drive file system (ext4 in this case) are added.
3. :EXAMPLE: Then '''very carefully''' add the following line for each disk into the end of the fstab file. Make sure you paste in the right UUID, drive number and drive file system (=55d9333f-d801-425a-b2af-d65c5966d56f /var/hda/files/drives/drive1 ext4 in this case). defaults 1 2
<div style="border: 1px solid #A3B1BF; padding: It should look something like the following when lines are added for each of the five drives in this example.5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">UUID=55d9333f-d801-425a-b2af-d65c5966d56f /var/hda/files/drives/drive1 ext4 defaults 1 2</div>
It should look something like the following when lines are added for each of the five drives in this example. Note lines beginning with # are comments where the remainder of the line is ignored)  <div style="border: 1px solid #A3B1BF; paddingEXAMPLE: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
# Mounting Greyhole Drives for Drive Pool.
#
#
#
 
:'''NOTE:''' Lines beginning with # are comments where the remainder of the line is ignored
 
Verify there are no issues by executing the following:
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
mount -a
</div>
If there are errors,most likely a line was not added properly. If this is not corrected, the machine may not boot and hang trying to mount the hard drives!
 
Once there are no errors, reboot machine:
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
reboot
</div>
Verify the hard drives have successfully mounted in the '''HDA Dashboard'''.
 
If all drives mounted successfully, it should look something like this (Ubuntu):
 
:EXAMPLE:
[[File:Gstreet_greyhole_pool.png|options|caption]]
 
==Bad Blocks==
Optionally, you can test your new drive for bad blocks.<br/>
Save :'''NOTE:''' This can take a ''long'' time to complete! Recommend starting it in the file and quit evening so it will be completed the editornext day. To see if that will work at boot time [[Open Terminal as root|In a Terminal, as root]], try execute following command (replace '''sdb1''' withthe (<strong style="color:blue">BLUE</strong>) value you received from ''hda-diskmount''):
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
mount e2fsck -acn /dev/'''sdb1'''
</div>
You'll receive a message stating '''WARNING!!!''' ''Running e2fsck on a mounted filesystem may cause SEVERE filesystem damage. Do you really want to continue (y/n)?''<br/>
 
Answer ''yes''. The <code>-cn</code> option we're using can safely be used on mounted file systems.
==Spin Down Hard Drives==
 
Low power is a good thing to have in servers. If you do not use your server very often, you may want to force the hard drives to spin down faster than the default. Here is how.
 
First ensure ''hdparm'' package is installed:
sudo dnf install hdparm
 
To force to spin down after 10 minutes of being idle, add these lines to <code>/etc/rc.local</code>:
<pre>
# power drives down after 10 minutes idle
/sbin/hdparm -S120 /dev/sda
/sbin/hdparm -S120 /dev/sdb
...
</pre>
 
Most drives will power down on their own without doing this.
 
Once stopped, the drive may take as long as 30 seconds to respond to a subsequent disk access, though most drives are much quicker. The encoding of the -S timeout value is somewhat peculiar. A value of zero means "timeouts are disabled": the device will not automatically enter standby mode. Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes. Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours. A value of 252 signifies a timeout of 21 minutes. A value of 253 sets a vendor-defined timeout period between 8 and 12 hours, and the value 254 is reserved. 255 is interpreted as 21 minutes plus 15 seconds. Note that some older drives may have very different interpretations of these values.
 
It may make the system run cooler and power efficient (especially on a Home Server you are rarely using all of the pool drives at the same time).
 
=Troubleshooting=
==hda-diskmount==
If ''hda-diskmount'' does not mount the hard drive or you prefer to do it manually, complete the following steps:
 
Create the mount point (choose one '''NOT''' in use) [[Open Terminal as root|in a Terminal, as root]] by executing the following:
<blockquote><div style="border: 1px solid #A3B1BF; padding: .5em 1em; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
mkdir -p /var/hda/files/drives/drive1
</div></blockquote>
Identify the hard drive to mount and copy the UUID from the output that corresponds to the hard drive (i.e. sdb)
<blockquote><div style="border: 1px solid #A3B1BF; padding: .5em 1em; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
ls -l /dev/disk/by-uuid/
</div></blockquote>
 
:EXAMPLE:
lrwxrwxrwx 1 root root 10 Dec 29 18:10 1b8597e0-5d95-4474-b093-53099c8c81c9 -> ../../sda1
lrwxrwxrwx 1 root root 10 Dec 29 18:10 1c161033-c695-4291-aba1-257d3987edf7 -> ../../dm-0
lrwxrwxrwx 1 root root 10 Dec 29 18:10 b7017251-cb54-438b-92a3-781537c565e6 -> ../../sdb
lrwxrwxrwx 1 root root 10 Dec 29 18:10 c1fe62b3-41dc-4a67-8a6b-09f90b7893ba -> ../../dm-1
lrwxrwxrwx 1 root root 10 Dec 29 18:10 e0f5a9bd-f52b-431e-89af-61da70659bdd -> ../../dm-2
lrwxrwxrwx 1 root root 10 Dec 29 18:10 <span style="color:#FF0000">'''547b073d-e591-4913-b4fb-7c5084353979'''</span> -> ../../sdb1
 
:The UUID for sdX1 (i.e. sdb1 is <span style="color:#FF0000">'''RED'''</span>).
Add the following to the end of ''/etc/fstab'', replacing the UUID as captured in the previous step
<blockquote><div style="border: 1px solid #A3B1BF; padding: .5em 1em; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
nano /etc/fstab
</div></blockquote>
:EXAMPLE:
#
# /etc/fstab
# Created by anaconda on Sat Nov 9 01:46:39 2013
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=1ebbf241-528c-465e-889f-acc15400dd8c / ext4 defaults 1 1
UUID=087b15a5-c3ca-4615-b6ee-bf5f399a803e /boot ext4 defaults 1 2
UUID=75346b8e-b162-458c-b0e9-a8d48ec2bc82 swap swap defaults 0 0
UUID=ad85eeb9-18f0-4b85-9bfa-b88a5d1489b3 swap swap defaults 0 0
<span style="color:#0000FF">'''UUID=547b073d-e591-4913-b4fb-7c5084353979 /var/hda/files/drives/drive1 ext4 defaults 1 2'''</span>
If that gives you errors, there is a good chance that this line was not added properly and your machine may not reboot and get stuck mounting the :The new entry will be mounted as ''/var/hda/files/drives!/drive1'' (i.e. sdb1 in '''<span style="color:#0000FF">BLUE</span>''')
Note that Mount the hdahard drive<blockquote><div style="border: 1px solid #A3B1BF; padding: .5em 1em; background-diskmount command had already added lines to color: #E6F2FF; margin: 3px 3px 1em 3px;"> mount my OS drive which had two partitions (root or -a</div></blockquote>:If all goes well, and home)there should not be any output. Save file If there are errors, stop and closediagnose the problem.
4. Save file and reboot machineAccomplish [[Adding_Hard_Drives_101#Verify/Test|Verify/Test]] step to ensure the hard drive is properly mounted. <br />
5Repeat this process for each hard drive to be mounted. Check that drives have successfully mounted in Amahi hda (Setup - Shares - Storage Pool)
In ==Partitions > 2.1TB==If by following this case, if all tutorial you are unable to mount hard drives mounted successfullywith partitions > 2.1TB, it should look like (Ubuntu):refer to the [[Partitions_Over_2.1_TB|Partitions over 2.1TB]] guidance.
=Help=If you need assistance, please post in the [https://forums.amahi.org Amahi Forums] or receive '''LIVE''' support on the [Filehttp:Gstreet_greyhole_pool//talk.png|options|caption]amahi.org Amahi IRC channel].
12,424

edits