'Gen1'에 해당되는 글 1건

  1. 2019.10.07 WD My Cloud Gen1 (miniDLNA, transmission 설치)

WD My Cloud Gen1 (miniDLNA, transmission 설치)

Posted by TheFanStory IT : 2019. 10. 7. 17:10

WD My Cloud Gen1 에 v4 순정 펌웨어 위에 chroot 를 설치 , chroot 상에 miniDLNA, transmission 을 올려서 기존 WD My Cloud 의 기능을 보완하는 내용을 설명한다.

 

이 방식의 장점은 기존 WD My Cloud 의 모든 기능을 그대로 사용 가능하며,  clean linux ( debian jessie ) 나 Synology DSM 5.2 를 올렸을때 발생하는 SMB 네트워크 속도 저하 문제가 없다.

 

 

 

WD Community 의  러시아 유저 Fox_exe 가 만든 repository 를 활용하는 방법으로

영어 원문의 내용을 한글로 정리한 것이다.

불필요한 설명 없이 원문을 보고 설치할 분은 아래 링크로 가서 다운받고 설명대로 진행해도 동일한 결과를 얻을 수 있다.

https://drive.google.com/drive/folders/0B_6OlQ_H0PxVRXF4aFpYS2dzMEE

ㄴ WDMyCloud-Gen1

ㄴ Chroot

ㄴ Info_EN.txt

 

 

 

 

 

* 모든 내용은 반드시 WD My Cloud Gen1 , v4 버전의 펌웨어에서 진행해야한다

 

Repository with software worked on v4 firmware
https://community.wd.com/t/repository-with-software-worked-on-v4-firmware/94532 )

 

* WD My Cloud 의  최신 펌웨어는 아래 링크에서 다운로드 받을 수 있다.

https://support-en.wd.com/app/products/product-detail/p/126#WD_downloads
Downloads -> SOFTWARE FOR GPL/FIRMWARE -> Current Firmware-Firmware release 04.xx.xx-xxx -> 최신펌웨어

 

* 구버전 펌웨어는 아래 링크에서 다운로드 받을 수 있다.

https://community.wd.com/t/wd-my-cloud-v3-x-v4-x-and-v2-x-firmware-versions-download-links/148533

 

 


Fox_exe repository 관련한 모든 자료는 아래에서 다운로드 받을 수 있다
http://anionix.ddns.net/WDMyCloud/   
https://drive.google.com/drive/folders/0B_6OlQ_H0PxVRXF4aFpYS2dzMEE    ( Google drive , mirror )

( 위 두개의 링크는 동일한 내용이며 anionix 가 원본,  google drive 가 mirror 이므로  되도록이면 google drive 를 이용하자 )

 

 

 



Nov '14 by Fox_exe   
WARNING: This software only for WDMyCloud 1nd generation official v4 firmware (Kernel/Software with PageSize=64k)!

 

이 글은  2014 년 Fox_exe 에 의해 최초 작성, 공개된  WDMyCloud Gen1 firmware v4 용 software  Repository 사용법과 prasadasokan  의 댓글 참조하여 작성됨.

 

 

 



ㅇ Connect via SSH and install Chroot env:

 

SSH로 접속 후 Chroot 를 설치하기 위해 아래 커맨드들을 실행

 

SSH 접속을 하기 위해서는 WD My Cloud 제어판에서 SSH 접속을 활성화해야하며,

접속 id와  암호는 root / welc0me 이다.

(0 는 영문자 O 가 아니라 숫자 0 이다 )

 

최초 로그인을 하면 새로운 root password 를 지정해주어야한다.

 

 

 

SSH 접속 터미널 프로그램은 PUTTY 를 추천한다.

아래 명령어들은 그냥 copy & paster 하면 된다.

 


1. Download chroot

wget http://anionix.ddns.net/WDMyCloud/WDMyCloud-Gen1/Chroot/chroot-j64k.sh  

또는

wget http://anionix.ddns.net/WDMyCloud/WDMyCloud-Gen1/Chroot/chroot-jessie-64k_fix_v1.sh  

