Thanks Doug, that was the missing link.
with minor directory changes......

mount -o uid=asterisk,gid=asterisk /dev/sda1 /var/lib/asterisk/backups

....works like a charm :)

Now all I need is to mount this automatically when I insert the stick and 
un-mount it when
removed.

Thanks to all or their help

-----------------
Henry L. Coleman
[VoIP-PBX.ca]

=================

> Douglas Pickett<
> Henry,
> This issue is probably who "owns" the flash drive.
>
> With a flash drive formatted for a DOS style file system (which would be the
> most common case), when you mount the drive it doesn't follow the usual
> Linux rules for owners and groups and permissions.  You've probably mounted
> the drive as root, so the default action is to assign root as the owner, and
> with the same permissions as root normally has. The backup option within
> FreePBX executes as user asterisk and group asterisk, which would not have
> permission to write to a directory that only root would have the permissions
> for writing.   So you need to change the default user and group for the
> filesystem.
>
> Use:
>
> mount -o uid=asterisk,gid=asterisk /dev/sda1 /mnt/usb
>
> to mount the drive as owned by asterisk (that what the -o
> uid=asterisk,gid=asterisk does).
>
> Regards,
> Doug.
>
> ----- Original Message -----
> From: "Henry L.Coleman" <[email protected]>
> To: <[email protected]>
> Sent: Wednesday, June 17, 2009 8:42 PM
> Subject: Re: [on-asterisk] Backup and restore to a USB stick
>
>
>> Thanks for all the help ..I'm getting close to getting this thing running.
>> 1.) I can mount the stick -sda1 and mask the backup directory on the HD
>> 2.) I can see the directory /asterisk/now in the GUI and backups appear to
>> work
>> but do not get saved.
>> 3.) I'm going to check the file permissions but any other suggestions?
>>
>> PS using WinSCP I can easily drag and drop file into the directory
>>
>> H
>> -----------------
>> Henry L. Coleman
>> [VoIP-PBX.ca]
>>
>> =================
>>
>>> Douglas Pickett<
>>> Henry,
>>> The quick answer on where to find mounted filesystems is "df" (which as
>>> the
>>> man page states "report file system disk space usage").
>>>
>>> Here's what a trixbox system reports:
>>>
>>> # df
>>> Filesystem           1K-blocks      Used Available Use% Mounted on
>>> /dev/hda2             74842944   2522460  68457256   4% /
>>> /dev/hda1               101086     11084     84783  12% /boot
>>> tmpfs                   253700         0    253700   0% /dev/shm
>>> /dev/sda1              2002892    627960   1374932  32% /mnt/usb
>>>
>>> The first column reports the device (on this system the USB stick is
>>> /dev/sda1) and the last column ("Mounted on") shows the place where the
>>> device is mounted onto the filesystem (in this case /mnt/usb).
>>>
>>> As for redirecting the output of the backup (assuming you can't tell the
>>> backup utility to change where it puts the backup) is to change the
>>> target
>>> directory of the mount command, or put in a symbolic link.  The freepbx
>>> backup/restore utility seems to create the backups under
>>> /var/lib/asterisk/backups, then creates a directory corresponding to the
>>> backup name, and puts the actual backup file in that directory.
>>>
>>> For the mount point idea, instead of mounting to /mnt/usb, you could do
>>>
>>>     mount /dev/sda1 /var/lib/asterisk/backups
>>>
>>> This will hide any files and directories in that backups directory, and
>>> replace them with the directory structure on the USB drive.  When you
>>> umount
>>> the USB stick they will re-appear.
>>>
>>> You can also use a symbolic link:
>>>
>>>     ln -s /mnt/usb/daily /var/lib/asterisk/backups/daily
>>>
>>> This command creates a link in the backups directory called daily, that
>>> then
>>> points to a directory on the USB drive.  When you backup using the
>>> "daily"
>>> config, the utility will think it is writing to the
>>> /var/lib/asterisk/backups/daily directory, but will actually be writing
>>> to
>>> /mnt/usb/daily.
>>>
>>> I think the best suggestion is to follow what Mike Ashton suggested with
>>> rsync - you actually do the backups to the local hard drive, but then
>>> copy
>>> the files over to the USB device.  Given the limited number of write
>>> cycles
>>> for USB flash memory, this is probably a good idea.
>>>
>>> Regards,
>>> Doug.
>>>
>>>
>>>
>>> ----- Original Message -----
>>> From: "Henry L.Coleman" <[email protected]>
>>> To: <[email protected]>
>>> Sent: Tuesday, June 16, 2009 1:48 PM
>>> Subject: [on-asterisk] Backup and restore to a USB stick
>>>
>>>
>>>> Hi all, as many are aware FreePBX has a backup and restore function that
>>>> can schedule a backup of conf, cdr, and vmail.
>>>> This works very well but I need to back the files up to a USB stick
>>>> instead of a default backup directory.
>>>> My question (not being a good Linux man) is how do I the redirect the
>>>> backup path to this device.
>>>> When I plug the stick in, the consule indicates that the stick is
>>>> recognised and is working but does't tell me where
>>>> in the directory structure to find it.
>>>>
>>>> Help please?
>>>>
>>>> Henry L.Coleman [VoIP-PBX.ca]
>>>> -------------------------------------------------
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to