본문 바로가기
RaspberryPi

ftp 서버와 외장하드(usb 포함) 마운트 방법

by 미사사 고라쿠 2017. 12. 27.

현재 외장하드, usb 메모리 등을 꽂으면 /media/pi/@@@ 이곳에 자동 마운트 된다.

문제는 user 인 pi 로는 마운트된 곳에 대한 권한이 없어 write가 안된다.
따라서 아래와 같이 한다.
그러면 유저 pi의 권한으로 외장하드에 쓰기가 가능해 진다.


https://www.raspberrypi.org/forums/viewtopic.php?t=56149#



How-To: Raspberry Pi media SERVER (easy)

Fri Sep 20, 2013 8:59 pm

In this tutorial I will attempt to explain how to turn your Raspberry Pi in a media SERVER to stream media to your home network or even remote network.

This setup will allow the following:
  • -> Stream movies/photo's/music TO your home network and remote network.
    -> Stream to any device (PC/laptop/XBMC/WD Live/Popcorn/Android/...)
    -> SRT support for movies
    -> HD support
    -> Using samba share and FTP share methods
You will need:
  • -> Raspberry Pi with the latest Raspbian image installed http://www.raspberrypi.org/downloads
    -> internet connection to your PI
    -> External USB HDD with media content (ordered in seperate folders)
    -> Another device to stream the content to such as a laptop,media box, ...[/url]
Let's get started

You can use SSH to acces your terminal on the RPI from another device or use the terminal on the device itself by using a monitor/keyboard with the RPI.
In your terminal type the following:

Update your Repo's

Code: Select all

sudo apt-get update
If you are going to use a NTFS based external hard drive (most are) (TIP: ext4 file systems are the fastest)

Code: Select all

sudo apt-get install ntfs-3g
Now insert your usb hard drive in the RPI and wait untill it gets mounted. If it's mounted type the following

Code: Select all

sudo df
A list of installed hard drives will appear. Write down your external HD's location. Mine was /dev/sda1. Type the following commands. (You might want to CHMOD your HDD folder permissions if you get permission errors later)

Code: Select all

cd /media
sudo mkdir HDD
sudo nano /etc/fstab
A file will open, on the bottom of the file type the following and then exit and save the file (ctrl+x, Y, enter, enter). Remember to replace /dev/sda1 with your HDD location. Also replace ntfs-3g with vfat if your have a fat based HDD or ext4 for a ext4 filesystem. Whitespaces are TABS

Code: Select all

/dev/sda1         /media/HDD       ntfs-3g     defaults,noatime      0        0
Back in terminal, type these commands

Code: Select all

sudo umount /dev/sda1
sudo mount /dev/sda1
Your external Hard drive should now always be mounted in the folder HDD. So far so good, now lets install samba and vsftpd.

Code: Select all

sudo apt-get install samba samba-common-bin
sudo apt-get install vsftpd
sudo apt-get install hdparm
sudo hdparm -S 240 /dev/sda1 ##DO THIS onLY if you want to spindown your external hard drive when it's inactive for 20min,