[SOLVED] How to properly format a USB drive for Linux Backups?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
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.
How to properly format a USB drive for Linux Backups?
NOTE: I do not normally "hammer you guys" for answers like this. For me the fun of Linux is learning, studying, learning from mistakes, and enjoying the fruits of my labor. But I am pressed for time in getting my important data for website work from old CentOS 6.6 PC to new CentOS 7 PC. Having everything backed up in case of disaster, and get this part done quickly so I can swap out the machines. Once the important stuff is backed up and machines are swapped out, the rush is over. I can then continue my website work and tweak up the PC later, at my leisure.
I want to use a USB drive to backup my new CentOS 7 Linux files. I do wesites and use the public_html directory for adding sites that I edit with Dreamweaver on a Windows 7 machine. The public_html directory is mapped as a Windows drive. This arrangement works quite well with Dreamweaver because with apache, I have a built in testing server.
I got terrific help here with backup options and am not scared or clueless on what to do next. However, when I plug in these USB drives then look at them with fdisk, they do not appear to be "usable" in the state they show up as. I need to know what I must do to make one of these USB drives suitable for Linux backup storage. When I plug in the USB drive, it automounts as /dev/sdb. That only shows the drive itself, my experience is that you use something like sdb1 to show what partition you wish to work with. Using sdb1 gives me the same "multiple blocks" as sdb.
What do I have to do to prep this drive as a suitable Linux backup drive? fdisk? Partition creation? Use mkfs to format it with a particular file system suitable for Linux backup? What file system do you recommend? Some help with the commands and syntax would be greatly appreciated. I can get a rudimentary backup going with with webmin which uses a compressed tar backup while I study up on the other methods such as backula or even a simple tar backup script and toss it into cron. (That is what webmin backup does anyway.) Thank you very much. You guys have lifetimes of experience as sysadmins so your advice is super appreciated and respected.
Here is the fdisk output on two of the drives to show you what I mean:
[paul@ohmster dev]$ sudo fdisk sdb1
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk sdb1: 750.1 GB, 750120861696 bytes, 1465079808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x69205244
This doesn't look like a partition table
Probably you selected the wrong device.
Oh that was easy! I was hoping that one of you would know this off the top of your head and have a quick answer. After 88 views and no replies, it is time to get busy!
I used gparted to unmount the 1TB Seagate USB drive. Then in the same utility, deleted the existing NTFS partition to use all available space on the drive. Then I created a partition in the same gparted utility. The defaults were all very nice, create partition full size of disk, format with ext4 file system, and there was even a Label box! I gave it the label 'USB-Backup'.
In a terminal, I did a 'cd mnt' and then 'sudo mkdir backup'.
After that a quick 'sudo vim /etc/fstab'. Inserted the following line at the bottom of fstab.
LABEL=USB-Backup /mnt/backup ext4 defaults 0 0
See how well it works, 'sudo mount -a'. Check with mount command, 'mount'.
/dev/sdb1 on /mnt/backup type ext4 (rw,relatime,seclabel,data=ordered)
For quick access, I made a symlink in my home directory.
'$ ln -s /mnt/backup backup'
Check and see: 'ls -la backup'
lrwxrwxrwx. 1 paul paul 11 May 17 18:35 backup -> /mnt/backup
That's it, ready to commence backing up stuff! Hope this helps someone.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Ext4 is a correct choice. Do not ever use FAT or NTFS (or any Windows or Mac filesystem) for backups. You'll loose your permissions on the backup copy.
Other Linux file systems like XFS are suitable as well, but ext4 claims to have only advantages. I have no opinion on that.
Ext4 is a correct choice. Do not ever use FAT or NTFS (or any Windows or Mac filesystem) for backups. You'll loose your permissions on the backup copy.
Other Linux file systems like XFS are suitable as well, but ext4 claims to have only advantages. I have no opinion on that.
jlinkels
After I became aware of gparted it was like "a one stop shop" for all my needs. The defaults were very up to date, ext4, and even label. I forget what the advantages of using label are but at one time, I found this to be a very good way to mount drives. I put the entry into fstab and am done.
Your rsync script is fabulous! I ran it last night and I could not believe my eyes, in the Caja File Manager, I watched an empty drive but for lost+found completely fill up, very fast, with the entire contents of the hard drive! I now put it in cron as root to run at 5:05 AM every day. As far as restoring from it, I figured it out. One person, Jefro did point out some things in the [SOLVED] rsync better than tar for USB backup? to help me "remember to understand" such as it is not really possible to get a complete backup of a running system with open files. I can copy back my files with 'cp -a' since all ownership and permissions have been retained or do the same in reverse with rsync if there is such and option. I will just use an imaging CD to backup the drive as an image. Even if done 2 times a year, I could restore the system, use yum to update it, and somehow learn to use rsync to copy back just the data that is missing on my drive, home directory. Thank you very much jlinkels.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Quote:
Originally Posted by ohmster
such as it is not really possible to get a complete backup of a running system with open files.
It is generally considered a small problem. If you have a database running it could be a problem. Making a daily dump of such a database well before rsyncing solves that.
Quote:
Originally Posted by ohmster
I will just use an imaging CD to backup the drive as an image. Even if done 2 times a year, I could restore the system
I think that is a very good idea. But I would postpone the yum update to after the restore. Your backup copy contains a complete system including all programs and configurations and will restore to the state just prior to backup.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.