Koozali.org: home of the SME Server

Affa to USB

Offline Brave Dave

  • *
  • 185
  • +0/-0
Affa to USB
« on: October 22, 2012, 02:13:27 AM »
With Affa

I'm using it to daily backup to a USB and rotate the USB. I'm using a couple of the Western Digital Drives 500Gb Drives

The problem here is that when they are swapped the system doesn't recognize them as the same, labeling 1 sdd, the other sdc - so the mount commands aren't identical, i.e. on one disk it is
Quote
mount /mnt/sdc1 /mnt/affadevice
on the other
Quote
mount /mnt/sdd1 /mnt/affadevice

I assign and use a label in /etc/fstab

But affa doesn't seem to like that as an AutomountDevice

? any suggestions ?

Thanks in advance
.:DB:.

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: Affa to USB
« Reply #1 on: October 22, 2012, 04:43:45 AM »
Brave Dave

I do the same & it works OK ie swap USB drives daily with Affa.

Label the disks the same as each other, & do not add entries in /etc/fstab, the system will take care of that in sme8 & assign each drive as being /sdc

Remove one drive first then connect the other drive so it is always seen as /sdc

My Affa job shows it as /dev/sdc1
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline elmarconi

  • ***
  • 139
  • +0/-0
Re: Affa to USB
« Reply #2 on: October 28, 2012, 12:09:50 AM »
Remove one drive first then connect the other drive so it is always seen as /sdc

That is the trick. Works like a charm here for at least several years...

...

Offline Brave Dave

  • *
  • 185
  • +0/-0
Re: Affa to USB
« Reply #3 on: October 28, 2012, 01:37:39 AM »
Thanks for the tips
I too have had this work for years
But sometimes things that have worked for years don't - there's a word for that ..

I had to write a script, someone else might come across it one day, but this might be the only time in living existence this thing happens
Code: [Select]
#!/bin/bash

affa=`/sbin/e-smith/db affa getprop mavis AutomountDevice`

if [ -b /dev/sdd1 ]; then

    if [ "$affa" == "/dev/sdd1" ];then
        #echo "all good ($affa)"
        /bin/logger "..all good /dev/sdd1 ($affa)"
    else
        /sbin/e-smith/db affa setprop mavis AutomountDevice /dev/sdd1
        /bin/logger "..Updated Affa AutomountPoint /dev/sdd1 ($affa)"
        echo "" | mail -s "Updated AutomountPoint /dev/sdd1" david@bravedave
    fi
elif [ -b /dev/sdc1 ]; then

    if [ "$affa" == "/dev/sdc1" ];then
        #echo "all good ($affa)"
        /bin/logger "..all good /dev/sdc1 ($affa)"
    else
        /sbin/e-smith/db affa setprop mavis AutomountDevice /dev/sdc1
        /bin/logger "..Updated Affa AutomountPoint /dev/sdc1 ($affa)"
        echo "" | mail -s "Updated AutomountPoint /dev/sdc1" david@bravedave
    fi
fi
« Last Edit: October 28, 2012, 11:27:22 PM by Brave Dave »
.:DB:.

Offline elmarconi

  • ***
  • 139
  • +0/-0
Re: Affa to USB
« Reply #4 on: October 28, 2012, 09:47:22 AM »
...

Offline Brave Dave

  • *
  • 185
  • +0/-0
Re: Affa to USB
« Reply #5 on: October 28, 2012, 11:29:29 PM »
Seen this? : http://wiki.contribs.org/USBDisks#USB_on_SME_8

Useful command - but Do you intend this to diagnose the cause ?

Not sure what to change to make it behave as expected, my answer has been to cope with the problem, not to fix
.:DB:.

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: Affa to USB
« Reply #6 on: October 28, 2012, 11:46:44 PM »
Brave Dave

Did you read my post earlier in this thread ?
I gave you suggestions for correct usage.

As you say, it appears your method of configuration & usage is incorrect, and you have wrote a script to workaround your problem, rather than set it up more appropriately.

Perhaps you need to try what I suggested & tell us if you still have problems, or not.

Quoting myself:
"Label the disks the same as each other, & do not add entries in /etc/fstab, the system will take care of that in sme8 & assign each drive as being /sdc
Remove one drive first then connect the other drive so it is always seen as /sdc
My Affa job shows it as /dev/sdc1

