TUTORIAL Connecting External USB HDD for backup..

TinkerMan

Guru
Joined
Jan 21, 2011
Messages
39
Reaction score
1
To all,

Has anyone had problems with connecting an External USB HDD to a PIAF server on a box?

By the way, we don't use Pogo Plug here. We have USB HDD Docks and USB HDD Enclosures.

My problem with connecting an External USB HDD (500GB) to a PIAF, is that:

1.) does not see the /dev/sdxn location properly (where x=a,b, or c and n=1, 2, 3....etc)

2.) does not mount /dev/sdxn location when I try to mount at command line

3.) Incrediblepbxbackup script won't back up to the External USB HDD location and I've edited the CONF file to look for that location

4.) Mondoarchive will not work with that External USB HDD.


I've tried to use Clonezilla and it worked one time then stops after that. I'm still trying test this out.

Mondo works great if you use the DVD option. No problems there. But, for practicality, we like to setup a HDD for it.

Hopefully anyone can help point me in the right direction on this?
 
I have a ext usb drive on mine. I just plugged in the drive, did a fdisk -l to find the disk #, did a fdisk /dev/sdX and then used that to delete all the partiions, use fdisk to create a new one and finally used mkfs to format it ext3.

Once I did that I just created a mount point of like /usb and then did the mount.

I use the Incrediblepbx backup scripts to backup to this drive. I didnt set it up to automount or added it into fstab because honestly I dont want it to mount on reboot.
 
Another tip: use a disk label to make sure you can mount it consitantly.

With Linux, use e2label to give your backup volume a name. Call it "backups" or whatever.

Ex - if your backup drive is /dev/sdb1, you would do:

# e2label /dev/sdb1 backups

Now, in /etc/fstab, you can call the drive by name to mount... in other words, if you wanted to always mount this drive under /mnt/backups, you could now reference the drive by name:


LABEL=backups /mnt/backups ext3 default0 0

It can save you a lot of headaches using labels :)

Oh yeah - if you want to mount this thing, just:

# mount /mnt/backups

and it'll find it - assuming it's correct in /etc/fstab :)
 
Another tip: use a disk label to make sure you can mount it consitantly.

With Linux, use e2label to give your backup volume a name. Call it "backups" or whatever.

Ex - if your backup drive is /dev/sdb1, you would do:

# e2label /dev/sdb1 backups

Now, in /etc/fstab, you can call the drive by name to mount... in other words, if you wanted to always mount this drive under /mnt/backups, you could now reference the drive by name:


LABEL=backups /mnt/backups ext3 default0 0

It can save you a lot of headaches using labels :)

Oh yeah - if you want to mount this thing, just:

# mount /mnt/backups

and it'll find it - assuming it's correct in /etc/fstab :)

I have a ext usb drive on mine. I just plugged in the drive, did a fdisk -l to find the disk #, did a fdisk /dev/sdX and then used that to delete all the partiions, use fdisk to create a new one and finally used mkfs to format it ext3.

Once I did that I just created a mount point of like /usb and then did the mount.

I use the Incrediblepbx backup scripts to backup to this drive. I didnt set it up to automount or added it into fstab because honestly I dont want it to mount on reboot.

RXWatcher,

I've tried fdisk -l and showed all the list of devices. The external USB 500 GB HDD in question is listed under /dev/sdb1.

I've deleted all partitions using the fdisk. Then used mkfs on /dev/sdb1 and format it using ext3.

But when I try to mount /dev/sdb1, it says, "mount: can't find /dev/sdb1 in etc/fstab or etc/mtab"

I've used WinSCP from my Windows PC and terminal in to find etc/fstab and etc/mtab and the contents of it does not show /dev/sdb1 in there. Should it not be updated automatically?
 
Another tip: use a disk label to make sure you can mount it consitantly.

With Linux, use e2label to give your backup volume a name. Call it "backups" or whatever.

Ex - if your backup drive is /dev/sdb1, you would do:

# e2label /dev/sdb1 backups

Now, in /etc/fstab, you can call the drive by name to mount... in other words, if you wanted to always mount this drive under /mnt/backups, you could now reference the drive by name:


LABEL=backups /mnt/backups ext3 default0 0

It can save you a lot of headaches using labels :)

Oh yeah - if you want to mount this thing, just:

# mount /mnt/backups

and it'll find it - assuming it's correct in /etc/fstab :)

Linetux,

Initially, when I tried to e2label /dev/sdb1 USBBACKUP, it did not work. Error message says cannot find the device.

But when I format it with ext3 as per RXWatcher, I was able to use e2label /dev/sdb1 USBBACKUP no problem. So I guess it's a formatting issue it is picky on. Does not like Windows NTFS partition.

But when I try to do the mount /dev/sdb1, I get the same error. When I try to manually modify the mtab and fstab, still no go. For some reason, it will not read the 500GB USB HDD. Strange.
 
Oh, yeah, sorry - I assume everyone uses a real file system like EXT3, not NTFS :)

