sudo fdisk -l
My usb-storage is displayed as /dev/sda1 and the filesystem is FAT32, but if your usb-storage has
filesystem NTFS 3g you will need to install the package ntfs-3g:
sudo apt-get install ntfs-3g
Linux need to mount the usb-storage in order to access the folders and files on it.
The contents of the usb-storage will appear as a folder in /media. You can mount disks in other folders, but it's conventional to use /media. You need to create a directory where the mounted disk will appear in the media directory:
sudo mkdir /media/usbhdd
Change ownership of usb-storage to pi:
sudo chown pi:pi /media/usbhdd
Mount the usb-storage via:
sudo mount -t vfat -o uid=pi,gid=pi /dev/sda1 /media/usbhdd
The '-t vfat' tells the mount command that your drive has a fat32 file system. If your drive is formatted with NTFS, you should use '-t ntfs-3g' instead.
The '-o uid=pi,gid=pi' part of the command means that the disk will be owned by user pi.
You can use this command to unmount the disk:
sudo umount /media/usbhdd
Now you need to edit the file system table so that this disk is mounted every time your Raspberry Pi starts up:
sudo leafpad /etc/fstab &
You need to use sudo because the fstab file is owned by root. If you don't use sudo, you'll be able to open the file in leafpad, but you won't be able to save changes. The '&' means the command runs in the background, and you can keep using the terminal for other commands while leafpad is running. You should see something like this:
proc /proc proc defaults 0 0 /dev/mmcblk0p1 /boot vfat defaults 0 2 /dev/mmcblk0p2 / ext4 defaults,noatime 0 1
Add the following line, and save the file:
/dev/sda1 /media/usbhdd vfat uid=pi,gid=pi 0 0
Reboot your Pi via
sudo reboot
and you should be able to access your USB-storage via /media/usbhdd.