Difference between revisions of "Changing Greyhole Mount Points"

From Amahi Wiki
Jump to: navigation, search
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==DISCLAIMER==
 
==DISCLAIMER==
This is what worked for me.  This may not work for you.  I recommend testing this ONLY if all of your data is backed up and recoverable outside of greyhole.
+
This is what worked for me.  This may not work for you.  I recommend testing this '''ONLY''' if all of your data is backed up and recoverable outside of Greyhole. Amahi cannot be held responsible if you lose all of your data attempting this.
We cannot be held responsible if you lose all of your data attempting this.  YMMV.
 
  
 
==How To Do It==
 
==How To Do It==
Line 19: Line 18:
  
 
====Create your new mount points====
 
====Create your new mount points====
{{code|sudo mkdir /var/hda/files/drives/bay2
+
mkdir /var/hda/files/drives/bay2
sudo mkdir /var/hda/files/drives/bay3
+
mkdir /var/hda/files/drives/bay3
sudo mkdir /var/hda/files/drives/bay4}}
+
mkdir /var/hda/files/drives/bay4
  
 
====Backup fstab====
 
====Backup fstab====
{{code|sudo cp /etc/fstab /etc/fstab.bak.2013.05.01}}
+
cp /etc/fstab /etc/fstab.bak.2013.05.01
 
You could just use fstab.bak, but I prefer to have my backups dated.
 
You could just use fstab.bak, but I prefer to have my backups dated.
 +
 
====Edit fstab====
 
====Edit fstab====
{{code|sudo nano /etc/fstab}}
+
nano /etc/fstab
 +
 
 
Look for your mount points and change them to the new folders you want to mount the data drives in.  <br />
 
Look for your mount points and change them to the new folders you want to mount the data drives in.  <br />
 +
 
If you haven't commented your fstab file, now's a good time for that.  Here's mine:
 
If you haven't commented your fstab file, now's a good time for that.  Here's mine:
 
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
 
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
Line 42: Line 44:
 
UUID=489e45f4-16ef-4a65-47ba-456e465a4b4c /var/hda/files/drives/bay4 ext4 noatime,data=writeback,nofail 1      2</nowiki>
 
UUID=489e45f4-16ef-4a65-47ba-456e465a4b4c /var/hda/files/drives/bay4 ext4 noatime,data=writeback,nofail 1      2</nowiki>
 
</div>
 
</div>
 +
 
====Remount the Drives====
 
====Remount the Drives====
{{code|sudo mount -a}}
+
mount -a
 
If there are any errors from this command, FIX THEM before you reboot.<br />
 
If there are any errors from this command, FIX THEM before you reboot.<br />
 +
 
Check the drives have mounted in the new mount points with:
 
Check the drives have mounted in the new mount points with:
{{code|mount}}
+
mount
  
 
===Reboot===
 
===Reboot===
 
From the HDA dashboard:  <br />
 
From the HDA dashboard:  <br />
Setup > Settings > Settings > click the reboot button.
+
* Setup > Settings > Settings > click the reboot button.
  
 
===Fix Greyhole===
 
===Fix Greyhole===
 
Some of these steps may not be necessary, but this is the path I took that got me results. <br />
 
Some of these steps may not be necessary, but this is the path I took that got me results. <br />
 +
 
Several of these steps can take a LONG time depending on how many files are on the drives you have remounted.  <br />
 
Several of these steps can take a LONG time depending on how many files are on the drives you have remounted.  <br />
 +
 
I recommend keeping an eye on greyhole to ensure it is doing what it should.
 
I recommend keeping an eye on greyhole to ensure it is doing what it should.
{{code|tail -f /var/log/greyhole.log​}}
+
tail -f /var/log/greyhole.log​
 
Press Ctrl+Z to pause this task.  Note the number in brackets or use the "jobs" command to see where it is queued. <br />
 
Press Ctrl+Z to pause this task.  Note the number in brackets or use the "jobs" command to see where it is queued. <br />
 +
 
Bring it to the foreground to check it at anytime with:
 
Bring it to the foreground to check it at anytime with:
{{code|fg 1}}
+
fg 1
 
1 being the first task in the background.
 
1 being the first task in the background.
 
====Restart Greyhole====
 
====Restart Greyhole====
From the HDA: <br />
+
From the HDA dashboard: <br />
Setup > Settings > Servers > Greyhole <br />
+
* Setup > Settings > Servers > Greyhole <br />
Ensure Greyhole is started and the watchdog option is checked.
+
* Ensure Greyhole is started and the watchdog option is checked.
 
====Add Drives to Greyhole====
 
====Add Drives to Greyhole====
From the HDA:<br / >
+
From the HDA dashboard:<br / >
Shares > Storage Pool > Check the drives (should be listed under the new mount points)<br / >
+
* Shares > Storage Pool > Check the drives (should be listed under the new mount points)<br / >
If your old mount points are still checked, uncheck them.
+
* If your old mount points are still checked, uncheck them.
 
====Remove invalid symlinks====
 
====Remove invalid symlinks====
{{code|sudo greyhole --fix-symlinks}}
+
greyhole --fix-symlinks
 
At this point all of your files that were located on a drive whose mount point was changed will disappear from your shares. <br />
 
At this point all of your files that were located on a drive whose mount point was changed will disappear from your shares. <br />
 +
 
This is because the symlinks were no longer valid and greyhole is still looking for them in their old folders.<br />
 
This is because the symlinks were no longer valid and greyhole is still looking for them in their old folders.<br />
 +
 
Bring up the log and watch it work away at removing all those symlinks.<br />
 
