Skip to content

mount USB thumbdrive or disk at boot time

2013/04/13

The tricky thing is that the external usb-drive or usb-stick may get different /dev/sd? id when plugged off and on. That is why they have to be mounted in the fstab via there uuid.

Look up the uuids:

ls -laF /dev/disk/by-uuid 

and

fdisk -l | grep /dev/

should show enough info to identify the correct uuids

root@raspberrypi:/tmp# ls -laF /dev/disk/by-uuid
 total 0
 drwxr-xr-x 2 root root 140 Jan  1  1970 ./
 drwxr-xr-x 6 root root 120 Jan  1  1970 ../
 lrwxrwxrwx 1 root root  10 Jan  1  1970 324843ED4843AE83 -> ../../sdb1
 lrwxrwxrwx 1 root root  10 Jan  1  1970 38A8-6016 -> ../../sda1
 lrwxrwxrwx 1 root root  15 Apr 13 14:17 62ba9ec9-47d9-4421-aaee-71dd6c0f3707 -> ../../mmcblk0p2
 lrwxrwxrwx 1 root root   9 Jan  1  1970 6C96-E1A0 -> ../../sdc
 lrwxrwxrwx 1 root root  15 Jan  1  1970 C522-EA52 -> ../../mmcblk0p1

root@raspberrypi:/tmp# fdisk -l | grep /dev/
 Disk /dev/mmcblk0: 8018 MB, 8018460672 bytes
 /dev/mmcblk0p1            8192      122879       57344    c  W95 FAT32 (LBA)
 /dev/mmcblk0p2          122880    15661055     7769088   83  Linux
 Disk /dev/sda: 1038 MB, 1038614528 bytes
 /dev/sda1   *          63     2024189     1012063+   b  W95 FAT32
 /dev/sda2         2024190     2024252          31+  21  Unknown
 Disk /dev/sdb: 2000.4 GB, 2000396746752 bytes
 /dev/sdb1            2048  3907024895  1953511424    7  HPFS/NTFS/exFAT
 ...
root@raspberrypi:/tmp#

the 1 gig usb stick is /dev/sda and has uuid 38A8-6016, the 2tb disk is 324843ED4843AE83

enter them into the fstab ( sudo nano /etc/fstab )

proc   /proc proc defaults  0 0
/dev/mmcblk0p1  /boot vfat defaults  0 2
/dev/mmcblk0p2  /     ext4 defaults,noatime  0 1
UUID=38A8-6016 /mnt/thumb1gb  vfat  auto,users,rw,flush,utf8=1  0 3
UUID=324843ED4843AE83  /mnt/usbdsk2t ntfs-3 auto,users,rw,flush,utf8=1  0 4

create the directories where the disk have to be mounted. Set permissions on that directories.

Manually test the entries by mounting manually

mount -a

if it fails with unknown type “ntfs-3g” then use

apt-get install ntfs-3g

Advertisements

From → RaspberryPi

Leave a Comment

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

%d bloggers like this: