Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I recently had an issue where I lost my whole backup server due to an electrical overload causing my server to literally explode and fried all 4 of my terabyte drives.... needless to say, I have no more backups because of this, and everywhere I read about backups said that setting up a raid array would allow me to keep good backups.... boy did I learn this lesson the hard way in needing to have some sort of external backup option, which brings me to this post and my questions:
I'm using Ubuntu 14.04 LTS server on an older Dell Poweredge 600sc, and I was thinking of using WD Passport 1Tb external drives to be used as my "offsite" backup option. I don't have a lot of data, and my current backup schedule is only a weekly backup, so thinking that if I have two of these passport drives so that I can have one drive offsite and one attached to the server, and rotate them every 4 weeks so as not to loose all my data.
Here's my question: Ideally, I would love to just be able to unplug the current drive, plug in the new drive and have everything work. However, I don't see this actually working, but if there's a way to do this, that would be totally awesome.... ;-)
So, realistically, I know I will have to unmount the one drive, unplug it, then plug in the new drive and mount it on the system. Is there a way to mount this to the same mount point automatically so that I don't have to rewrite my backup script each time I swap drives out so that the backups go to the same mount point? Or will the UUID's get messed up each time I do this?
Hopefully this makes sense and an easy solution can be found to accomodate this idea.....
Thanks again for all your help. This site is awesome for newbies such as myself........
Recent versions of udev will mount an external drive on a path containung the filesystem label, if the path is not already used. I don't know if this applies to ubuntu, or if udev recognizes different drives, but try it: Name the filesystem on both disks "backup" while creating, like
Code:
mkfs.ext4 -L backup /dev/...
or rename the existing filesystems using tune2fs (if you use ext... filesystem).
Then they should be mounted on /run/media/<username>/backup. Do not mount both at the same time, of course.
If you put an entry in fstab, udev leaves it alone. I have a line similar to:
LABEL=Backup /backup ext3 ...
So with any of my backup disks "# mount /backup" will put it where I expect. I don't want it mounted except during the backup cycle, and can dismount it (or shut down the machine) at the end. Don't use a physical device like sdj1, it may not always be the same, and of course a UUID is useless if you are switching disks around. This technique works equally well on memory sticks.
I run Amanda at home with the three backup disks each configured with 10 slots. Every week or so the current backup goes to work and the oldest comes back. Amanda works out that the "tapes" are expired and overwrites them.
I use the same fstab system previously mentioned, but I have the mount points as root directories ( /usb1, /usb2, /cdrom, /dvd ) and have configured fstab to mount them.
For my memory sticks.
>> mount /usb1
>> mount /usb2
>> tar -c --bzip2 -f /usb1/backup/xxxx xxxx
The same system would work for any media.
I have had weekly backups, but also had monthly backups and yearly backups.
The weekly backups are configured to get the changed files.
The monthly and yearly backups cover more of the entire system. They save all files as current state. Older versions are saved because users make mistakes and may have to go back a few months to get an old copy of a file.
Yearly backups save /etc/ and all config, so the system can more easily be recreated.
There are also event backups, triggered by system changes. These are customized to what got changed.
I think that the UUID system of naming partitions is an awkward mess. I give all of my disks labels and use the label to mount drives. The situation is even worse with systemd which has conniption fits if I misspell a UUID. I have a directory called /media/usb.hard.drive and here is a typical mount command for a partition labeled charlie in one of my backup scripts.
# Mount the USB hard drive
if ! (mount -t ext4 -L charlie /media/usb.hard.drive);
then
echo "mount failed for USB hard drive on charlie partition"
exit
fi
These commands say to mount charlie on /media/usb.hard.drive. If the mount fails then issue an error message and exit the script. The mount will fail if charlie is not plugged in or is not powered on. I plug charlie in and wait for KDE to tell me charlie is available before I start the backup script. At the end of the backup the script does a umount for the external drive and issues a finished message. Then I unplug the external drive.
I only plug in an external backup drive when I am doing a backup or recovery. This minimizes the possibility of accidental destruction of the backup data.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.