Bring up the log and watch it work away at removing all those symlinks.<br />
 
Wait until it has completed.
 
Wait until it has completed.
 +
 
====Delete Orphaned Metadata====
 
====Delete Orphaned Metadata====
{{code|sudo greyhole --fsck --delete-orphaned-metadata}}
+
greyhole --fsck --delete-orphaned-metadata
 
This will remove any metadata still stored for those missing files.  It is necessary for the next step to work.
 
This will remove any metadata still stored for those missing files.  It is necessary for the next step to work.
 
====Find the Orphaned Files====
 
====Find the Orphaned Files====
{{code|sudo greyhole --fsck --find-orphaned-files --dir<nowiki>=</nowiki>/var/hda/files/drives/bay2/gh}}
+
greyhole --fsck --find-orphaned-files --dir=/var/hda/files/drives/bay2/gh
 
This will run an fsck on the drive mounted in /var/hda/files/drives/bay2 and look for files without metadata.  <br />
 
This will run an fsck on the drive mounted in /var/hda/files/drives/bay2 and look for files without metadata.  <br />
 +
 
Repeat this for each drive you have changed the mount points for.<br />
 
Repeat this for each drive you have changed the mount points for.<br />
 
At this point, your files should begin reappearing in your shares.  If not, try running another fsck:
 
At this point, your files should begin reappearing in your shares.  If not, try running another fsck:
{{code|sudo greyhole --fix-symlinks
+
greyhole --fix-symlinks
sudo greyhole --fsck}}
+
greyhole --fsck

Latest revision as of 03:36, 5 April 2014

DISCLAIMER

This is what worked for me. This may not work for you. I recommend testing this ONLY if all of your data is backed up and recoverable outside of Greyhole. Amahi cannot be held responsible if you lose all of your data attempting this.

How To Do It

Stop Greyhole

In the HDA dashbaord:

  • Setup > Settings > Servers > Greyhole
  • Uncheck Watchdog and then press the Stop It button.


NOTE: All commands must be done as root user (Fedora) or preceded with sudo (Ubuntu).

Change Mount Points

Unmount your data drives

umount -a

Verify this completed by checking your data drives are not mounted

mount

Create your new mount points

mkdir /var/hda/files/drives/bay2
mkdir /var/hda/files/drives/bay3
mkdir /var/hda/files/drives/bay4

Backup fstab

cp /etc/fstab /etc/fstab.bak.2013.05.01

You could just use fstab.bak, but I prefer to have my backups dated.

Edit fstab

nano /etc/fstab

Look for your mount points and change them to the new folders you want to mount the data drives in.

If you haven't commented your fstab file, now's a good time for that. Here's mine:

# <file system>                           <mount point>             <type>  <options>                  <dump>  <pass>
proc                                      /proc                      proc    nodev,noexec,nosuid        0       0
# / was on /dev/sda1 during installation
UUID=45e7d257-a7cc-4a36-9dd8-20929ad54b0e /                          ext4    errors=remount-ro          0       1
# swap was on /dev/sda5 during installation
UUID=c4d9f59e-1d7b-47ba-a956-e0e8a231bc10 none                       swap    sw                         0       0
########################################## Mount 4TB Seagate drive in Bay 2 from bottom ######################
UUID=05c05271-7309-4244-9dd8-8c2d6c5aeacd /var/hda/files/drives/bay2 ext4 noatime,data=writeback,nofail 1       2
########################################## Mount 2TB Seagate drive in Bay 3 from Bottom ######################
UUID=489e45f4-16ef-4a65-47ba-456e465a4b4c /var/hda/files/drives/bay4 ext4 noatime,data=writeback,nofail 1       2

Remount the Drives

mount -a

If there are any errors from this command, FIX THEM before you reboot.

Check the drives have mounted in the new mount points with:

mount

Reboot

From the HDA dashboard:

  • Setup > Settings > Settings > click the reboot button.

Fix Greyhole

Some of these steps may not be necessary, but this is the path I took that got me results.

Several of these steps can take a LONG time depending on how many files are on the drives you have remounted.

I recommend keeping an eye on greyhole to ensure it is doing what it should.

tail -f /var/log/greyhole.log​

Press Ctrl+Z to pause this task. Note the number in brackets or use the "jobs" command to see where it is queued.

Bring it to the foreground to check it at anytime with:

fg 1

1 being the first task in the background.

Restart Greyhole

From the HDA dashboard:

  • Setup > Settings > Servers > Greyhole
  • Ensure Greyhole is started and the watchdog option is checked.

Add Drives to Greyhole

From the HDA dashboard:

  • Shares > Storage Pool > Check the drives (should be listed under the new mount points)
  • If your old mount points are still checked, uncheck them.

Remove invalid symlinks

greyhole --fix-symlinks

At this point all of your files that were located on a drive whose mount point was changed will disappear from your shares.

This is because the symlinks were no longer valid and greyhole is still looking for them in their old folders.

Bring up the log and watch it work away at removing all those symlinks.
Wait until it has completed.

Delete Orphaned Metadata

greyhole --fsck --delete-orphaned-metadata

This will remove any metadata still stored for those missing files. It is necessary for the next step to work.

Find the Orphaned Files

greyhole --fsck --find-orphaned-files --dir=/var/hda/files/drives/bay2/gh

This will run an fsck on the drive mounted in /var/hda/files/drives/bay2 and look for files without metadata.

Repeat this for each drive you have changed the mount points for.
At this point, your files should begin reappearing in your shares. If not, try running another fsck:

greyhole --fix-symlinks
greyhole --fsck