라즈베리 Plex Media 서버로 변신2


date: 2017-10-18 23:48:35 +0900
categories:   라즈베리,Raspberry, plex media server

samba 설치

참고1 - How to Turn a Raspberry Pi into a Low-Power Network Storage Device
참고2 - 새로운 삼바사용자 생성과 패스워드 설정하기

#설치
pi@Borilikeharry:~ $ sudo apt-get install samba samba-common-bin
#기본 설정 백업
pi@Borilikeharry:~ $ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
pi@Borilikeharry:~ $ ls -al /etc/samba/smb*
-rw-r--r-- 1 root root 9231 11월  2 03:12 /etc/samba/smb.conf
-rw-r--r-- 1 root root 9231 11월  4 08:58 /etc/samba/smb.conf.old

#공유 디렉토리 설정
pi@Borilikeharry:~ $ sudo nano /etc/samba/smb.conf
pi@Borilikeharry:~ $ sudo vi  /etc/samba/smb.conf

#smb 재기동
pi@Borilikeharry:~ $ sudo /etc/init.d/samba restart
[ ok ] Restarting nmbd (via systemctl): nmbd.service.
[ ok ] Restarting smbd (via systemctl): smbd.service.

#smb 전용 user 생성/등록
pi@Borilikeharry:~ $ sudo useradd finetree2 -m -G users
pi@Borilikeharry:~ $ sudo passwd finetree2
새 UNIX 암호 입력:
새 UNIX 암호 재입력:
passwd: 암호를 성공적으로 업데이트했습니다
pi@Borilikeharry:~ $ sudo smbpasswd finetree2  /* smb passwd file 등록*/
New SMB password:
Retype new SMB password:
Failed to find entry for user finetree2.

*** 여기서 잠깐 한글 입력기 바람을 쭈우 써오다가 Atom 편집기를 쓸때 한글전환 및 입력이 안되는 현상 발생
바람입력기 제거 하고 맥오에스 제공하는 기본 입력기로 변경 - 잘되고 capslock 키로 간단히 변환할 수 있게되어 편함 참고 - macOS 시에라 Caps Lock 키를 이용해 한글/영어 입력기 전환 가능

RPi2에 smbclient 설치
# 설치
pi@boriliketree:/media/usbhdd1/shares $ sudo apt-get install smbclient cifs-utils

# smb 디렉토리 확인
pi@boriliketree:/media/usbhdd1/shares $ smbclient -L 172.30.1.26 -U%
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.5.12-Debian]

	Sharename       Type      Comment
	---------       ----      -------
	print$          Disk      Printer Drivers
	Finetree2       Disk      Share Folder
	IPC$            IPC       IPC Service (Samba 4.5.12-Debian)
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.5.12-Debian]

	Server               Comment
	---------            -------
	BORILIKEHARRY        Samba 4.5.12-Debian
	BORILIKETREE         Samba 4.2.14-Debian

	Workgroup            Master
	---------            -------
	WORKGROUP            BORILIKEHARRY

pi@boriliketree:/media/usbhdd1/shares $sudo mount -t cifs  //172.30.1.26/Finetree2 /media/usbhdd1/smbsvr -o user=finetree2,pass=skhs1107\!,iocharset=utf8

  • ilink bad block으로 입출력 오류 지속 발생 --> 일단 32G USB로 대체
  • 카페에서 hadless machine type으로 다운받으려고 외장하드 대신 USB 사용
  • 네트워크 속도 제한(? 추정원인)으로 다운로드에 지속적으로 실패함
  • 집에서 외장하드 대신 USB 32G 킹스맨 다운에 성공 삼바 마운트된 디렉토리에 자동 이동(downloading -> completed)은 실패