NTFS write support isn't something to trust in Linux - and I'm not even so sure it's easy to do with CentOS due to all the newer libraries required... usually if I need to read/write NTFS, I'll use an Ubuntu / Fedorda box.

As for your issues with mounting, the whole point of labeling is so you don't have to refer via /dev/sdx anymore. In other words, try this:

mount -L USBBACKUP

If you have a mount point listed in /etc/fstab, it should mount the USB drive right where you expect it to be.

You can also do:

mount -a

This will read /etc/fstab and mount anything listed.
 
root@pbx:~ $ mkdir /usb
root@pbx:~ $ fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 60704 487500457+ 83 Linux
/dev/sda3 60705 60801 779152+ 82 Linux swap / Solaris

Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 9729 78148161 83 Linux
root@pbx:~ $ mount /dev/sdb1 /usb
root@pbx:~ $ cd /usb
root@pbx:/usb $ ls -al
total 32
drwxr-xr-x 4 root root 4096 Jan 17 15:01 .
drwxr-xr-x 26 root root 4096 Feb 21 18:34 ..
drwxr-xr-x 2 root root 4096 Jan 17 15:05 incredible-backup
drwx------ 2 root root 16384 Jan 15 19:04 lost+found

a df -h will show the size of the mounted filesystems. If your mount point (/usb in my case) isnt there then it didnt mount and /usb is just a directory off of the root (/):


root@pbx:~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 451G 3.6G 424G 1% /
/dev/sda1 99M 13M 82M 13% /boot
tmpfs 506M 0 506M 0% /dev/shm
/dev/sdb1 74G 571M 70G 1% /media/disk
/dev/sdb1 74G 571M 70G 1% /usb
 
Oh, yeah, sorry - I assume everyone uses a real file system like EXT3, not NTFS :)

NTFS write support isn't something to trust in Linux - and I'm not even so sure it's easy to do with CentOS due to all the newer libraries required... usually if I need to read/write NTFS, I'll use an Ubuntu / Fedorda box.

As for your issues with mounting, the whole point of labeling is so you don't have to refer via /dev/sdx anymore. In other words, try this:

mount -L USBBACKUP

If you have a mount point listed in /etc/fstab, it should mount the USB drive right where you expect it to be.

You can also do:

mount -a

This will read /etc/fstab and mount anything listed.

Linetux,

Yes. The problem appears to be the fact that the HDD is NTFS formatted. I had the HDD formatted for NTFS so that I can see the contents under a Windows PC. Looks like CentOS in PIAF does not like USB HDD that is NTFS despite it says it can support NTFS partition.
 
root@pbx:~ $ mkdir /usb
root@pbx:~ $ fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 60704 487500457+ 83 Linux
/dev/sda3 60705 60801 779152+ 82 Linux swap / Solaris

Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 9729 78148161 83 Linux
root@pbx:~ $ mount /dev/sdb1 /usb
root@pbx:~ $ cd /usb
root@pbx:/usb $ ls -al
total 32
drwxr-xr-x 4 root root 4096 Jan 17 15:01 .
drwxr-xr-x 26 root root 4096 Feb 21 18:34 ..
drwxr-xr-x 2 root root 4096 Jan 17 15:05 incredible-backup
drwx------ 2 root root 16384 Jan 15 19:04 lost+found

a df -h will show the size of the mounted filesystems. If your mount point (/usb in my case) isnt there then it didnt mount and /usb is just a directory off of the root (/):


root@pbx:~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 451G 3.6G 424G 1% /
/dev/sda1 99M 13M 82M 13% /boot
tmpfs 506M 0 506M 0% /dev/shm
/dev/sdb1 74G 571M 70G 1% /media/disk
/dev/sdb1 74G 571M 70G 1% /usb


RXWatcher,

Thanks for your help. After deleting to HDD's current partition under Webmin and formatting the HDD to Linux partition, I did the following mkfs /dev/sdb1 just to make sure.

After that, I mkdir /usb to make the directory call USB as you had suggested.

Then I was able to mount /dev/sdb1 /usb. Before, I could not do this. Now I can. This was after the HDD was completely had NTFS removed and repartitioned for Linux.

On my Windows PC, I used WinSCP to terminal into PIAF box, modified the incrediblebackup script where the backuploc=/usb, then ran ./incrediblebackup and it worked.

I see the backup file got created on /usb location as well as on the USB HDD.

Now that I finally got IncredibleBackup working... I can now have redundant backup:

1.) Incredible backup to am external USB HDD
2.) Mondo Archive to DVD

I am still deciding which one will be my last fall back position. Both are good in their own ways. Both requires that the box be the same exact setup and identical version. I need to look into a bare system restore... I'm open to suggestions...
 
The only thing extra i had to do was add permissions for Asterisk rwxrwxr-w instead of root for the backup to copy without write errors.
I use winscp on windows, (cause i'm not a strong linux swimmer) goto the folder and right click and use properties, but believe you can use "chown" command also from the CLI.
 

Members online

Forum statistics

Threads
26,687
Messages
174,411
Members
20,257
Latest member
Dempan
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Back
Top