USB External drives and Thumb drives

A USB “thumb drive” or sometimes called a “flash drive” is a data storage device that includes flash memory with an integrated USB interface. It is typically removable, re-writable and much smaller than CDs or DVDs, optical discs. Additionally, it is more flexible, portable, and holds more memory. Typically USB-Drives are used to backup contents of directories and files in order to have safe copies of information. Some people use them to transfer information from one computer to the other. Today most computer have USB ports on which these drives can be plugged in. USB drives are usually formatted with a windoze file system (e.g. FAT32) but can also be formatted to Linux ext-3 or ext-4 file systems. Of course Mac OSX also supports these drives. It important to note that Fedora Linux workstation at CCRMA can read and write data into windoze formmated thumb drives.

If you plug in a VFAT or even a FAT32 windoze filesytems USB thumb drive into a Linux workstation, as of Fedora 26 and above the drive will automatically mount into directory:


         /run/media/your_user_name/usb-drive       

- Gnome might also show an Icon of your drive on the desktop.

Once mounted, you have read and write permissions to your drive since Linux is seeing it as one of own your directories. You can go the content of your drive by changing directories such as:


         cd /run/media/your_user_name/usb-drive       

After your are done with the drive, you MUST unmounted. This is a bit tricky becuase depending on where your drive was mounted, on the command line you need to issue something like,


         udisksctl unmount -b /dev/sdb1       

You might need to change '/dev/sdb1' with whatever the device your drive is mount on. You can try finding about where the drive is with the 'fdisk -l' command. Other options might be '/dev/sdb2' or '/dev/sdc1' and, so on. If none of these work, Gnome provides a way to unmount and eject portable drives by using Gnome's Nautilus folder and file manager.

But what about if you want to mimic one of your Linux directories or better, if you want to format a USB drive with a Linux file system?. If this is the case we can assume that you also have a Linux machine at home so that you administrative and root privileges. If this is not the case you might ask a staff member so that you can format your thumb drive with a Linux file system. Below we are showing how to format a drive with an ext-3 or ext-4 file system. However, you might need root privileges.

  1. On the system identify the drive you want to FORMAT.

    Insert USB drive into your system and identify your USB drive correctly. This is a crucial step because formatting the wrong disk should be avoided at all costs. You can use the 'df -h' command and it would show something like:

    
     		 
    

    df -h
    
    Filesystem      Size  Used Avail Use\%  Mounted on
    /dev/sda1       28G    24G  2.3G  92\%  /
    udev            1.4G   12K  1.4G   1\%  /dev
    tmpfs           277M  1.2M  276M   1\%  /run
    none            5.0M     0  5.0M   0\%  /run/lock
    none            1.4G   34M  1.4G   3\%  /run/shm
    /dev/sdb1      14.8G  1.4G  13.4G  10\% /run/media/cruzer}
    
  2. Create a new partition with 'fdisk'.

    If your device is 'sdb1' as shown above run 'fdisk' like:

    
              fdisk /dev/sdb        
    

    Once in 'fdisk', delete all partitions and create a new single partition. Linux ext3 partitions are the default in 'fdisk'. Write changes and quit 'fdisk'.

  3. Format (create) the file system (for example ext-4).

    
              mkfs.ext4 /dev/sdb1        
    

  4. To label the drive (name it) and mount.

    
              e2label /dev/sdb1 cruzer        
    

  5. grant permissions on the thumb drive file system.

    
     		 
         cd /run/media/user_name/cruzer
         mkdir soundfiles
         chown user_name soundfiles \newline
    
    'user_name' here is your login or username.

    You can organize your directories as above, but beware permissions and usernames.

NOTE: Above directions also work for portable USB hard drives.

© Copyright 2001-2022 CCRMA, Stanford University. All rights reserved.
Created and Mantained by Juan Reyes