Also you should create a mount point under /media ie
mkdir -p /media/USBBackup
as the system automatically uses that, (rather than using /mnt/affadevice & so on)
In the affa config
AutomountPoint /media/USBBackup
AutomountDevice /dev/sdc1
(depending what you called your partition on your USB drives, which should be the same on both).
Remove the /etc/fstab entries you manually created as they are not needed on sme8.

I think that should be enough to resolve your issues, it works for me.
Please show us the output of
db affa show mavis
(assuming mavis is your jobname)

Your mount & unmount commands in sme8 should look like this,
mount /dev/sdc1 /media/USBBackup
umount /dev/sdc1

Note these changed from the way it was done in sme7
« Last Edit: October 29, 2012, 12:29:49 AM by mary »
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline elmarconi

  • ***
  • 139
  • +0/-0
Re: Affa to USB
« Reply #7 on: October 29, 2012, 12:09:26 AM »
And please post /etc/fstab...
...

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: Affa to USB
« Reply #8 on: October 29, 2012, 12:24:28 AM »
Dave
Please re-read my last post (2 up from here) as a number of edits were done
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline Brave Dave

  • *
  • 185
  • +0/-0
Re: Affa to USB
« Reply #9 on: October 29, 2012, 12:44:14 AM »
Sorry I used the word problem - not a problem, I've worked around. I did read the earlier message Mary, but I only came here after trying most of what had been suggested around the forums, this is a new problem for me, the device addressing of the drives seems to jump around unexpectedly

And the affa is not a problem - again - worked around - sorry, didn't want to get into Affa too much

I was only curious to two things
  • Affa doesn't document any Label handling syntax, only device (i.e. /dev/device) -hence the need for a workaround
  • But at an Operating system level (i.e. dmesg output) the drives show up everywhere and anywhere, now coming in as drive sdb - hence the question

PS: As far as I can make out they should have never shown up as sdc or sdd, they should have always been sdb


I do have this line in the fstab, I added it so I can mount and read the drive, this works ok - tried with and without - all the disks have been labeled backup_usb (Before posting here I had tried a couple of AutomountDevice alternates - to no avail - affa didn't recognize the syntax) e.g. db affa setprop mavis AutomountDevice backup_usb (tried LABEL=backup_usb)

fstab line:
Code: [Select]
LABEL=backup_usb        /mnt/affadevice         ext3    defaults        0 0

The mavis job automount lines are:
Code: [Select]
db affa show mavis mavis=job
==//snip//==
    AutoUnmount=yes
    AutomountDevice=/dev/sdb1
    AutomountOptions=
    AutomountPoint=/mnt/affadevice
==//snip//==

Also PS - this is an IBM X-Server - not a fan - i mean - NOT A FAN, had a few problems, 4 months old, Motherboard, Raid Controller and Hard disks have been replaced - all data has been lost once - I came on the scene about half way through all the drama.
.:DB:.

Offline Brave Dave

  • *
  • 185
  • +0/-0
Re: Affa to USB
« Reply #10 on: October 29, 2012, 12:56:37 AM »
Your mount & unmount commands in sme8 should look like this,
mount /dev/sdc1 /media/USBBackup
umount /dev/sdc1

Hey this is the problem .. this isn't consistent .. hence the workarounds
(Don't say pull the other one out before putting the next one in)
.:DB:.

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: Affa to USB
« Reply #11 on: October 29, 2012, 01:54:07 AM »
Brave Dave

You obviously have "issues" with devices plugged into USB ports being not consistently recognized.
Maybe you should tell us more about what gets plugged into that server & how many drives, what other devices, (more) server history, what ports are in use anytime etc etc etc.

Quote
Don't say pull the other one out before putting the next one in

Why not, that is an appropriate thing to do, unless of course you are plugging other USB devices in and out on a regular basis.

Otherwise it could be that your USB bus is flaky, motherboard faulty, bad cables, faulty devices eg mouse, keyboard ????
You need to tell us more.

I only referred to sdc as I use that and it seemed like that should be your default USB drive ID from your script contents. Now you say it "SHOULD" be sdb, please explain some more.
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.