mv chroot-jessie-64k_fix_v1.sh chroot-j64k.sh

 

* google drive 의 WDMyCloud > WDMyCloud-Gen1 > Chroot 폴더에  2019년 6월 26일자로 chroot-jessie-64k_fix_v1.sh 가 올라와있는데 무언가 좀 더 나은 수정사항이 반영되어있을것으로 기대하고 분문은 이것을 다운로드 받아서 chroot-j64k 로 변경해서 사용했다. 위 wget 에서 chroot-j64k.sh 파일명만 변경해서 사용하면 된다. 별다른 에러는 없었으며  chroot-jessie-64k_fix_v1.sh 에 대한 추가적인 설명 내용은 찾지 못했다.

 


1-1.  파일에 실행 권한 부여

chmod a+x chroot-j64k.sh  

 

 


2. Install chroot

./chroot-j64k.sh install 

 


After this you can go inside chroot and install any of available software.
위 작업을 한 후 chroot 로 소프트웨어 설치 가능



3. Enable Autostart and mount proc etc

chroot 설치, 마운트 작업.

/DataVolume/debian/chroot_debian.sh install 
cd /DataVolume/debian 
mount -t proc proc proc/ 
mount -t sysfs sys sys/ 
mount -o bind /dev dev/ 

 

 

 

 

(주 - 원래 4 다음 4-1 설명이 나오지만  chroot 하기 전에 resolv.conf 파일을 복사해두어야하므로 순서를 변경함 )


4-1. To update anything I had to do this to get DNS servers (at system, not chroot):

cp /etc/resolv.conf /DataVolume/debian/etc/ 


( 4-1 을 안하면 5 를 작업하기 전에 재부팅 필요.  그래도 package upgrade 가 안되면 WD My Cloud 를 한번 재부팅한 후  ssh 접속 -> chroot 후  5. 번 진행  )


Chroot:~# cat /etc/resolv.conf 
nameserver 203.248.252.2 
nameserver 164.124.101.2 

 

(주 - nameserver 는 kt , lg , 등 사용하는 dns 에 따라 나오는 값이 다를 수 있음 )

 

 

 

 


4. Enter into chroot
프로그램 설치 전에 chroot 

chroot /DataVolume/debian /bin/bash 

 

 




5. Upgrade packages
(apt-get 에서 주소를 가져오지못하는 오류가 발생할 경우 4-1 을 빼먹지 않았나 다시 확인. )

apt-get update && apt-get upgrade 









* Current software list ( http://anionix.ddns.net/dists/jessie-64k/ )

현재 repository 의 주요 package 현황
---------------------------------------------------------------------
Transmission-daemon
MC (Midnight Commander)
MiniDLNA
Openssh-server + client
Samba v3.6.6
rSync
pyLoad (Download manager)
Aria2
Python
Perl
Corosyncapt-
Apache2
PHP5 (Curl, GD, MCrypt)
MySQL 5.5 Server & Client
ffmpeg
Pacemaker
HTop
Locales
Build-essential && Patched binutils
Base system & all base tools (For make chroot or build system from scratch)
----------------------------------------------------------------------------------

ㅇ List available apps: 

Fox_exe repository 포함된  모든 package 리스트를 출력

apt-cache dumpavail | grep Package 

 

 

 

 

 

* chroot 설치가 완료되면 아래 앱들을 설치하기 전에  재부팅을 한번 해야한다.

그렇지않으면 chroot 에서 /mnt 폴더에 /DataVolume 이 마운트 되지 않아 transmission 설정등을 마무리 할 수 없다.

 


* Chroot control script (For start/stop/install/uninstall): 

모든 작업은 반드시 chroot 상태에서 진행해야한다

/DataVolume/debian/chroot_debian.sh




 


A. Transmission: 
트랜스미션 

 

 

 

Inside chroot:
(chroot 상태에서 실행한다   )

chroot /DataVolume/debian /bin/bash 







a1. Install Transmission

트랜스미션 설치

apt-get install transmission-daemon 






a2. Start Transmission
정상적으로 설치 완료되고 실행중인지 체크.  (설치하자마자 실행됨)

/etc/init.d/transmission-daemon status 

( If you are seeing permission denied errors, edit user to root in file /etc/init.d/transmission-daemon ) 

transmission 실행중 에러가 나면 /etc/init.d/transmission-daemon  파일에서 실행 권한을 root 로 변경해야한다.

실행시 에러가 나지 않아도 어차피 파일, 폴더 권한 문제때문에 root 로 변경할 것이므로 상관 없다.


모든 transmission  설정을 변경하기 위해서는 반드시 transmisson 을 정지하고 작업해야한다.

/etc/init.d/transmission-daemon stop
/etc/init.d/transmission-daemon start
/etc/init.d/transmission-daemon status



아래에서 선택 1/2 중 하나 진행

 

선택1 ) a3. transmission 실행시 권한 오류 처리를 위해  /mnt 폴더에 transmission 전용으로 모든 권한 허용 폴더 생성 후  setting.json 을 이쪽 폴더도 설정

 

