[USB] Auto Mounting of Thumb Drive

Hard Coded Method – fstab file

Files to modify:
/etc/fstab

Template:

# device-spec   mount-point     fs-type      options     dump pass
proc /proc proc defaults 0 0
/dev/mmcblk0p6 /boot vfat defaults 0 2
/dev/mmcblk0p7 / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
UUID=BCF3-B0C0 /media/pi/TRANSCEND vfat defaults 0 0

Remarks:

  • The thumbdrive is identified by its UUID.
  • UUID can be found using any of the following commands:
    > sudo blkid (block device)
    > ls -l /dev/disk/by-uuid (list the symlinks)
  • using defualts options, the system will not boot up properly if the USB is not available at boot. To solve this, change defualts to
    auto,rw,nofail

    and mutually trigger the mount using

    > mount -a

    Note: It appears that fstab is automatically called even without mount -a, when USB is inserted.

Useful Commands

Checking

Inserted
> lsusb (list USB device)
Mounted
> lsblk (list all available block devices)

Unmount

> umount /dev/sda1

Timestamp Offset Issue

Please refer to [Debian Bug] FAT32 Timestamp Offset Issue

Generic Auto-Mounting

TODO

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s