• We did not send an email asking for donations - please read this post.

USB Drive basics.

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
1,559
Reaction score
1,177
Credits
9,920
I tend to use a lot of USB drives for various reasons.
For example the place I work, has computers in data center that don't have access to the internet.
If I want to update or copy files to them, I pretty much have to do it with an external drive.

I was surprised to find out that many people do not know you can format USB drives with EXT4 or XFS filesystems.
It seems the majority of USB drives come formatted as a FAT32 filesystem.

There are pros and cons to using these filesystem formats. The biggest disadvantage to using an EXT4 or XFS formatted
drive, is that you can't use it on a Windows system. There are some utilities that will read these formats for you in Windows.
But most Windows computers don't have these utilities installed.

On the other hand, the biggest disadvantage to using a FAT32 filesystem, is that you can't store large files on them.
It's great that you just bought a 128 or 256GB USB Drive, just to find out, that the largest file you copy to it, is 4GB.

So you have a couple of options here.

I "usually" format my USB drives with exFAT instead on FAT32. Most modern Linux distro's can read exFAT. That wasn't true
just 2 or 3 years ago. The advantage to exFAT, is I can store files up to 16 exoBytes in size. The largest USB drive I have seen so far is 2 terraBytes, so 16 exoBytes might be overkill. In any case, I can store files over a TerraByte in size if I need to.

Another option is to use the "split" command. Say I have a file that is over 4GB in size, but I need to put it on a FAT32 formatted
USB drive. I can use this command.

split AlmaLinux-8.6-x86_64-dvd.iso -b2G

This will split my large file into several small files. Each segment will be 2GB in size. ( the -b is the size option )
I recommend that you copy the file to it's own directory before doing this. This will create a number of files, typically named
something like xaa, xab, xac, xad, xae, xaf, etc... In this case, I am splitting an 11GB file. So it automatically creates
however many files it needs to complete my 11GB file. In this case it's 6 files, all are 2GB except the last one is a little over
1GB. Now I just copy those 6 files over to my FAT32 USB drive and I'm good to go. Again, I recommend putting them in their own directory.

Now I need to put them over on another hard drive. But how do I put them back together?
Easy..

cat x* > AlmaLinux-8.6-x86_64-dvd.iso

It's really that easy.
 


osprey

Active Member
Joined
Apr 15, 2022
Messages
242
Reaction score
140
Credits
2,216
Code:
For example the place I work, has computers in data center that don't have access to the internet.
If I want to update or copy files to them, I pretty much have to do it with an external drive.
No intranet?
 
OP
dos2unix

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
1,559
Reaction score
1,177
Credits
9,920
Only Citrix, so no file transfers.

I could use a laptop and a USB to USB transfer cable. All the network ports are locked down by MAC address.
But a USB drive is easier, and more portable.
 
Last edited:
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Top