#usb 32g mount
pi@boriliketree:~ $ sudo mount -t ntfs-3g /dev/sda1 /media/usbhdd1/
Mount is denied because the NTFS volume is already exclusively opened.
The volume may be already mounted, or another software may use it which
could be identified for example by the help of the 'fuser' command.
pi@boriliketree:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.1G  6.3G  496M  93% /
devtmpfs        481M     0  481M   0% /dev
tmpfs           486M     0  486M   0% /dev/shm
tmpfs           486M  6.8M  479M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           486M     0  486M   0% /sys/fs/cgroup
/dev/mmcblk0p1   63M   21M   42M  34% /boot
tmpfs            98M     0   98M   0% /run/user/1000
/dev/sda1        30G  2.1G   28G   7% /media/pi/LIB1
pi@boriliketree:~ $ sudo umount /media/pi/LIB1
pi@boriliketree:~ $ sudo mount -t ntfs-3g /dev/sda1 /media/usbhdd1/
pi@boriliketree:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.1G  6.3G  496M  93% /
devtmpfs        481M     0  481M   0% /dev
tmpfs           486M     0  486M   0% /dev/shm
tmpfs           486M  6.8M  479M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           486M     0  486M   0% /sys/fs/cgroup
/dev/mmcblk0p1   63M   21M   42M  34% /boot
tmpfs            98M     0   98M   0% /run/user/1000
/dev/sda1        30G  2.1G   28G   7% /media/usbhdd1
pi@boriliketree:/media/usbhdd1 $ mkdir shares
pi@boriliketree:/media/usbhdd1 $ ls -al
합계 9
drwxrwxrwx 1 root root 4096 11월  5 03:18 .
drwxr-xr-x 5 root root 4096 11월  4 20:13 ..
drwxrwxrwx 1 root root    0 10월 29 08:39 System Volume Information
drwxrwxrwx 1 root root    0 10월 29 08:45 completed
drwxrwxrwx 1 root root    0 10월 29 17:20 downloading
drwxrwxrwx 1 root root    0 11월  5 03:18 shares
-rwxrwxrwx 1 root root   15 10월 29 08:44 test
drwxrwxrwx 1 root root    0 10월 29 08:46 torrent-backup
drwxrwxrwx 1 root root    0 10월 29 08:45 watch
pi@boriliketree:/media/usbhdd1 $ mv completed/ ./shares/
pi@boriliketree:/media/usbhdd1 $ mv downloading/ ./shares/
pi@boriliketree:/media/usbhdd1 $ mv watch  ./shares/
pi@boriliketree:/media/usbhdd1 $ mv torrent-backup/ ./shares/
pi@boriliketree:/media/usbhdd1 $ ls -al
합계 9
drwxrwxrwx 1 root root 4096 11월  5 03:19 .
drwxr-xr-x 5 root root 4096 11월  4 20:13 ..
drwxrwxrwx 1 root root    0 10월 29 08:39 System Volume Information
drwxrwxrwx 1 root root  464 11월  5 03:19 shares
-rwxrwxrwx 1 root root   15 10월 29 08:44 test

# 자동이동 실패로 강제 이동을 위해 mv 명령어 실행 --> 아래와 같은 오류 발생
pi@boriliketree:/media/usbhdd1/shares $ sudo mv  ./downloading/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/ ./completed
mv: failed to preserve ownership for `./completed/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG.mp4': 허가 거부
mv: failed to preserve ownership for `./completed/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/Subs/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG.sub': 허가 거부
mv: failed to preserve ownership for `./completed/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/Subs/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG.idx': 허가 거부
mv: failed to preserve ownership for `./completed/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/Subs/Forced.srt': 허가 거부
mv: failed to preserve ownership for `./completed/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/Subs/Full.srt': 허가 거부
mv: failed to preserve ownership for `./completed/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/Subs': 허가 거부
mv: failed to preserve ownership for `./completed/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/RARBG.COM.mp4': 허가 거부
mv: failed to preserve ownership for `./completed/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/RARBG.COM.txt': 허가 거부
mv: failed to preserve ownership for `./completed/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG.nfo': 허가 거부
mv: failed to preserve ownership for `./completed/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG': 허가 거부
mv: cannot remove `./downloading/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG.mp4': 입력/출력 오류
mv: cannot remove `./downloading/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG.nfo': 입력/출력 오류
mv: cannot remove `./downloading/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/RARBG.COM.mp4': 입력/출력 오류
mv: cannot remove `./downloading/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/RARBG.COM.txt': 입력/출력 오류
mv: cannot remove `./downloading/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/Subs/Forced.srt': 입력/출력 오류
mv: cannot remove `./downloading/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/Subs/Full.srt': 입력/출력 오류
mv: cannot remove `./downloading/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/Subs/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG.idx': 입력/출력 오류
mv: cannot remove `./downloading/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/Subs/Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG.sub': 입력/출력 오류

pi@Borilikeharry:/media/usbhdd1/Movies $ sudo ls -al Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG/
합계 1633201
drwx------ 1 finetree2 users        480 11월  5 03:23 .
drwxrwxrwx 1 plex      root       69632 11월  5 04:09 ..
-rwx------ 1 finetree2 users 1671292639 11월  5 03:46 Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG.mp4
-rwx------ 1 finetree2 users       8397 11월  5 03:23 Kingsman.The.Secret.Service.2014.UNCUT.720p.BluRay.H264.AAC-RARBG.nfo
-rwx------ 1 finetree2 users    1016764 11월  5 03:23 RARBG.COM.mp4
-rwx------ 1 finetree2 users         34 11월  5 03:22 RARBG.COM.txt
drwx------ 1 finetree2 users        600 11월  5 03:22 Subs

igotoo

igotoo