BrianOBrien
Posts: 9
Joined: Sat Apr 09, 2016 7:55 pm

About External USB Drives

Wed Nov 16, 2016 3:48 am

I have an external USB 3.0 portable drive. 500Gig. Partitioned as one volume xfat.

I managed to mount it on my Raspberry Pi 2.
I had to use a powered USB hub and install some extra software for exfat

Code: Select all

sudo apt-get install exfat-fuse exfat-util
did all my updates etc.

When connected with a keyboard, mouse and monitor, this pi boots into a GUI.
When the drive is connected by USB a dialog box pops up in this GUI and asks if you want to associate the drive with the filefinder..

So I accept that dialog and I get have a new device in /media/pi.
Great.

Normally I don't run the pi with keyboard, mouse and screen.. I normally ssh into it and launch apps using X11.

I decided I wanted the disk to remount automatically on reboot.
So I tried to mount the disk in fstab. (so that I could bypass that dialog box and run headless with the drive mounted.)

Code: Select all

pi@raspberrypi:~ $ sudo fdisk -l
Device      Start       End   Sectors   Size Type
/dev/sda1      40    409639    409600   200M EFI System
/dev/sda2  411648 976771071 976359424 465.6G Microsoft basic data

Code: Select all

pi@raspberrypi:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/sda2       466G   25M  466G   1% /media/pi/RaspberryDi
I added this to /etc/fstab

Code: Select all

/dev/sda2       /media/pi/bob   exfat   default
I saved the file and then rebooted.
System was hung for quite some time and eventually I was able to login.

I create the /media/pi/bob folder and tried again.. Still .. no luck.

So a few thing. The drive was formatted xfat.
1) I don't mind reformatting the drive and partitioning it what format might have been better?
2) I think I can boot from this device can't I? If so how would I xfer my OS from memory card to a boot partition?

I'd love to learn how to do all this without having to leave the shell.

User avatar
PeterO
Posts: 4749
Joined: Sun Jul 22, 2012 4:14 pm

Re: About External USB Drives

Wed Nov 16, 2016 7:56 am

BrianOBrien wrote: So a few thing. The drive was formatted xfat.
1) I don't mind reformatting the drive and partitioning it what format might have been better?
2) I think I can boot from this device can't I? If so how would I xfer my OS from memory card to a boot partition?
I'd love to learn how to do all this without having to leave the shell.
1) You'll generally have less problems using a Linux native file system (such as ext4) as they will have had far more use and hence more bugs will have been removed.
2) I've had success with booting from some Seagate drives by following these instructions : https://www.raspberrypi.org/documentati ... des/msd.md but I believe it's still classed as "experimental" so YMMV.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

gkreidl
Posts: 5955
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: About External USB Drives

Wed Nov 16, 2016 9:16 am

Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

BrianOBrien
Posts: 9
Joined: Sat Apr 09, 2016 7:55 pm

Re: About External USB Drives

Thu Nov 17, 2016 12:35 am

PeterO wrote:
BrianOBrien wrote: So a few thing. The drive was formatted xfat.
1) I don't mind reformatting the drive and partitioning it what format might have been better?
2) I think I can boot from this device can't I? If so how would I xfer my OS from memory card to a boot partition?
I'd love to learn how to do all this without having to leave the shell.
1) You'll generally have less problems using a Linux native file system (such as ext4) as they will have had far more use and hence more bugs will have been removed.
2) I've had success with booting from some Seagate drives by following these instructions : https://www.raspberrypi.org/documentati ... des/msd.md but I believe it's still classed as "experimental" so YMMV.

PeterO
Now that it's mounted can't i repartition it and format it?
If so, how?

tweak42
Posts: 496
Joined: Tue Mar 22, 2016 3:16 am
Location: Los Angeles, California

Re: About External USB Drives

Thu Nov 17, 2016 2:58 am

BrianOBrien wrote: Now that it's mounted can't i repartition it and format it?
If so, how?
In linux you don't repartition and format a drive while it's mounted. I normally use gparted to do partitioning and formatting. Gparted is a GUI version of the terminal program parted.

