LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 05-17-2015, 03:13 PM   #1
ohmster
Member
 
Registered: May 2005
Location: South Florida
Distribution: CentOS 7
Posts: 39

Rep: Reputation: 2
Cool 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.

Device Boot Start End Blocks Id System
sdb1p1 ? 218129509 1920119918 850995205 72 Unknown
sdb1p2 ? 729050177 1273024900 271987362 74 Unknown
sdb1p3 ? 168653938 168653938 0 65 Novell Netware 386
sdb1p4 2692939776 2692991410 25817+ 0 Empty

Partition table entries are not in disk order

Command (m for help): q


AND

Disk sdb1: 1000.2 GB, 1000202043392 bytes, 1953519616 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: 0x6e697373

This doesn't look like a partition table
Probably you selected the wrong device.

Device Boot Start End Blocks Id System
sdb1p1 ? 1936269394 3772285809 918008208 4f QNX4.x 3rd part
sdb1p2 ? 1917848077 2462285169 272218546+ 73 Unknown
sdb1p3 ? 1818575915 2362751050 272087568 2b Unknown
sdb1p4 ? 2844524554 2844579527 27487 61 SpeedStor

Partition table entries are not in disk order

Command (m for help): q

Last edited by ohmster; 05-17-2015 at 03:46 PM. Reason: reason
 
Old 05-17-2015, 05:29 PM   #2
ohmster
Member
 
Registered: May 2005
Location: South Florida
Distribution: CentOS 7
Posts: 39

Original Poster
Rep: Reputation: 2
Thumbs up How to quickly format a USB drive for Linux use

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.

Last edited by ohmster; 05-17-2015 at 05:39 PM.
 
1 members found this post helpful.
Old 05-17-2015, 07:57 PM   #3
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
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
 
1 members found this post helpful.
Old 05-18-2015, 04:01 PM   #4
ohmster
Member
 
Registered: May 2005
Location: South Florida
Distribution: CentOS 7
Posts: 39

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by jlinkels View Post
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.
 
Old 05-18-2015, 05:40 PM   #5
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by ohmster View Post
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 View Post
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.

jlinkels
 
1 members found this post helpful.
  


Reply

Tags
filesystems, formatting, usb drive


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Best filesystem to format USB pen drive with to be usable from Windows, Mac, Linux? veeruk101 Linux - Newbie 1 11-04-2011 02:39 PM
[SOLVED] Using USB extrenal drive for backups Shenkle Linux - Newbie 6 01-02-2011 12:03 PM
How to do backups to external USB drive webwired Linux - Newbie 3 03-06-2010 03:57 PM
USB hard drive not detected properly zytsef Linux - Hardware 4 06-03-2007 06:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 08:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration