LinuxQuestions.org

LinuxQuestions.org (http://www.linuxquestions.org/questions/index.php)
-   Linux - Hardware (http://www.linuxquestions.org/questions/forumdisplay.php?f=18)
-   -   External hard disk for backups (http://www.linuxquestions.org/questions/showthread.php?t=4175451878)

alaios 02-27-2013 04:56 AM

External hard disk for backups
 
Dear all,
I bought an external hard disk for doing my backups there.
The disk is 3TB large, and it would be used only for the backups.

a. Which is the recommended file system for external hard disk that should be accessible only from Linux? I do not want to bother with compression file systems

b. How should I mount it

c. Is it possible to check before my backup script runs (basically that would be some customized rsync) that the hard disk is indeed mounted and accessible (what would happen for example if the hard disk was present at boot time and someone accidentally remove the cable...for any reason)?

I would like to thank you in advance for your reply
Regards
Alex

John VV 02-27-2013 06:53 AM

I formatted my WD "my book" as ext4
and use usb
wrote a udev rule to mount it by the "name" and added a fstab entry

using udev will keep it on the same /dev/????
so it will be mounted

alaios 02-28-2013 01:32 AM

I mostly meant for the parameters would be needed to format in a way sutiable for external hard disks.

syg00 02-28-2013 05:28 AM

Doesn't matter; a disk is a disk - John VV has pretty well covered things.
If you mount it with a name chosen by you, easy to check if it's mounted prior to using rsync.

bloody 02-28-2013 06:30 AM

a) ext4. Fastest and overall best allround file system for "Linux only".

b) maybe as one of the first commands in your backup script, because c) the mount would fail if not present at the very moment you launch the backup, so you would easily recognize and be able to echo ERROR and exit 1. Use a disk label to 100% identify the partition you want to mount. See man e2label. Use 16 characters max. for the label. In /etc/fstab, use e.g. "LABEL=MY_USB_BACKUP3" instead of "/dev/sdXN".

Another hint: 3TB is huge. If you only make it one large partition and got hardware trouble there, you might want to create an image of the defective partition for further analysis. But that doesn't just take ages, but also: where to store a 3TB file? Better make it 3x 1TB or 5x600GB...

John VV 02-28-2013 01:28 PM

you might want to break it up into 3 or 4 partitions

just a safety precaution
1 Tb is still a large partition

jefro 02-28-2013 02:47 PM

"c. Is it possible to check before my backup script runs (basically that would be some customized rsync) that the hard disk is indeed mounted and accessible (what would happen for example if the hard disk was present at boot time and someone accidentally remove the cable...for any reason)?"

I'd say their may be a few ways to test target before script runs and use exit to some other means like write to log.
My guess would be to either test mount or test fstab. Might even go so far as to do test write to destination and read it back.

Habitual 02-28-2013 03:03 PM

wrt: c:
This should work, or something like it. :)
Code:

check_mount()
{
if
mount | grep sdb1  > /dev/null ;
exit
else
do_work_here
fi
}

HTH.

BoraxMan 03-02-2013 04:39 AM

a) Ext 3 or Ext 4. XFS is also a decent choice. For my backup drive I use EXT4.

b) The way you mount any other disk.

c) I don't recommend looking for a specific device, such as /dev/sdb, because the device name might be different depending on whether other USB drives have been plugged in.

The best say I can think of, is to put a small file, with maybe a few bytes of random data and have a copy on the filesystem your backing up, and the one you are backing up to. Then, your script should just do a compare using cmp, and if it returns with no error, the drive is mounted.


All times are GMT -5. The time now is 11:25 AM.