NorseStars
Posts: 1
Joined: Thu Feb 16, 2017 11:37 am

Re: About External USB Drives

Fri Feb 17, 2017 4:33 pm

PeterO wrote: I've had success with booting from some Seagate drives by following these instructions : https://www.raspberrypi.org/documentati ... des/msd.md but I believe it's still classed as "experimental" so YMMV.
PeterO
I am trying to get this to work with a WD external drive. The installation appears to go well, but after reboot, nothing happens unless I put the SD card back into the Pi before reboot. When rebooted with the SD card in place the /mnt/target drive is visible but the /mnt/target/boot drive is not. I am going to try again this morning with a clean Jessie install.

If anyone has had success with WD external drives, mine is a 250GB, please advise.

Willie

jahboater
Posts: 4477
Joined: Wed Feb 04, 2015 6:38 pm

Re: About External USB Drives

Fri Feb 17, 2017 4:54 pm

BrianOBrien wrote: Now that it's mounted can't i repartition it and format it?
If so, how?
You should unmount it first with umount (see man umount for details).

User avatar
DougieLawson
Posts: 35381
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: About External USB Drives

Fri Feb 17, 2017 5:15 pm

NorseStars wrote: I am trying to get this to work with a WD external drive. The installation appears to go well, but after reboot, nothing happens unless I put the SD card back into the Pi before reboot. When rebooted with the SD card in place the /mnt/target drive is visible but the /mnt/target/boot drive is not. I am going to try again this morning with a clean Jessie install.
I've got two RPi3Bs with 375GB WD drives that work perfectly booting from the HD.

config.txt

Code: Select all

dtparam=audio=on
dtparam=spi=on
dtparam=i2c_arm=on
cmdline.txt

Code: Select all

dwc_otg.lpm_enable=0 console=tty1 root=/dev/sda6 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait  quiet splash plymouth.ignore-serial-consoles
The last time they booted with an SDCard was to get the sudo rpi-update firmware running with

Code: Select all

program_usb_boot_mode=1
as an extra line in config.txt

Everything from /boot is in a small FAT partition on the HDD

Code: Select all

root@intrepid:~ # fdisk -l /dev/sda

Disk /dev/sda: 349.3 GiB, 375049420800 bytes, 732518400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x02532899

Device     Boot    Start       End   Sectors   Size Id Type
/dev/sda1           8192    137215    129024    63M  e W95 FAT16 (LBA)
/dev/sda2         137216 732518399 732381184 349.2G  5 Extended
/dev/sda5         139264    204797     65534    32M 83 Linux
/dev/sda6         204800  16584703  16379904   7.8G 83 Linux
/dev/sda7       16586752 732518399 715931648 341.4G 83 Linux
/etc/fstab has

Code: Select all

proc /proc proc defaults 0 0
UUID=A3D1-68F2 /boot vfat defaults 0 2
UUID=443559ba-b80f-4fb6-99d9-ddbcd6138fbd
UUID=9a9ffb1b-8a51-4678-9f56-1a89f7977e78 / ext4 defaults,noatime 0 1
which was created by running blkid

Code: Select all

root@intrepid:~ # blkid
/dev/sda1: SEC_TYPE="msdos" LABEL="RECOVERY" UUID="A3D1-68F2" TYPE="vfat" PARTUUID="02532899-01"
/dev/sda5: LABEL="unused" UUID="b51c0b20-af07-48b3-9258-424331c2f029" TYPE="ext4" PARTUUID="02532899-05"
/dev/sda6: LABEL="root" UUID="9a9ffb1b-8a51-4678-9f56-1a89f7977e78" TYPE="ext4" PARTUUID="02532899-06"
/dev/sda7: LABEL="data" UUID="0a3ec731-2faa-4f28-8548-f435b0b585c7" TYPE="ext4" PARTUUID="02532899-07"
root@intrepid:~ #
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Beginners”