cd /mnt/Public

mkdir torrent

mkdir -p torrent/done

mkdir -p torrent/seed

mkdir -p torrent/incomplete

chown -R nobody:1000 torrent

chmod -R 777 torrent

 


선택2 ) a3. transmission 실행시 권한 오류 처리를 위해 transmission 실행 계정을  root 로 변경 ( transmission-daemon 수정 )

기본적으로 transmission은 chroot 상에서 debian-transmission 계정으로 실행되는데 이경우 권한때문에 공유 폴더에서 자유로운 폴더/파일 복사/이동이 여려워져 모두 root 로 변경한다.

nano /etc/init.d/transmission-daemon 


실행해서 보면
USER=debian-transmission 부분을 USER=root로 변경합니다.
저장하고 나옵니다.

USER=root



트랜스 미션 관련 파일,폴더 권한 변경

chown root:root /etc/transmission-daemon/settings.json 
chown root:root /etc/init.d/transmission-daemon 
chown -R root:root /var/lib/transmission-daemon/info 
chown root:root /var/lib/transmission-daemon/downloads 
chown :root /etc/transmission-daemon 







a4.    modify settings.json

transmission setting 파일 수정

nano /etc/transmission-daemon/settings.json 



* 각자 취향에 따른 토렌트 폴더경로가 다르므로 해당 내용은 개인에 맞게 변경해서 사용한다.

chroot 에는  /mnt 에 파티션4 (데이타 파티션) 가 올라와 있다.


여기에서는 /mnt/Public/torrent 밑에 아래와 같이 구성하였다.

 

/mnt/Public/torrent

ㄴ done    <- 다운로드가 완료된 토렌트 파일 

ㄴ seed     <- .torrent 파일 

ㄴ incomplete   <- 다운로드가 진행중인 토렌트 파일 

 

/mnt/Public/torrent/done
/mnt/Public/torrent/seed
/mnt/Public/torrent/incomplete

 

위 세줄을 자신이 질세로 쓰는 폴더로 변경하고  아래 settings.json 을 수정할때 " " 안의 내용을 바꿔서 사용



a3.1. transmission 접속시 id / pw 입력 생략


Disable the dashboard login -> rpc-authentication-required 를  false 로 수정한다.
Disable the RPC whitelist so you can access the Transmission GUI -> rpc-whitelist-enabled 항목을 모두 false 로 수정한다.

"rpc-authentication-required": false, 
"rpc-whitelist-enabled": false, 




커맨드라인상에서 sed 명령어로 settings.json 을 바꿀 수도 있다. 

sed -i ‘s/“rpc-authentication-required”: true,/“rpc-authentication-required”: false,/g’ /etc/transmission-daemon/settings.json 
sed -i ‘s/“rpc-whitelist-enabled”: true,/“rpc-whitelist-enabled”: false,/g’ /etc/transmission-daemon/settings.json 

* sed 명령이 putty 커맨드창으로 복사가 안되는데 ( ‘s/“ 같은 문자때문인듯 ) 직접 타이핑해서 입력하거나  nano 에디터로 수정한다 
주의 :   -required”: true 같이 : 뒤에 space 가 하나 들어간다. 

