Steps followed for Ubuntu server

Simple Mount

  • One time creation of mount point
    • sudo mkdir /media/usb_drive1
  • Check device assignment using
    • fdisk -l
    • Typically you may get something like /dev/sdc1 as the new USB drive
  • Assuming the USB drive is NTFS, Mount NTFS USB drive using the command:
    • ntfs-3g /dev/sdc1 /media/usb_drive1
  • Assuming the USB drive is FAT32:
    • mount -t vfat /dev/sdc1 /media/usb_drive1
  • Assuming the USB drive is ext4:
    • mount /dev/sdc1 /media/usb_drive1
  • To use drive
    • cd /media/usb_drive1
  • To remove (unmount) USB do an
    • eject /media/usb_drive1
    • or
    • eject /dev/sdc1

Permanently mount the USB drive

  • Use gparted (GUI)
    • To format new USB drive as ext4
    • Label the drive
  • Create a mount location
    • mkdir /media/usb_drive1
  • Confirm Block Device assignment
    • fdisk -l
    • In this example the drive is sdc1
  • Mount
    • mount /dev/sdc1 /media/usb_drive1
  • Change Onweership as required (from root to someone else who needs to access, such as backuppc)
    • chown -R someuser:someuser /media/usb_drive1
  • chmod as required as well
    • e.g. chmod 700 /media/usb_drive1/backuppc123/
  • check drive
    • ls -l /media/usb_drive1
  • Issue command to get the UUID of the USB drive
    • blkid 
  • Make fstab entry as
    • UUID=c7b5556e-f814-40fa-a97d-2ac3b78626d6 /media/usb_drive1 ext4  defaults        0       2
  • Reboot to make sure the drive auto mounts

Format USB drive

  • To format with a cluster size of 32768
  • Use the -f, –fast, -Q, –quick to avoid zeroing out sectors which can take several hours
    • mkntfs -c 32768 /dev/sdc1
  • Change disk type to NTFS with fdisk
    • fdisk /dev/sdc
      • In fdisk, enter: t - type, 1 - first partition, 7 - ntfs, w - write to disk
  • Verify
    • fdisk -l /dev/sdc


Other Info

Use command dmesg to check log on usb drive insertion

lsusb to list usb devices

QR Code
QR Code tech:others:mounting_usb_drive_in_ubuntu (generated for current page)