sed 의 사용법은 아래와 같다. 
sed 's/찾는문자열/바꿀문자열/g' 입력파일 
( 더 자세한 내용은 https://ggang-tong.tistory.com/entry/sed-%EC%82%AC%EC%9A%A9%EB%B2%95-2 에 아주 잘 정리되어있다 ) 

 

 



a3.2. seed 파일 업로드 폴더 변경

기본 .torrent 파일 업로드 폴더
/var/lib/transmission-daemon/.config/transmission-daemon/torrents/
( = /var/lib/transmission-daemon/info/torrents )

이것을 /mnt/Public/Shared Videos/[0.New]/seeds 로 변경하기 위해서 마지막에 아래 항목을 추가

                                                                                 ,  
    "watch-dir": "/mnt/Public/torrent/seed",  
    "watch-dir-enabled": true 

( 항목 추가시 이전줄 마지막에 "," 를 추가한 후  작업해야하는것을 잊지말자)

 


a3.3. 다운로드가 완료되지 않은 임시 temp 파일 폴더 변경

"incomplete-dir": "/mnt/Public/torrent/incomplete", 
"incomplete-dir-enabled": true, 


a3.4. 다운로드가 완료된후 저장될 최종 downlod 폴더 변경

"download-dir": "/mnt/Public/torrent/done", 

 


a3.5  다운받는 와중에 생긴 폴더 ( 토렌트 파일 자체가 폴더구조인 경우 ) 권한이 777 이 아니라 윈도우에서 파일 관리의 어려움 발생할 경우 해결책

    "umask": 0, 

 



a3.6.  다운로드 완료된 항목을 transmission 에서 삭제


토렌트가 완료되었을때 별도의 스크립트 파일 ( afterDoneToDo.sh ) 을 실행

"script-torrent-done-enabled": true, 
"script-torrent-done-filename": "/etc/transmission-daemon/afterDoneToDo.sh", 

 

 

/etc/transmission-daemon/afterDoneToDo.sh 파일 작성

nano /etc/transmission-daemon/afterDoneToDo.sh

 

내용

#!/bin/sh 

SERVER="9091 --auth id:password" 

TORRENTLIST=`transmission-remote $SERVER --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=" " --fields=1` 

for TORRENTID in $TORRENTLIST 

do 

    echo Processing : $TORRENTID 

    # check if torrent download is completed 
    DL_COMPLETED=`transmission-remote $SERVER --torrent $TORRENTID --info | grep "Done" | grep "100%"` 

    # check torrents current state is 
    STATE_STOPPED=`transmission-remote $SERVER --torrent $TORRENTID --info | grep "State: Seeding\|Stopped\|Finished\|Idle"` 


    # if the torrent is "Stopped", "Finished", or "Idle after downloading 100%" 
    if [ "$DL_COMPLETED" ] && [ "$STATE_STOPPED" ]; then 

        # move the files and remove the torrent from Transmission 
        echo "Torrent #$TORRENTID is completed" 
        echo "Removing torrent from list" 
        transmission-remote $SERVER --torrent $TORRENTID --remove 
    else 
        echo "Torrent #$TORRENTID is not completed. Ignoring." 

    fi 

done

 

 

afterDoneToDo.sh 파일 작성 후 cmd 창에서 아래 명령어 수행  ( 실행권한 부여, 파일 소유자 변경 )

 

chmod +x afterDoneToDo.sh

chown debian-transmission:debian-transmission afterDoneToDo.sh 

 

 

 

※  위 스크립트가 정상 작동 안될 경우 

transmission-remote localhost:9091 --info 

 

를 치면 현재 transmission 에 걸려있는 torrent의 정보가 나오는데

grep 명령어 위 조건식에 맞게  변경하여  afterdone.sh 를 수정해야한다.

 

원래 최초 스크립트를 참고한 사이트에서는 grep "Percent Done: 100%" 라고 되어있었는데 -info 를 볼때 전혀 검색이 되지 않아  완료된 파일들이 삭제가 안되어서 위와 같이 조건을 수정하였다.

 

 

grep 을 사용할때

AND 조건 :  grep 조건1 | grep 조건2 와 같이 파이프를 연속으로 사용할 경우  조건1 AND 조건2 일때 작동.

OR , NOT 조건도 사용할 수 있지만 regular expression 을 써야한다.

 

 

※ DLNA 를 기본  Twonky로 쓸 경우 아무 문제가 없는데 MiniDLNA 로 변경 후 Torrent 작동시 WD My Cloud 가 완전히 다운되는 일이 발생하였다. 

/Shared Video 밑에  토렌트임시폴더가 위치할경우 데이타를 받을때마다 MiniDLNA 가 해당 내용이 동영상인지 체크하는 과정에서 시스템이 죽는 것으로 추정되는데 ,  시드와 임시파일 폴더 위치를 /Shared Video 와 다른 위치로 이동하는것을 권장한다.

 

 

 

 



B. Install MiniDLNA

MiniDLNA 설치

 



Wd My Cloud 에 기본 탑재된 Twonky  DLNA 서버는 버전업이 되면서 자막도 나오고 쓸만해
지기는 개뿔 , 양놈들한테는 충분할지 몰라도 적어로 영어 문화권이 아닌 우리나라에서는 자막 문제때문에 사용하기 곤란하다.

[ LG 지상파 UHD 지원 셋탑 기준 ]
ㅇ .smi 자막 지원 안됨
ㅇ .srt 자막도 지원 안되는게 반 ( 원인도 알수 없이 어떤건 되고 어떤건 안되는게 더 짜증 )
ㅇ 동영상에 자막이 포함된 경우 .srt 자막 인식 안함 ( 역시 어떤건 되고 어떤건 안됨 )
ㅇ 폴더 이동 , 파일명 수정 사항 업데이트 지연 및 자막 추가 미인식, 재스캔시에도 변경 내용 반영 안되는 증상


Twonky  와 함께 해보기 위해 이런 저런 해결책들을 찾아보았지만 

 

결론은 단 하나 ,  MiniDLNA 설치가 답이다.



a. Wd My Cloud 제어판에서 기본 Twonky  DLNA 서버 정지


b. Wd My Cloud 에 MiniDLNA 설치

( Transmission 설치와 마찬가지로 chroot 상태에서 실행한다   )

chroot /DataVolume/debian /bin/bash 
apt-get install minidlna 

minidlna설치가 완료되면 서비스가 자동으로 시작되므로 설정을 변경하기 위해 서비스 정지

service minidlna stop 



c. /etc/minidlna.conf 수정
Transmission 과 달리 별다른 권한수정 없이 설정파일 변경만으로 충분하다.

nano /etc/minidlna.conf 
media_dir=/mnt/Public                    -> 접속 디렉토리 

또는 아래와 같이 Video, Music , Pictures 를 따로 지정해서 설정 가능 
media_dir=V,/mnt/Public/Shared Video       -> Video 만 
media_dir=M,/mnt/Public/Shares Audio        -> Music 만 
media_dir=P,/mnt/Public/Shared Image        -> Pictures 만 
  
friendly_name=minidlna on WD My Cloud  -> 기기표시 이름  ( OPTION ) 
inotify=yes                                       -> 새로고침 여부 확인 ( OPTION  ) 
notify_interval=895                            -> 새로 고침 간격 (second)  ( OPTION ) 
root_container=.                                -> 폴더 보기 방식  ( V,M,P 등을 사용할 수 있음. OPTION )



d. miniDLNA 시작

service minidlna start 



wdmc내부ip:8200  으로 현재 MiniDLNA 의 작동 상태를 확인할 수 있다.
* Media scan in progress 라고 나오면 DLNA 폴더 내용을 스캔하여 라이브러리를 업데이트중이라는 뜻이며
커맨드상에서  minidlnad -R 명령으로 라이브러리를 강제 업데이트 할 수 있다.

 

  
 «이전 1  다음»