åº
NASã¨ã¯ãã¹ãã¬ã¼ã¸ãµã¼ãã¼ã®ä¸ç¨®ã§ããã
å¸è²©NASã®è²©å£²æ¦ç¥ã¨ãã¦ã¯ä¸»ã«2種é¡ã§ããã ã²ã¨ã¤ã¯ãUSBãã£ã¹ã¯ã«å¯¾ãã¦ãããã¯ã¼ã¯ã¢ã¯ã»ã¹å¯è½ãªãã£ã¹ã¯ã¨ãããããªã¤ã¡ã¼ã¸ã®ãã®(USBã¦ã§ãã«ã ã¨ãããã¯ã¼ã¯ã«ã¡ã©ã®é¢ä¿ã®ãããª)ãããã²ã¨ã¤ã¯1å°ç°¡æ½ã®ã·ã³ãã«ãªã¹ãã¬ã¼ã¸ãµã¼ãã¼ã¨ãããããªã¤ã¡ã¼ã¸ã®ãã®ã 1ã4ãã¤ã®ãã¼ã ã¦ã¼ã¹åãã®ãã®ã¯åè ã®ã4ã8ãã¤ã®SOHOåãã®ãã®ã¯å¾è ã®ã¤ã¡ã¼ã¸ãåããã¨ãå¤ãã
ããã¯ããã¾ã§ã¤ã¡ã¼ã¸çãªãã®ã§ããã宿 ã¨ãã¦ã¯ã¾ãéãã
ããããããããã«åç´ãª2ãã¤ã®NASãèãã¦ã¿ããã
ã·ã¹ãã ã¹ãã¬ã¼ã¸ãå¥éæã£ã¦ããããã§ã¯ãªãNASã«ããã¦ã¯ãã¤ã³ã¹ãã¼ã«ããã¦ãããã£ã¹ã¯ã«å¯¾ãã¦ã·ã¹ãã ãå±éããå¿ è¦ããããããã«ãããããã£ã¹ã¯ãã¾ã¨ãã¦ã²ã¨ã¤ã®ã¹ãã¬ã¼ã¸ã¨ãã¦æ±ããããã«ããã
åç´ãªèãæ¹ã¨ãã¦ã¯ã2ã¤ã®ãã£ã¹ã¯ã«çãããã¼ãã£ã·ã§ã³ãåããLVMãmdã«ãã£ã¦ãã£ã¹ã¯ãã¾ããã ããªã¥ã¼ã ãä½ãã ã·ã¹ãã ãã£ã¹ã¯ã«ã·ã¹ãã ãã¤ã³ã¹ãã¼ã«ããã«ã¯ãã®ã¤ã¡ã¼ã¸ãã©ããã«ç½®ããªãã¦ã¯ãªããªãããé常ããã¯NASå ã§ã¹ãã¬ã¼ã¸ãå¥ã«æã£ã¦ããã
ããã¦ãã¼ã¿ããªã¥ã¼ã ãä½ãããã®ããããã¯æ§ã ãªæ¹æ³ã§å¤é¨ã«æä¾ããã ä¸è¬çã«ã¯CIFS, FTP, SFTP, AFP, iSCSIãªã©ã§ããã
ã¾ããå ´åã«ãã£ã¦ã¯DLNAãªã©ã§ãã¡ã¤ã«ã§ã¯ãªãã³ã³ãã³ããæä¾ããå ´åãããã
å®¶åºå ã§ã®USBãã£ã¹ã¯ã¨æ¯ã¹ãã¨ã
- è¤æ°å°ã§ã®åæå©ç¨ãå¯è½
- åºå®éç¨ãå¯è½
- ã¢ã¯ã»ã¹å¶å¾¡ãå¯è½
ã¨ãã£ãã¡ãªãããããã
NASã¨ããã°QNAPãSynologyããã¨ã¯ä»ã¯ãªãNetGearãªã©ãããããåºæ¬çã«ãã®ã·ã¹ãã ã¯å²ã¨ç°¡åã«æ§ç¯ã§ãããµã¼ãã¼ã§ãããããã»ã©è¤éãªããããã¯ç¹ç°ãªã·ã¹ãã ããã¦ããããã§ã¯ãªãã Webã¤ã³ã¿ã¼ãã§ã¤ã¹ãªã©ããããã®å©ç¹ã¯ããããå®éã¯ã¢ãã©ã¤ã¢ã³ã¹ãªãã§ã¯ã®ã³ã³ããã¼ã«ã®ãã¥ããã®ã»ãããã£ã¨å¤§ãããNASãéç¨ãã¦ãã¦ã¡ããã¨ãããµã¼ãã¼ã®ã»ãã使ãã§ãããã¨æããããã«ãªã£ã¦ããã
ããã§ãããã§ã¯ä»ãå ¥ææ§ããããªã8ãã¤ã®NASãç®æãã¦èªä½ããæé ãç´¹ä»ããã ä»åã®è¨äºã¯ç¹æ®ç¨éã®PCèªä½ã¨ãLinuxãã¼ã ãµã¼ãã¼æ§ç¯ã®2ã¤ã®è©±ã«ãªãã
NASãã¼ãã¦ã§ã¢ãé¸å®ãã
NASã®ãã¼ãã¦ã§ã¢ãæ§æããä¸ã§éè¦ãªã®ã¯
- å¿ è¦ãªãã£ã¹ã¯ãæè¼å¯è½
- çé»å
- éé³
- ã³ã³ãã¯ã
ã§ããã
å®ã¯æå¾ã®ãã³ã³ãã¯ããã¨ããã®ãæãé£ãããNASã¯ãã£ã¹ã¯ãæè¼ã§ããã®ãªã®ãªã®ãµã¤ãºã®çä½ãæã£ã¦ãããããæ®éã«PCãèªä½ããã¨NASã»ã©ã³ã³ãã¯ãã«ã¯ãªããªãã
鏿è¢ã¯å¤ãã¯ãªãããNASãèªä½ãããã¨ããã¦ã¼ã¶ã¼ã«åããPCã±ã¼ã¹ã¨ããã®ãåå¨ããåºæ¬çã«ããã§æ§ç¯ãã¦ãããã¨ã«ãªãã
ãã ãNASåãPCã±ã¼ã¹ã¯å®¹éãå°ããã«ãé¢ãããã大éã®ãã£ã¹ã¯ãæè¼ããããã§ãå é¨ã¯ããªãçãä½ãã«ãªã£ã¦ããã使¥é£æåº¦ã¯é«ãã ã
NASãã¹ãã¬ã¼ã¸ãµã¼ãã¼åãã®ã±ã¼ã¹ãå¤ã販売ãã¦ããã®ãSilver Stoneã§ããã Silver Stoneã¯æ°å¹´åã¾ã§ãããå質ã®ä½ãã±ã¼ã¹ãä½ã£ã¦ããã®ã ããæè¿ã®ã¯è¯ãã ãã®ãããé¸ã³æ¹ã«ã¯å°ãæ°ãé£ãã
ããã¦ãäºå®ä¸å¯ä¸ã®é¸æè¢ã¨è¨ããã®ãSilver Stoneã®DS380ã§ããã 4ãã¤ãªãããå°ã鏿è¢ãããã®ã ãã©ã8ãã¤ã ã¨ãªãã
ãã®ãã³ã³ãã¯ããã¯å ¨ä½çã«è¶³ãå¼ã£å¼µãè¦ç´ ã§ããããDS380ãé«ããã鏿è¢ããªãããããã«ã¹ãã¼ã¹ãé常ã«çãMini-ITXã±ã¼ã¹ã§ããããããã¼ããå ¨ä½çã«å²é«ã ã ãããæ¨ã¦ããããªãã ãã¶æ¥½ã«ãªãããéè¦ãªè¦ç´ ã§ãããã
ãããè¸ã¾ããã¨ãã³ã³ãã¯ããæ¨ã¦ãªãå ´åã ãããè©±ãæ±ºã¾ã£ã¦ããã
Mini-ITXã§SATA8ãã¼ããçãã®ã¯å³ããã®ã§ãæ®éã«4ãã¼ãããªãã6ãã¼ãã®Mini-ITXãã¼ãã鏿ããã Intelã§ãAMDã§ãè¯ãããAMDã ã¨é¸æå¹ ãã ãã¶çããªãã®ã§Intelã«ãªãå ´åãå¤ãã
ã³ã³ãã¯ãã«ããã¨ç±çã«å³ããããããããã髿§è½ãªCPUãè¼ããã®ã¯ç¾å®çã§ã¯ãªãã å¦çæ§è½ãæ¨ã¦ã¦ãããªãJ5040-ITXã®ãããªãªã³ãã¼ãããã»ããµè£½åã鏿ããéãããããæ®éã®ããã»ããµãä¹ããã°ããå°ãæ§è½ã«æå¾ ã§ããããã«ãªãããããã¸ãã¯ç±ãã³ã¹ããä½¿ãæ¹ãªã©ã®ãã©ã³ã¹ã§ããã ãªããBtrfsãZFSã¯ããªãéãå¦çãåå¨ããã®ã§ãNASã ããCPUããããªãã¨ããããã§ã¯ãªããæ£ç´ãMini-ITXã®NASã«è¼ããã¬ãã«ã®CPUã§ã¯ä½ã§ããããè¶³ããªãã
ä»åã®ä¾ã§ã¯æãå®ãCeleronã§ã¯ãªãPentiumã鏿ããã æ§è½å·®ã¯ããã»ã©ãªããããããããã·ã§ã¯ããã
ã¡ã¢ãªã¯çµæ§å¿ è¦ã ãBtrfsãçµæ§ãªã¡ã¢ãªãå¿ è¦ã¨ããããZFSã¯ãã£ã¨å¿ è¦ã¨ããã Btrfsãªã16GBãZFSãªã32GBã¯æ¬²ããã ããã12TBãã£ã¹ã¯ã§æ§æããã¤ãããªãããã§ãè¶³ããªããããããªãã ä¸å¿ã16GBããã°æ®éã®åä½ã§ã¯åé¡ã¯ãªãã
ä»ã®Mini-ITXãã¶ã¼ãã¼ãã§ããã°M.2ã¹ããããæã£ã¦ããã®ãæ®éã ã ããã«ããSATAãã¼ããå¶éããããããããªãããã©ã®ã¿ã¡SATAãã¼ãã¯æ¡å¼µã«ã¼ãã§è£ãã®ã§ãã·ã¹ãã ãå¥ãã£ã¹ã¯ã«åããããã»ãã大ããã NASã¨ãã¦ã¯128GBãããã°ååã ããå¤å°ä½ããã¦ããã°ä½¿ãã¿ã¡ã¯åºããã
ããã¦é©åãã黿ºãç¨æããPCI Expressæ¥ç¶ã®SATA3ã«ã¼ããç¨æããã
ããã§çµã¿ä¸ããã°NASãã¼ãã¦ã§ã¢ã¯å®æã ã ãã¡ãããããã¯ãããç¶æ ã§ãå¥éãã£ã¹ã¯ãå¿ è¦ã«ãªãã
ã·ã¹ãã ã®æ¹éãæ±ºãã
æå¤§ã®æ±ºå®ã¯Btrfsã«ããããZFSã«ããããã§ããã
ãªããã®2æãªã®ããã ãããã¼ã«ã«ãªFSã§ããªããã¤8ãã£ã¹ã¯ã«ãåã¶ç°å¢ã§ããã°ããã以å¤ã®é¸æè¢ã¯ãã¾ãè³¢ãã¨ã¯è¨ãé£ãã
QNAPã¯Btrfsãé ããä¸å®å®ãªã©ã¨æ¹å¤ãã¦ããããããã¯ã¯ããæã®è©±ã§ãã£ã¦ãã¾ãã§ç¾å®ãè¦ã¦ããªããBtrfsã«ã¤ãã¦ã¯Btrfsã13年使ã£ãã®ã§ãã®çµé¨ã®è©±ã§è§£èª¬ããã
ã¾ããQNAPã¯ã¹ãããã·ã§ããããªã¥ã¼ã ãåä¸ã®ããªã¥ã¼ã ä¸ã«ããã®ã¯å®å ¨ã§ã¯ãªãã¨ä¸»å¼µããããããã¯ãã¾ãæå³ããªããQNAPã®NASã¯mdã«ããdm-raidã®ä¸ã«LVMãæ§ç¯ãã¦ããã QNAPã®ã¹ãããã·ã§ããã¯LVMã¹ãããã·ã§ããã ããLVMã®ã¹ãããã·ã§ããã¯LVã®ä¸ç¨®ã§ãããã¹ãããã·ã§ããå ã®LVã¨ã¯åä¸ã®VGä¸ã«ãããã¤ã¾ãããã£ã¹ã¯ã¨ãã¦ããã¼ãã£ã·ã§ã³ã¨ãã¦ãåä¸ã®ãã®ã®ä¸ã«ããããããµãããªã¥ã¼ã ã®ä¸ç¨®ã¨ãªãBtrfsã¨å®å ¨æ§ã¯å¤ãããªãã éãã¨ããã°ãBtrfsããã¡ã¤ã«ã·ã¹ãã ã¬ãã«ã§ãããLVMããããã¯ããã¤ã¹ã¬ãã«ã§ããã¨ãããã¨ã ãã¤ã¾ããBtrfsã¯ãã¡ã¤ã«ã·ã¹ãã ãã®ãã®ãç ´æããå ´åãã¹ãããã·ã§ããããã¨ããã¡ã«ãªãããLVMã§ã¯ãã¡ã¤ã«ã·ã¹ãã ãç ´æãã¦ã大ä¸å¤«ã§ããã ãã®ä»£ãããBtrfsã§ã¯èµ·ããå¾ãªããLVMã®ç ´æãã¨ãããªã¹ã¯ããã䏿å¢ããã¦ããã¨ãè¨ãããããã¦ããã¯ãããã¾ã§ããããªããã¨ã§ã¯ãªãã
ã¾ããLVMã¹ãããã·ã§ããã¯é·æçã«ä¿åãã¦ããããããªãã®ã§ã¯ãªãã LVMã®ã¹ãããã·ã§ããã¯ä½æããç¬éã«ã¯ä½ãä½ããªãã使ãããã¨ããããã¯ã¬ãã«ã§ãªãªã¸ãã«ã®ãã¼ã¿ã夿´ããããã夿´ãããåã®ãã¼ã¿ãä¿åãããã¤ã¾ããã¹ãããã·ã§ããã¯å¤§ãããªã£ã¦ãããè² è·ã大ããã
Btrfsã®ã¹ãããã·ã§ããã¯ãä¸ç¨®ã®ãã¼ããªã³ã¯ã®ãããªãã®ã§ãããã¹ãããã·ã§ãããã¨ã£ãå¾ã夿´ãå ããªããã°ãããã¯åããã¡ã¤ã«ã§ããã夿´ããã°å¥ãã¡ã¤ã«ã«ãªãã100MBã®ãã¡ã¤ã«ã®ãã¡ã®1ãã¤ãã夿´ããå ´åã100MB使ç¨éãå¢å ãããã·ã³ãã«ãªåããªãæ±ããããã
ã¾ããQNAPã¯ãã¡ã¤ã«ã·ã¹ãã ãLVMããããã¯QNAPã·ã¹ãã èªä½ã«åé¡ãçºçããå ´åã«ããªã«ããªã¼ãé常ã«é¢åã§ãããLVMã®ç¥èãè¦æ±ãããã®ããããªãããã©ãã
ããã§ãLVMã好ãã¨ããã®ãªãæ¢ãã¯ããªãããå°ãªãã¨ãç§ã®èãã¨ã¯ç¸å®¹ããªãã 10å¹´ãããLVMã¨ãããããã£ã¦ããããæè»ã«éç¨ããããã¼ã ã·ã¹ãã ã§ã¯ãªãã¾ãªãã¨ç§ã¯æã£ã¦ããã
ãªããä»åæçµçã«æ¡ç¨ãã¦ç´¹ä»ããæ¹æ³ã§ã¯ãåç´ã«Btrfsã§ãªãExt4ãXFSãä½¿ãæ¹æ³ã鏿å¯è½ã ãBtrfsã®ã»ããç¡é£ã ã¨æããã
Experimentalãªãã®ãæããªãã®ãªãã°HAMMER2ã鏿ããã¨ããã®ãããã ããããã ããããã¯ã¢ãã©ã¤ã¢ã³ã¹NASãé¿ãããçç±ã¨çµå±å¤ãããªããããç§ã¨ãã¦ã¯æ¨å¥¨ã§ããªãã
ç¾å®çã«èããããã®ã¯æ¬¡ã®ãããªãã®ã ã
- Linux MD(RAID5)+Btrfs
- Linux MD(RAID6)+Btrfs
- Linux Btrfs RAID1
- Linux Btrfs RAID10
- Solaris ZFS RAID-Z
- Illumos ZFS RAID-Z
- FreeBSD ZFS RAID-Z
Btrfsã§RAID5/6ã鏿ããã®ã¯ãå®å®æ§ãæ±ãããã(ãã¼ã¿æå¤±ãããããã«ãããªã)NASã§ã¯ç¡çãªè©±ã ã RAID1ãRAID10ã¯8å°ã§ããã®ã¯ããã©ãã ãããããRAID5/6ã使ããããRAID-Zãªãraidz1ãããã¯raidz2ã ã 8å°ã§raidz3ã¯ããããæãããã
æè»æ§ã§ããã°Btrfsã ãããã¡ã¤ã«ã·ã¹ãã åç¬ã§ä¿¡é ¼ã§ããRAID5ããããã¯RAID6ãæ§ç¯ã§ããZFSã«ãé åãããã ç±å¿ã«éçºããã¦ããBtrfsã®ã»ãã¯ææ°ã追ãããããã®ã§ãLinuxã·ã¹ãã ãæ¡ç¨ããå ´åã¯å¯å¤ã®ã·ã¹ãã ã¨èããã»ããè¯ãã䏿¹ZFSã¯ææ°ã追ãããã¥ãããããããç¨åº¦æ¯ããã·ã¹ãã ã¨ãã¦éç¨ããæ¹éã«ãªãã ããã¯ããä»®ã«Linuxã§ZFSã使ãå ´åã§ãåæ§ã§ããã
æ¯ããã·ã¹ãã ã«ããã®ã§ããã°ãOpenIndianaã®ãããªæ´æ°ãã¥ããã·ã¹ãã ã§ãã£ã¦ãæåã«æ§ç¯ã§ããã°ãããªã«åé¡ã¯ãªãã
ã ããå人çã«ã¯ææ°ã®ç¶æ ããã¼ããã¦ããã»ããæ¥½ã ã¨æãã ä»åã®å ´åãã·ã¹ãã ã¯M.2 SSDä¸ã«ç¬ç«ãã¦ãããããã·ã¹ãã ãä½ãç´ããã¨ã¯å°é£ã§ã¯ãªãã ã¨ã¯ãããç§ãªãçµå±ã¯Archlinuxã ã
NASã¨ããã©ããã·ã¹ãã ã«ä½ããã®èª¿æ´ãå ããããã¨ã¯ãããRubyã§æ¸ããã¦ã¼ãã£ãªãã£ãèµ°ãããããã¨ã ã£ã¦ããã çµå±ãææ°ãç¶æããã¦ããã»ããæ¥½ãªã®ã ã
ã¨ãªãã°ãSSDä¸ã«Archlinuxãå°å ¥ããã¤ã³ã¹ãã¼ã«ããã¦ããå ¨HDDããã¼ãã£ã·ã§ã³ã¬ã¹ãªmdããã¤ã¹ã¨ãã¦RAID5ããããã¯RAID6ãæ§ç¯ãããã®ä¸ã«Btrfs(meta single/data single)ãæ§ç¯ããã Btrfsããã¯1ã¤ã®ãããã¯ããã¤ã¹ã«ããè¦ããªããããmeta mirrorã§ããªãã®ãçãããç¾ç¶Btrfsã§ã¯è§£æ±ºãé£ãåé¡ã§ããã
ã¾ããNASã«åãããããªæ©è½ãè³ãæ¹æ³ã¨ãã¦ãã·ã¹ãã åã³ã¹ãã¬ã¼ã¸ã®æå·åãè¡ãã
åºæ¬ã·ã¹ãã ã®ã¤ã³ã¹ãã¼ã«
Archlinuxã®åºæ¬ã¤ã³ã¹ãã¼ã«æé ã®ãéã«ãå¿ è¦ãªä½æ¥ãæã¾ãã®ã§æ³¨æãå¿ è¦ã
ã¾ããGPTã§ãã©ã¼ããããããM.2ãã£ã¹ã¯ã«2ã¤ã®ãã¼ãã£ã·ã§ã³ãåãã
1ã¤ç®ã¯ESPã ãã500MBãããããã°ååã
ã¾ããswapãå¿
è¦ã¨ããå ´å(å¿
è¦ã§ããã¯ãã )ããã«ããã²ã¨ã¤swapãåãå¿
è¦ãããã
ããã§ã¯/dev/nvme0n1ãæ¬¡ã®ãããªã¬ã¤ã¢ã¦ãã«ããã¨ãã
| ãã¼ãã£ã·ã§ã³çªå· | ãã¦ã³ããã¤ã³ã | ãµã¤ãº | ãã¡ã¤ã«ã·ã¹ãã |
|---|---|---|---|
p1 |
/boot |
512MB | FAT32 |
p2 |
swap | 32GB | None |
p3 |
/ |
* |
None |
Manjaroã§ã¯/boot/efiã«åã£ã¦ãã(æå°é)ããé¢åãå°ãªãããã/bootã«åããã¨ã«ããã
ãã¼ãã£ã·ã§ã³ã¨ãã¡ã¤ã«ã·ã¹ãã ã®ç¨æãã§ããããæå·åããã¤ã¹ãç¨æããã ä»åãswapã¯ãã¤ããã¼ã·ã§ã³ãããªããã©ã³ãã ãªãã¹ã¯ã¼ãã使ããã®ã«ããã®ã§ãç¹ã«äºåã«ä½ããããå¿ è¦ã¯ãªãã
p3ã«é¢ãã¦ã¯LUKSã使ãã®ã§æºåãå¿
è¦ã
ã¨ãã£ã¦ãé£ãããã¨ã§ã¯ãªãã
# cryptsetup luksFormat /dev/nvme0n1p3
# cryptsetup luksOpen /dev/nvme0n1p3 cryptroot
# mkfs.ext4 -L ArchNAS /dev/mapper/cryptroot
ã¨ãã£ãæãã ã·ã¹ãã ãã¼ãã£ã·ã§ã³ã¯Ext4ã«ããããããã¯ã好ã¿ã§è¯ãã ã·ã¹ãã ã¹ãããã·ã§ãããæ¬²ãããªãBtrfsãã¢ãªã
ã¾ããããã§å
¥åãããã¹ãã¬ã¼ãºã¨è§£é¤æã®ãã¹ãã¬ã¼ãºã¯ãã¼ãã¼ãã¬ã¤ã¢ã¦ããç°ãªãå¯è½æ§ãããã
Archwikiã§ã¯mkinitcpioã®HOOKSã¨ãã¦keymapãencryptããå
ã«æ¸ãã°è¯ãã¨ãã¦ãããããããªã£ã¦ããManjaroã§ãUSã¬ã¤ã¢ã¦ãã§ã®å
¥åãå¿
è¦ã ã£ããããã
ãã®ç¹ã«çæãã¦ãããã»ããè¯ãã
ããã¾ã§ã§ãããã¤ã³ã¹ãã¼ã«ã®æºåãå§ããã
/mntãã¤ã³ã¹ãã¼ã«ã¿ã¼ã²ããã«ããããbootãã¼ãã£ã·ã§ã³ãå¿
è¦ã«ãªãã®ã§ããã®æºåãå¿
è¦ã
# mount /dev/mapper/cryptroot /mnt
# mkdir /mnt/boot
# mount /dev/nvme0n1p1 /mnt/boot
ãã¨ã¯é常éãã«ã¤ã³ã¹ãã¼ã«ããããé常ã®ã¤ã³ã¹ãã¼ã«ä½æ¥ãçµãã£ã¦ã使¥ã¯çµããã§ã¯ãªãã®ã§ãªãã¼ããã¦ã¯ãããªãã
ã¤ã³ã¹ãã¼ã«ã·ã¹ãã ã®/etc/mkinitcpio.confã®HOOKSã«ã¤ãã¦ãblockã®åã«keyboard keymapããblockã®å¾ãã«encryptãå
¥ããã
ãããã§ããã(ã¤ã³ã¹ãã¼ã«ã·ã¹ãã ä¸ã§)
# mkinitcpio -p linux
ã¨ãã¦ã¤ã¡ã¼ã¸ãåçæããã
ç¶ãã¦/etc/default/grubã®GRUB_CMDLINE_LINUX_DEFAULTã«æ¬¡ã®ãããªè¨è¿°ã追å ããã
creyptdevice=UUID=<DEVICE_UUID>:<MAPNAME> root=/dev/mapper/<MAPNAME>
DEVICE_UUIDã¯p3ãã¼ãã£ã·ã§ã³ã®UUIDã§ãblkidã«ãã£ã¦ç¢ºèªã§ããã
MAPNAMEã¯luksOpenã®æå¾ã®å¼æ°ã«ä¸ããåç§°ã§ã被ãããä¸è´ãã¦ããã°ãªãã§ãè¯ãã
ããã§ã²ã¨ã¤ã®è©±ã ReadyNASãªããã¯ããã¼ãã¡ã¤ã«ã使ããUSBãã£ã¹ã¯ã§è§£é¤ããããã«ãªã£ã¦ããã ãã®æ§æã ã¨ãã¹ãã¬ã¼ãºå ¥åãããã®ã§ãã£ã¹ãã¬ã¤ã¬ã¹ã§ä½¿ãNASã¨ãã¦ã¯ã¡ãã£ã¨ããã©ãããããã«æããã
ãããã§ããããã¼USBãä½¿ãæ¹æ³ã¯ãä¾µå ¥è ã¯ãã¼USBãçºè¦ããã°ãã¼ã¿ã«ã¢ã¯ã»ã¹ã§ãããããæ´ããããçã¾ããã¨æå·åã¯ç ´ããã¦ãã¾ãã®ã ã ãã®ãããå®å ¨ã¨ã¯è¨ãé£ãããã¹ãã¬ã¼ãºå ¥åã®ã»ããç§ã¯ããããã§ããã
ç¶ãã¦æå·åswapã®æºåã ãArchlinuxã ã¨ã/etc/crypttabã«swapã®è¡ããããããã¢ã³ã³ã¡ã³ããã¦ããã¤ã¹åãæ¸ãã ãã
/dev/nvme0n1p2ã¨ãæ¸ãã®ã¯å±éºãªã®ã§ãUUIDã使ããã¨ã
# <name> <device> <password> <options>
cryptswap UUID=00000000-aaaa-bbbb-cccc-xxxxxxxxxxxx /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256
ã§ã/etc/fstabã«swapã¨ã³ããªã追å ããã
/dev/mapper/cryptswap swap swap defaults,noatime 0 2
ããã§ãã¼ããã¦ã·ã¹ãã ãèµ·åã§ããããã«ãªã£ãã ä¸åãªãã¼ããã¦ã¤ã³ã¹ãã¼ã«ã·ã¹ãã ã§èµ·åãã¦ããç¶ãããã¦ãè¯ãã
ãã£ã¹ã¯ã®ç¨æ
ã¾ããã¼ãã¡ã¤ã«ã®æºåã
/etc/secretããªããã°ä½ãã¨ããããã
# mkdir /etc/secret
# dd if=/dev/urandom of=/etc/secret/hdd.key.bin bs=512 count=8
blkidãããã¯parted -lãç¨ãã¦HDDã®ããã¤ã¹ã確å®ããã¦ãããããã§ã¯/dev/sdaã®ãããªååã使ã£ã¦ããããã/dev/disk/by-idã/dev/disk/by-uuidã使ãã»ããå®å
¨ã
ããã¦ãåãã£ã¹ã¯ã«å¯¾ãã¦ãã©ã¼ããããã¦ããã
# cryptsetup luksFormat --key-file=/etc/secret/hdd.key.bin /dev/sda
ãã¹ã¦ã®ãã£ã¹ã¯ããã©ã¼ããããçµãã£ããã/etc/crypttabã«å
¨é¨ã®ãã£ã¹ã¯åè¨è¼ããã
# <name> <device> <password> <options>
hdd1 UUID=00000000-1111-2222-3333-xxxxxxxxxxxx /etc/secret/hdd.key.bin luks,nofail
nofailãã¤ãã¦ãªãã¨ããã£ã¹ã¯ããããããªã£ãããåãå¤ããã¨ãã«å復ããã®ãå°é£ã«ãªãã
ããã§ä¸æ¦åèµ·åãã¦ãã¹ã¦ã®ãã£ã¹ã¯ãæå·åãããã¾ãèªåã§ãªã¼ãã³ããããã確èªããã®ãããããã
/dev/mapper/hdd*ã«ãªã¼ãã³ãããã£ã¹ã¯ãæãç¶æ
ã«ãªãã®ã§ãRAIDãæ§æããã
# mdadm --create --verbose --level=5 --metadata=1.2 --chunk=512 --raid=devices=8 /dev/md0 /dev/mapper/hdd*
æ§æããããè¨å®ãã¡ã¤ã«ãæ´æ°ãã¦ã¢ã¬ã¤ãæ§ç¯ã
# mdadm --detail --scan >> /etc/mdadm.conf
# mdadm --assemble --scan
æ§ç¯ã¾ã§å®äºããããBtrfsãè¼ããã
# mkfs.btrfs -L MyCustomNAS /dev/md0
Btrfsããã¦ã³ãããå ´æãä½ããå人çã«ã¯é©å½ãªå ´æããªãã®ã§ã/dskã¨ãããã£ã¬ã¯ããªãä½ã£ã¦ãã£ã¦ããã
# mkdir -p /dsk/nas
ã¹ãããã·ã§ããã使ãããã«ã¯ãµãããªã¥ã¼ã ãå¿ è¦ãªã®ã§ä¸æ¦ãã¦ã³ãããã
# mount -o noatime,compress=lzo,nospace_cache /dev/md0 /dsk/nas
ãµãããªã¥ã¼ã ãä½ãã
# cd /dsk/nas
# btrfs subvolume create main
fstabã«è¨è¼ããã¡ããnofailãã¤ããªãã¨é¢åãªãã¨ã«ãªãã
ä»ã¯å¥½ã¿ãHDDã ã¨lzoã¤ããã»ããé«éãªå¯è½æ§ãé«ãã
LABEL=MyCustomNAS /dsk/nas btrfs noatime,compress=lzo,nospace_cache,subvol=main,nofail
ããã§å®äºã
ãµã¼ãã¼ã»ããã¢ãã
åèµ·åããã°åä½ã§è¦ãã°NASã¨ãã¦ç¨¼åããç¶æ
ã«ãªã£ãã
ä¸åpacman -Syuãã¦ã¢ãããã¼ããæ¸ã¾ãããåèµ·åããã¨è¯ãã ããã
ã¾ãããã®éå¿
è¦ãªããã±ã¼ã¸ã¯å
¥ãã¦ããã¨ãããvim, vim-plugins, zsh, grml-zsh-config, viãããã¯å
¥ãã¦ãããªãã¨ããã©ãããã±ã¼ã¸ã ã
æåã«SSHãã»ããã¢ããããã¨è¯ãããããã«baseã«ã¯å
¥ã£ã¦ããªã(base-develã«ã¯å«ã¾ãã¦ãã)ã®ã§å°å
¥ãå¿
è¦ã
# pacman -S openssh
- ã¢ãã¬ã¹å¶å¾¡ããã®ã«IPv6ã ã¨é¢å
- éåãªCPUãªã®ã§ãAES-NIã使ã
- OpenSSHã§ã®ãã°ã¤ã³ã¯åºæ¬ç¦æ¢ã«ãã
ã¨ããæ¹éã§/etc/ssh/sshd_configãè¨å®ã
AddressFamily inet
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
DenyUsers *
ãã¼ã«ã«ãªã¢ãã¬ã¹ããã®ã¿å ¬ééµèªè¨¼ãåãä»ããã
Match Address 192.168.0.0/16,10.0.0.0/8
DenyUsers root
AuthenticationMethods publickey
ã¾ã rootããã¦ã¼ã¶ã¼ãããªãã®ã§ãæ©è½ããªãè¨å®ã ãã ãã䏿¦èµ·åãã¦ãããã
# systemctl start sshd
# systemctl enable sshd
ã¦ã¼ã¶ã¼ãä½ãã PCå´ã¨UID, GID, ã¦ã¼ã¶ã¼åãä¸è´ããã¦ãããã¨ãå¼·ãæ¨å¥¨ããã 䏿¹ãã¡ã³ããã³ã¹ã¦ã¼ã¶ã¼ã§ã¯ãªãã®ã§ã«ã¼ã権éã¸ã®éã¯ä¸ããªãã
# useradd -U -m -s /bin/zsh john
ã¡ã³ããã³ã¹ã¦ã¼ã¶ã¼ãä½ã£ã¦ãããä»ã®ã·ã¹ãã ã¨éè¤ããªãããã«ããã»ããè¯ãã
# useradd -u 2000 -g wheel -m maintainer
base-develãå
¥ãã¦ããªããªãsudoãå
¥ãã¦ãvisudoã§/etc/sudoersãç·¨éã%wheelã®é¨åãã¢ã³ã³ã¡ã³ããããããã§maintainerã¦ã¼ã¶ã¼ã§å
¥ãã°rootã使ããã«ã¡ã³ããã³ã¹ä½æ¥ãã§ããããã«ãªãã
maintainerã«ã¯ããããå¼·åºãªãã¹ãã¬ã¼ãºãè¨å®ããã
# passwd maintainer
ä¸è¬ã¦ã¼ã¶ã¼ãå¾ã ã®ãã¨ãèããã¨ã¡ããã¨ãããã¹ãã¬ã¼ãºãè¨å®ãã¦ãããã»ããè¯ãã
ããã¦ãPCå´ã§SSHéµãæä½2ã¤çæãã¦ãããmaintainerç¨(ãã¹ãã¬ã¼ãºå¼·åº)ã¨ã¦ã¼ã¶ã¼SFTPç¨(ãã¹ãã¬ã¼ãºãªã)ã§ããããªããã¨è¨ã£ãããã©ãã·ã¹ãã ãæå·åããã¦ããªã(èµ·åæã¢ã¯ã»ã¹ã«å¶éããªã)Windowsã®ãããªã·ã¹ãã ã§ã¯ã¡ããã¨è¨å®ããã»ããããã
ã¦ã¼ã¶ã¼ã®ãã°ã¤ã³ãã¼ã¯ãã£ã¦ããªãã¦ãè¯ããmaintainerã§sudo -u john zsh -lã¨ãããã°è¯ãããã ã
OpenSSHã«ã¤ãã¦ã®åæ©çãªã¨ãããããããªã人ã¯å¥è¨äºã«ã¦ã
ããã¦ã¼ã¶ã¼PCãè¤æ°ãããªãããããã§éµãçæããNASã«ç»é²ããå¿ è¦ãããã
ãã¦ãããã§ãªãSSHã®ã»ããã¢ãããåªå ããã®ãã¨ãã話ããããã
主ã«ã¯ä½æ¥ã®å¿«é©æ§ã®åé¡ã§ããã ä¸è¬çã«ããããããµã¼ãã¼ãã»ããã¢ããããæ®µéã§ãå®å ¨ãªä½æ¥ç°å¢ãæ§ç¯ãããã¨ã¯ãªãã æ§ç¯ãçµãã£ããããã£ã¹ãã¬ã¤ãããå¤ãã¦é ã«ç½®ãã¦ãã¾ããã¨ãå¤ãããã仮置ãã®ç¶æ ã§ãã£ããã¨ã»ããã¢ããããããªãããã ã ãã®ãããã³ã³ãã¥ã¼ã¿èªä½ã®æ§è½ã¨ããæå³ãå«ãã¦ãæ®æ®µä½¿ã£ã¦ããPCãã使¥ããã»ããå¹çãããã
ã¾ããä»åã®å ´åNASã«Xãå ¥ãã¦ããªãã®ã§ãvconsoleä¸ã§ä½æ¥ãããã¨ã«ãªããããããèããå¿«é©æ§ãä½ãã ãã©ã¦ã¶ã§æ å ±ã確èªããªãããã¨ããmanpageè¦ãªãããã¨ãããã¨ãããã ãããããã¡ããã¨Xã®ããç°å¢ã§ä½æ¥ããã»ããè¯ãã
ããããæå³ã§SSHã®ã»ããã¢ãããã§ãã¦ããã°ä½æ¥ã䏿°ã«æ¥½ã«ãªãã ããã¯ã¯ã©ã¦ãã®å ´åã¯å¿ é ã«ãªã£ã¦ããã
ã¾ããSSHã®ã»ããã¢ããããã§ããã°SSHFSã使ã£ã¦ãã¡ã¤ã«ã¢ã¯ã»ã¹ãã¡ããã¨ã§ããããã«ãªãã®ã§ãSSHããæºåã§ããã°ããå®ç¨çãªç¶æ ãªã®ã ã
å ±æ with SSH
åè¿°ã®ã¨ããããã¡ã¤ã«ã¢ã¯ã»ã¹ã¯SSHFSã使ããã¨ã§äºå®ä¸ãè¦æ±ã¯å®å ¨ã«æºããããã
ãã¦ãã¾ãã¯johnã¦ã¼ã¶ã¼ã®è¨å®ããããã johnã¦ã¼ã¶ã¼ã¯ç®¡çè ã§ããããªãèªèº«ã§ãããããªãã¯ã©ã®PCã§ãjohnã¨ããååã®ã¢ã«ã¦ã³ãã使ã£ã¦ããã1ããã¼ã¿ã¯johnææã«ãªã£ã¦ãããUIDã¯1000ãGIDã1000ã§ããã
å
ã«johnã¦ã¼ã¶ã¼ã®NASç¨ã®éµãã¤ããããããauthorized_keysã«ç»é²ãã使¥ãæ¸ã¾ãã¦ããã¯ãã ã
johnã¯NASã®ã¹ãã¬ã¼ã¸ã¸ã®ã¢ã¯ã»ã¹ãå
¨é¢çã«å¯è½ã ãã§ã¯æºåãããã
åæã¨ãã¦ãä»ã¾ã§ä½ãããã£ã¦ããªãã®ã§ãNASã®/dsk/nasã¯root:root 755ã§ããã
ããã§è¯ãããããã夿´ãã¦ã¯ãªããªãã
ãã®ä¸ã«ã¦ã¼ã¶ã¼ã¬ãã«ã§æ¸ããã¨ãã§ãããã£ã¬ã¯ããªãç¨æããã
# mkdir /dsk/nas/local
# chown john:john /dsk/nas/local
ç¶ãã¦/etc/ssh/sshd_configã«johnã®ã¢ã¯ã»ã¹ãè¨è¼ãããã
å
ç¨ã®Matchã»ã¯ã·ã§ã³ãããåã«è¨è¼ããå¿
è¦ãããã
ã¤ãã§ã«æ¡ä»¶ãããå°ãçµããã
Match User john Address 192.168.10.0/24
AuthenticationMethods publickey
ChrootDirectory /dsk/nas
ForceCommand internal-sftp
ããã§johnã¯SSHFSã使ã£ã¦NASã¹ãã¬ã¼ã¸ããã¦ã³ãã§ããããã«ãªã£ãããããããããã§ããªãã
è¨ã£ã¨ãã¦ãªãã ããç§ã¯roã§SSHFSããã¦ã³ããã¦ãrrsyncã§ã¢ãããã¼ãããã¨ããæ¹å¼ãåã£ã¦ããã®ã§ãããããå¶éã¯ãã¦ããªããã¡ã¤ã³ã¦ã¼ã¶ã¼ã¯æ®éã«ã¢ã¯ã»ã¹ã§ããããã«ãã¦ãã¦ãéµãã¹ãã¬ã¼ãºã使ã£ã¦ããã
Windowsã®å ´åã¯ãªããªãããã©ãããã
åºæ¬çã«ã¯sshfs-winã使ãã°è¯ãã ä»ã¾ã§ã®ãã®ã¨æ¯ã¹ãã°ç»æçã¨ãã£ã¦ãããããã«ã¯åªããã½ãªã¥ã¼ã·ã§ã³ã ã
ããããOpenSSHã使ããªããã®ã½ããã¦ã§ã¢ã¯SSHFSã¨ã¯æ¯ã¹ç©ã«ãªããªãã»ã©åºæ¥ãæªãã
å
¬ééµèªè¨¼ã¯~/.ssh/id_rsaã«æ±ºãæã¡ããã¦ããã
ããã¯ããæ±ºãæã¡ããã¦ãããã¨ãRSAåºå®ã§ãããã§ææªã ããã¡ããã~/.ssh/configããªã¹ãã¯ãããªãã
ãã¹ã¯ã¼ãèªè¨¼ã許ãå ´åã¯ããã§ãã»ã©åé¡ããªãã®ã ããèå¼±ãªWindowsã®ããã«èå¼±ãªã·ã¹ãã æ§æããããªã©ãã»ãã¥ãªãã£æèããã人ã§ããã°è¨±ããªãè¡ãã ã
æ¯è¼çãã·ãª(?)ã½ãªã¥ã¼ã·ã§ã³ã¨ãã¦ã¯ãWindowså´ã§OpenSSHã®è¨å®ãæ¸ã¾ãããã®ä¸ã§
> ssh -N -L 2200:localhost:22 nas
ã¨ããã£ã¦æ¥ç¶ã確ç«ãã\\sshfs\localhost!2200ã«æ¥ç¶ããã¨ããæ¹æ³ã§ããã
localhostã®SSHæ¥ç¶ã¯å¸¸æãã¹ã¯ã¼ãèªè¨¼ãéããã®ã§ãç¡é§ãªSSHæ¥ç¶ããã䏿®µ(ã«ã¼ãããã¯ã¤ã³ã¿ã¼ãã§ã¤ã¹ã§)åã¾ãããã¨ã§OpenSSHã®èªè¨¼ãå©ç¨ãã¦ããã
ã ãããã®å ´åSFTPã®ã¿ã¨ããå¶ç´ã¯æ©è½ããªããããã ããWindowsã¯ã
ããã«å ãã¦ãããªãå¥ã®ã¦ã¼ã¶ã¼ã®éç¨ãèãã¦ã¿ããã ããã¯ãããªãã®å¦¹ãããããªãããAndroidããã¤ã¹ãããããªãã
mikanã¯ææ¸ãã¡ã¤ã«ã«ã¢ã¯ã»ã¹ãããã¨ãã§ããããæ¸ãè¾¼ã¿æ¨©éã¯ãªãã
ã·ã³ãã«ã§ãåã«/dsk/nas/local/docã«chrootããã°ããã ãã«è¦ããããChrootDirectoryã¯root:rootãªãã£ã¬ã¯ããªã§ããå¿
è¦ããããããããã¯ãããªãã
ããã§mikanç¨ã®ãã£ã¬ã¯ããªãç¨æãã¦ãããããäºåã«usersã°ã«ã¼ãã¯ç¨æããã¨ããã
# useradd -g users -m -s /bin/nologin -u 2500 mikan
# mkdir -p /srv/sftp/mikan/doc
# chown mikan:users /srv/sftp/mikan/doc
fstabã«bindãã¦ã³ããè¨è¼ããã(ãã®å¾å³æãã¦ã³ãããã«ã¯mount /srv/sftp/mikan/doc)
/dsk/nasã®ãã¦ã³ãããå¾ã«ãããã¨ã
/dsk/nas/local/doc /srv/sftp/mikan/doc none bind,nofail 0 0
mikanç¨ã®ãã®ã/etc/ssh/sshd_configã«ãæ¸ãã
Match User mikan Address 192.168.10.0/24
AuthenticationMethods publickey
ChrootDirectory /srv/sftp/mikan
ForceCommand internal-sftp
ç¶ãã¦yuzuã¯ã¹ãã¬ã¼ã¸å
¨åã«èªã¿åãå°ç¨ã§ã¢ã¯ã»ã¹ã§ããåçãã©ã«ãã«ã¢ãããã¼ããããã¨ãã§ããã
/dsk/nas/localã¯johnææãªã®ã§ãyuzuã¦ã¼ã¶ã¼ãä½ã£ã¦ããã«è¿½å ãã¦ããã ãã§ããã
Match User john,yuzu Address 192.168.10.0/24
AuthenticationMethods publickey
ChrootDirectory /dsk/nas
ForceCommand internal-sftp
åçãã©ã«ãã«ã¯yuzuãã¢ãããã¼ãããã¹ãã¼ã¹ãããããããããã£ã¬ã¯ããªãä½ãã°è¯ãã
# mkdir -p /dsk/nas/local/photo/yuzu
# chown -R john:john /dsk/nas/local/photo
# chown yuzu:root /dsk/nas/local/photo/yuzu
yuzuãã¢ãããã¼ãããã¨ããã«ã¯ä»ã®äººã¯è¦ããªãããã«ããããªããyuzu:root 700ã«ããã°ããã ãã ã
管çè
ã®ããªããè¦ãªãã®ã¯ã紳士åå®ãçµã¼ãã
ponkanã¯Androidããã¤ã¹ã§ãããNova Video Playerã§NASä¸ã®åç»ãè¦è´ãããã¨ããããã ã
Nova Video Playerã¯SFTPã¢ã¯ã»ã¹ãã§ããé常ã«ä¾¿å©ã ããå
¬ééµèªè¨¼ã®æ©è½ããªãã
è¦é ã¯mikanã¨åãã ããponkanã¯ãã¹ã¯ã¼ãèªè¨¼ã許ãããã«ããªãã¨ãããªãã
ãã®ãããã¢ã¯ã»ã¹ã§ãããã£ã¬ã¯ããªã®å
容ã¯ã§ããã ãå¶éããããã«ãããã
Match User ponkan Address 192.168.10.0/24
AuthenticationMethods password
ChrootDirectory /srv/sftp/ponkan
ForceCommand internal-sftp
bindãã¦ã³ãã¨ãã¼ããã·ã§ã³ã§å¯è¦æ§ãã³ã³ããã¼ã«ããã®ã¯é£ãããªãããããã管çããã®ã¯å²ã¨å¤§å¤ã«ãªãã ãã®ãã¡ã¤ã«ã¯è¦ãããã©ãã®ãã¡ã¤ã«ã¯è¦ããªãããªãã¦ããã®ã¯å¤§å¤ãªã®ã§ãã¡ããã¨ããªã·ã¼ãä½ã£ã¦ã³ã³ããã¼ã«ããã»ããè¯ãã ã ãããWindowsã®ã¢ã¯ã»ã¹ã®ããããçç±ã«å¶éããããªãã¦ã®ã¯ç¡é§ãªæéã«ãªãããããããªãã¨ããã ã
ãªããç§ã¯ãWindowsã¯ã»ãã¥ã¢ã§ãªããã©ã¤ãã·ã¼çãªæå³ã§ãä¿¡ç¨ã§ããªãã®ã§ãWindowsããã°ãã¼ãã«ãã¡ã¤ã«ã«ã¢ã¯ã»ã¹ã¯ãããªããã¨ããããªã·ã¼ãæ¡ç¨ãã¦ããããã®ãããWindowsããã®å ±æã§å°ã£ããã¨ã¯ãªãã ã©ããã¦ãå¿ è¦ãªããSSHã§ãã°ã¤ã³ãã¦Linuxä¸ã§ã¢ã¯ã»ã¹ãããã®çµæãWindowsã®ãã£ã¹ãã¬ã¤ä¸ã«åºãã¦ããã 鳿¥½ç³»ã®ã½ããã¦ã§ã¢ã¯eã¡ã¼ã«ã§ãªã³ã¯ãéã£ã¦ãããã¨ããããå¤ãã®ã§ããã®eã¡ã¼ã«ã«ãããã¦ãããªã³ã¯(eã¡ã¼ã«ã¸ã®ã¢ã¯ã»ã¹ãWindowsããã¯ã§ããªãããã«ãã¦ãã)ãWindowsä¸ã§åå¾ããã¨ããªã©ã«ãã®æ¹æ³ã使ã£ã¦ããã
å ±æ with SMB/CIFS
ç§ã¯Windowsã§Windowsã®å ±æã使ã£ã¦ãã¡ã¤ã«ãå ±æãããã¨æã£ããã¨ãä¸åº¦ããªãã®ã§ããããããæå³ãããã¨ãç¹ã«æããªãããã©ãã©ããã¦ããããªãã¨ãããã人ã¯Archwikiãè¦ãã¨è¯ãã NASãArchlinuxã«ããã®ã§ã解決çã¯ãã¹ã¦Archwikiã«ããã
ããã¤ã¹ãã½ããã¦ã§ã¢ãSMB/CIFSã®ã¿ããµãã¼ããã¦ããã¨ããç¶æ³ã¯æ®éã«èããããã ããã ãã®ãããªå ´åã«ã¯æå¹ã ã ã¾ããWindowsã«ããã¦é²ç»ãã¼ã¿ãç´æ¥NASã«æ¸ãããã¨ãããããªå ´åã«ãæå¹ã§ããã
å ±æã®æ¹éã«ã¤ãã¦ã ããã¾ãSMB/CIFSã®èªè¨¼ããã»ã¹ã¯SSHã®ããã«å åºãªãã®ã§ã¯ãªããã¨ãããã¨ãèããã¹ãã ã ããã¯ä»¶ã®ãWindowsã¯ãã¨ããã話ã§ã¯ãªããããããSSHã¯æ¬å½ã«å åºãªã»ãã¥ãªãã£ã§ãããããã«å¹æµãã(ããã§å®ç¾å¯è½ãªã¬ãã«ã®)ã»ãã¥ãªãã£ã確ä¿ããæ¹æ³ãªã©ãªãã«çããã
ã ãããSMB/CIFSã«éã£ã話ã§ã¯ãªãããããFTPã ã£ããNFSã ã£ãããã¦ãåãã§ããã
SMB/CIFSãã¡ã¤ã«å
±æã«ããã¦ã¯ãã«ã¼ããã£ã¬ã¯ããªã¯ãå
±æãã£ã¬ã¯ããªã«ã¼ããã¨ãã¦å¸¸ã«åå¨ãããã®ã§ãSFTPã«ãããChrootDirectoryç¸å½ã®åä½ãããã©ã«ãã§è¨è¿°å¯è½ã§ãããã¾ããåè¨å®ã®ãããªå¶éããªãããããã¹ã¦ãå
±æããã®ã§ã¯ãªãéå®ãã¦å
±æãããã¨ãåæã«èãããã¨ãå¯è½ã ã
ãã®å ´åãæ¢åã®ãã£ã¬ã¯ããªã®ã³ã³ãã³ããå ±æããã®ãªãããã¾ã§ã¨åæ§ã®æ¹æ³ã§bindãã¦ã³ãã使ã£ã¦ãããããããã¾ã§SMB/CIFSç¨ã®å ±æã§ããã¨ãããã¨ãªããããç¨ã«subvolumeãåãã¨ããã®ãæã ãããã¸ãã¯ããéç¨å¯ãã®è©±ã«ãªãã
ãã ãç¾å®çã«ã¯NASãå ±æããããããå ±æãããã³ã³ãã³ããPCä¸ã«è¤è£½ããXDG PUBLIC Directoryã«ç½®ãã¦Nemo Shareãªã©ã§éå®çã«ã·ã§ã¢ããã»ããæ±ããããã
ãã®ä»ã®å ±æ
DLNA
ç§ã®çµé¨çã«DLNAå ±æã¯ãã¾ãè¯ãçµæã«ãªã£ã¦ããªãã®ã§ãã¢ããã¤ã¹ã§ããªãã
Androidããã¤ã¹ã§åç»ãè¦ããããDLNAããããããã¨ããã®ã¯çµæ§ãã£ãã®ã ããçµå±SFTPã®ã»ããè¯ãçµæã«ãªã£ã¦ããã
FTP
FTPã¯ã¯ã©ã¤ã¢ã³ããå å®ãã¦ããã¨ããå©ç¹ããããã¾ãé£ç¹ã§ããã»ãã¥ãªãã£é¢ãLANã«ã¢ã¯ã»ã¹ãéå®ããã¦ããã°ããã»ã©èæ ®ããªãã¦ããããæªããªããã䏿¹ã§ãµã¼ãã¼ã»ããã¢ããã¯ãããªã«æ¥½ã§ã¯ãªããã¾ãFTPèªä½ãã¢ã¯ã»ã¹å¹çããããªãããã¡ã¤ã«ã·ã¹ãã ã¨ãã¦ã¢ã¯ã»ã¹ããã®ã«ãã¾ãé©ãã¦ããªãã
FTPã¦ã¼ã¶ã¼ãã·ã¹ãã ã¦ã¼ã¶ã¼ã«çµã³ã¤ããã©ããã¯ãµã¼ãã¼ã½ããã¦ã§ã¢ã«ãããã管çã¯æ¯è¼çç´°ããè¡ããã¨ãã§ããã
ãã¼ã¿ã«ã§ã¯ãã¾ãããããã¯ãã¥ããã
NFSv4
ã¢ã¯ã»ã¹ãã®ãã®ã¯Unixã«æé©åããã¦ãããUnix/Linuxç³»ãã©ãããã©ã¼ã ã§ã¯é©ãã¦ããããã®ããã«æãããã
ã ããå®éã¯NFSã¯ããªãåé¡ãå¤ããæ±ããæ¥½ã§ã¯ãªããããã¤ã«ã·ã£ãããã¦ã³ãããé¢åãªãã¨ã«ãªã£ããããããSFTP(SSHFS/gvfs-sftp)以ä¸ã«ããªã¼ã«ã¢ã¯ã»ã¹ã§ããªãã¨ããåä»ã ã
æå¤§ã®åé¡ã§ããã»ãã¥ãªãã£ã¯LANå ã§ããã°åé¡ã¯å°ããããæå¤ã¨çãå°ãªãã
AFP
AFPå ±æãæå¹ã«ããã«ã¯Netatalkã使ãã
/etc/afp.confãç·¨éãã¦netatalk.serviceãæå¹ã«ããã ããªã®ã§çµæ§ç°¡åã
åç´ã«ãã¡ã¤ã«å
±æã¨ããæå³ã§ã¯Macããã§ãã£ã¦ãSFTPã®ã»ãã便å©ã ããTimeMachineãªã©ãMacä¸ã®æ©è½ã®å©ä¾¿æ§ããAFPã使ããã¨ä¾¿å©ãªå ´é¢ããããããã ã
ç§ã¯Macæã£ã¦ãªãã®ã§ç¥ããªããã
WebDAV
ã¯ã©ã¤ã¢ã³ãã®é½åã§ããã°ä½¿ãã©ãããåºããWebDAVã ãã¼ã«ã«ãããã¯ã¼ã¯å ã§å¿ è¦ã¨ãªããã¨ã¯å¤ãã¯ãªãããæ§ç¯ããã®ãã¢ãªãªé¨é¡ã
é常ãApacheã使ãã
ãã¡ã¤ã«ãµã¼ãã¼ã§Nginxã使ãçç±ã¯ãã¾ããªãã ãããããApacheã使ãã°ããã¨æãããNginxã§ãnginx-mainline-mod-dav-extã使ã£ã¦æ§ç¯å¯è½ã
ãã ãã©ã¡ããã¨ããã¨ãNginxããªãã¼ã¹ãããã·ã¨ãã¦ãApacheãWebDAVç¨ã«ä½¿ã£ãã»ããåççã
éå®çãªã¤ã³ã¿ã¼ãã§ã¤ã¹ã«ããã¢ãããã¼ã管ç
ç§ã®ãä»äºã§ããæ±ã(ã¨ããããä¾ç¤ºãã)ã±ã¼ã¹ã§ã¯ãå®¶æãåçãã©ã«ããå
±æããã¨ãããã®ãããã
ããããåç´ã«å
¨ã¦ã¼ã¶ã¼å
±æããã¦ããåçãã©ã«ãã§ããã¨ããæå³ã§ããã°ãåç´ã«å
±æããã°è¯ãã
ã¤ã¾ããfamilyã°ã«ã¼ããä½ã£ã¦ãåçãã©ã«ããroot:familyã®775ã«ããã¨ãããã¨ã ã
ä»ã®äººãã¢ãããã¼ããããã©ã«ãã§ãã£ã¦ãç·¨é(ç§»åããããªãã¼ã ããã)ã§ããããã«ãããã¨ãããã¨ã§ããã°ãåçãã©ã«ãã«å¯¾ãã¦chrootããå½¢ã§ã誰ãå©ç¨ããå ´åã§ãåãã¦ã¼ã¶ã¼ã§ã¢ã¯ã»ã¹ããããã«ããã°è¯ãã
é£ããã®ã¯ã¢ãããã¼ããããã¨ã¯ã§ããããç§»åãåé¤ãªã©ã®ç·¨éã¯ã§ããªãããã«ãããå ´åã ã
ãã®å ´åã¯ããå°ç¨ã®ã¤ã³ã¿ã¼ãã§ã¤ã¹ãç¨æããå¿
è¦ããããæ¯è¼çç°¡åãªã®ã¯rrsync -wo -no-delã§ä½¿ãæ¹æ³ã ã
ãã ããrsyncã§ããå¿
è¦ããããããã³ãã³ããæããªããã°ãªããªãåé¡ã¨ãWindowsã§ã¯ããã«ãã¼ãã«ãé«ãã¨ããåé¡ãããã
èªä½ã®è¯ããæ´»ãã
ãã®NASã¯èªä½ã§ããããã«ã·ã¹ãã é¢ã®ç¸ãããªããArchlinuxãå°å ¥ãããã¨ãã§ãã¦ããã ãã®ããã«ã追å ã®ã½ããã¦ã§ã¢ã®å°å ¥ã楽ã§ãèªåã好ããªããã«æ§æã§ããã
ãããã®NASã常æèµ·åãã¦ããåæã§ããã°ããµã¼ãã¼ã¨ãã¦ã®åä½ãå¯è½ã ã ãããããã®ã·ã¹ãã ã ã¨ãHDDãå«ãã¦ã¢ã¤ãã«æ100Wãè¶ ããç¨åº¦ãHDDã®æ¶è²»é»åãå°ãããªããã¨ããããã¡ãã£ã¨æ©ãã§ãã¾ããããã ããã¤ãã£ã±ãªããä¸å¯è½ã§ã¯ãªãã
è¨ç®åãããã»ã©é«ããªããµã¼ãã¼ã常æã¤ãã£ã±ãªãã«ããæå³ã¨ããã®ã¯å®ã®ã¨ããèãããéç¥ãµã¼ãã¼ã¨ãã¦ä½¿ã£ããããããã¯Systemd Timerã使ã£ã¦å®æã¸ã§ããå®è¡ãããããã®ã«é©ãã¦ããã ãµã¼ãã¼ã®æ´»ç¨æ¹æ³ã¨ããã®ã¯çºæ³æ¬¡ç¬¬ãªã®ã§ãèããã°ä½¿ãã¿ã¡ãããã ããã
ã ããå®ã®ã¨ãããç§ã¨ãã¦ã¯è¿å¹´ã¯ãã¾ããã®ãããªå¸¸æç¨¼åãããµã¼ãã¼ã®å¿ è¦æ§ãæãã¦ããªãã
å®éã®è©±ã¨ãã¦ãç§ã¯NASã®ä»ã«ã¹ãã¬ã¼ã¸ãµã¼ãã¼ã¨ãã¦ProLaint Microserver(ã¡ã¢ãª2GBã§éå¸¸ã«æ§è½ãä½ããã®)ã¨èªä½PC(A10-7870Kã®ã以åã¡ã¤ã³ã§ä½¿ã£ã¦ãããã®)ã¨ãã2å°ãæã£ã¦ããã®ã ãããã®æ´»èºåº¦åãã¯ãå¾®å¦ããªã®ã§ããã
A10ã®ã»ãã¯ããããã¦ãã¹ã¯ãããã¨ãã¦ä½¿ããç¨åº¦ãProLiantã¯ãã¹ã¯ãããå©ç¨ã¯ç¾å®çã§ãªãç¨åº¦ã®æ§è½ã ããè¨ç®ç³»ã®å¦çãä»»ããã®ã¯å³ããããããã®2å°ã¯æ¯è¼çéãã§(A10ã®ã»ãã¯æè¿éåãããããªã£ã¦ãã¾ã£ãã)ãããã¯ã°ã©ã¦ã³ãã§ã®ç¨¼åããããããã»ãã§ã¯ãããããã®ãããªã¸ã§ãèªä½ããã¾ããªãã®ã ã
éç¥ãµã¼ãã¼ã®ãããªå½¹å²ã¯ãæã§ããã°ããªãéè¦ã§ãã£ããwgetãcurlã§ã¹ãã¼ã¿ã¹ãåå¾ãã¦ãå¿ è¦ã§ããã°æºå¸¯é»è©±ã«ã¡ã¼ã«ããããããããã¯é³ãé³´ããã¦è¦åãããã¨ãã£ãå½¹å²ã ã ããã¯ãå人ãæä¸ã®äººã¨æ²ç¤ºæ¿ãã¡ã¼ã«ã§é£çµ¡ãåãåã£ã¦ãããããªæä»£ã§ã¯ã¨ã¦ãæå¹ã ã£ãããä»ã§ããã°ã¡ãã»ã¼ã¸ã³ã°ã¢ããª(ç§ãªãTelegramãDiscord)ã§ã¡ãã»ã¼ã¸ããããã°ããã ãã§ããã¾ãæå³ããªãã
ä»®ã«éç¥ãµã¼ãã¼ãå¿ è¦ã«ãªãè¦ç´ ããã£ãã¨ãã¦ããVPSã§è³ãã»ãããã£ã¨è¯ããConoHa VPSã®1ã¶æã®ãããã ã®æéã¯682åã§ãããã¯æ®éã®ãµã¼ãã¼ã®1ã¶æã®é»æ°ä»£ãããå®ãã
ã¾ããmmfft9ã®ãã¥ã¼ãµã¼ãã¼ãªã©ã¨ãã¦ä½¿ããã¨ãèãããããããã®ãããªåæ£ã³ã³ãã¥ã¼ãã£ã³ã°ã®ãã¥ã¼ãµã¼ãã¼ãèªå® ã§å¿ è¦ã¨ããç¶æ³ã§ã¯ãç¹ã«å¥éä¸å¤®é権çãªãã¹ãã¯å¿ è¦ã¨ãã¦ããªãã¦ãããããä¸çªå¦çè½åã®é«ãã³ã³ãã¥ã¼ã¿ã¯ä½æ¥ãçµããã¾ã§ãã£ã¨åãããã ããã¨ãããã¨ãèããã¨ããã®ãã¹ãã«ãã¥ã¼ãµã¼ãã¼ãããããã»ããå¹ççãªã®ã ã
å¯ä¸ç¾å®çã«ä½¿ã£ã¦ããæ¹æ³ã¨ãã¦ãA10ã¯ãã¦ã³ãã¼ãã¸ã§ããä»»ãããã¨ãããã çµæ§ãªãã¼ã¿éã®ãã¦ã³ãã¼ããå¿ è¦ã«ãªã£ããããããã¯ãããã帯åããã¾ããªãã£ããã§é·æé(æ°æ¥)ã«æ¸¡ã£ã¦ãã¦ã³ãã¼ãã¸ã§ããåããªãã¨ãããªããã¨ãããããªããã¤ãããããããã«æå ã«ãªãã®ãã¼ã¿ãããããç §åããå¿ è¦ããã£ãããã¦ãA10ã«ã¾ããã¦ããã ããã§æ°æ¥ã«æ¸¡ãã¸ã§ãã§PCã䏿ã§ããªãã¨ããäºæ ãé¿ãããããããã¦ã³ãã¼ãå®è¡ä¸ã ããåç¥ããããªããã¿ãããªãã¨ãé¿ããããããã ã
ã ããA10ããã£ã¦ããã¿ã¹ã¯ã¨ããã®ã¯æ¬å½ã«ãããããã§ãã¡ãã£ã¨åã¾ã§ã¯ãªãã³ã°ã«ç½®ãã¦ãã£ã¦ãAmazon prime videoãè¦ããYouTubeãè¦ãã®ã«ä½¿ã£ããããã¦ããããç¾å¨ã¯ãã®å½¹å²ã¯å¥ã®PCã«ãªã£ãã®ã§ãããããªãã
ãã¼ã«ã«ãµã¼ãã¼ã®ä½¿ãã¿ã¡ã¯ãããããã®æ³å忬¡ç¬¬ã§ãªãã§ããã§ã¯ãããããããããã¡ã¤ã«ãµã¼ãã¼ä»¥å¤ã®ãã¼ã«ã«ãµã¼ãã¼ã®å¿ è¦æ§ã¯æä»£ã¨ã¨ãã«æ¸å°ãã¦ããã
ãããªãæ¡å¼µ
èªä½NASã§ããã²ã¨ã¤ã®ã¡ãªããã¨ãã¦ãç¹ã«ã¹ãã¬ã¼ã¸ãèªèº«ã®ã¿ã§æ§æããå¶ç´ã¯ãªããã¨ãããã¨ãæããããã äºå®ãåè¿°ã®A10ã¨ProLiantã¯ãã®2å°ã§åè¨12å°ã®HDDã1ã¤ã®ã¹ãã¬ã¼ã¸ã«ãã¦ããã
ãã®è©±ãããã¨Btrfsã®ã¡ãªãããæ´»ãã¦ããã
æ¹æ³ã¯ããã¤ãèãããããããèæ ®äºé ã«ãªãã
ã¾ããåè¿°ã®1å°æ§æã®å ´åã8å°ããããã®DM Cryptããã¤ã¹ã§ã²ã¨ã¤ã®MD RAIDã§ããã1ãããã¯ããã¤ã¹ã®Btrfsãæ§æããã ããã§ã¯ããã«ãªã¢ã¼ããããã¯ããã¤ã¹ãã¯ãã¾ãã鏿è¢ã¯NBD, iSCSI, AoEã ããAoEã¯Btrfsããã¾ãåä½ããªãã®ã§ãç¾å®çã«ã¯iSCSI䏿ã§ããã
ããã¦ãiSCSIã使ãã¨ãã¦ç¾å®çã«ã¯ããã¾ãã«2éãã®æ¹æ³ãããã
- ããããã®ãã¹ãã§LUKS+RAID5ãç·¨æããRAIDããã¤ã¹ãiSCSIã§é ä¿¡ããã¹ãããã1ã¤ã®ãããã¯ããã¤ã¹ã¨ããBtrfsãä½ã
- ããããã®ãã¹ãã§çããã¤ã¹ãã¾ãã¯LUKSããã¤ã¹ãiSCSIã§ç·¨æãããã¹ã¦ã®ãã£ã¹ã¯ãããªãRAIDãç·¨æã1ã¤ã®ãããã¯ããã¤ã¹ãããªãBtrfsãä½ã
å¾è ã®æ¹æ³ãã¨ãã«ã¯ãã¹ã¦ã®ãã¹ãã®ãã£ã¹ã¯ãåã容éã§ããå¿ è¦ãããã ãã®ããããå ¨ãã£ã¹ã¯ãéãã¦1å°ã ãã®ããªãã£ãã£ã¹ã¯ã¨ããç·¨æãå¯è½ã
å人çã«ã¯åè ã®ã»ããããããã ãBtrfsã¯åé¡ãªãç°ãªã容éã®ããã¤ã¹ã§å©ç¨ã§ããsingleã®å ´åã§ãè¤æ°ã®ããã¤ã¹ã«å ¬å¹³ã«é åãããã
ãªããRAIDã«ããªãå ´åããRAID1ã¾ãã¯10ã§è¯ãå ´åã¯çããã¤ã¹ãã¾ãã¯LUKSããã¤ã¹ãé ä¿¡ããããããBtrfsã§ä½¿ãã°è¯ãã
ã誰ãLUKSãæã¤ã¹ãããã¯å¦çè½åã«ããã
LUKSã¯å½ç¶ãªããæå·åå¦çã§ãããããããã§è¨ç®åãæ±ããããããã®ããããã¾ãã«ãæå·è¨ç®è½åãä½ããã¹ãã§ã¯ã¢ã¯ã»ã¹é度ãä½ä¸ãããè¦å ã«ããªãã
ã ããããã¯åç´ã«CPUãã¯ã¼ã ãã§èããããããã§ã¯ãªãã
Archlinuxã§ã¯LUKSã®ããã©ã«ãã®Cipherã¯aes-xts-plain64ã§ãããã¤ã¾ããAES256, SHA256, /dev/urandomãå©ç¨ãããã
ãã®ãã¡AES256é¨åã«ã¤ãã¦ã¯AES-NIãå¹ããããå¿
ãããããã»ããµãã¯ã¼ãéè¦ã§ããã¨ã¯éããªãã
ãã ãSHA256ã®è¨ç®ã¯è»½ããã®ã§ã¯ãªãããããã¾ãã«éåãªããã»ããµã§ã¯ãããããã«ããã¯ã«ãªãå¯è½æ§ãããã
ã¾ããé常ã®èµ·åã·ã¼ã±ã³ã¹ã§ã¯/etc/crypttabã«ããdm-cryptã®å¦çãåã³/etc/mdadm.confã«ããdm-raidã®å¦çã¯iSCSIã¤ãã·ã¨ã¼ã¿ã®å¦çãããå
ã«ãããããiSCSIã§é
ä¿¡ãããã®ãçããã¤ã¹ãLUKSããã¤ã¹ã§ããå ´åããªã¼ãã³ãããã¦ã³ãã¾ã§ã®å¦çãããã³ã¢ã³ãã¦ã³ãããã¯ãã¼ãºã¾ã§ã®å¦çã¯ã¹ã¯ãªããã§æ¸ããªã©ããå¿
è¦ãããã
ãã¼ã«ã«ãã£ãã·ã¥
éå»ã®è¨äºã§ã¡ãã£ã¨è¨ã£ã¦ããããç§ã¯ãã¼ã«ã«ãã£ãã·ã¥SSDã使ãéç¨ã«ãã¦ããã
ããã¯ãNASã常æä½¿ãããã§ã¯ãªãããã使ããã¼ã¿(鳿¥½ã¨ããè¦ã¦ãéä¸ã®ãããªã¨ã)ãç½®ãã¦ãããããå¦çä¸ã®ãã¼ã¿ãç½®ãã¦ãããããããã®ã ã 2.5ã¤ã³ãã®SATA SSDã使ã£ã¦ãã¦ãã¯ã¼ã¯ã«ã¼ã ã®ã¡ã¤ã³PCã§ã¯2TBãå¯å®¤ã®PCã§ã¯1TBã使ã£ã¦ããã ãã®ã»ãã2TBã®USB SSDãããã
ç¹ã«æ¸ãè¾¼ã¿æã®ä¸æç½®ãå ´ã¨ãã¦ã¯ä¸å¯æ¬ ã§ReadyNASã®ãã©ãã«ã¨ããã®ä¸èº«ã«è¸ã¿è¾¼ãã§è¿°ã¹ãããã«HDDã«ã©ã³ãã æ¸ãè¾¼ã¿ãããã¨HDDã®æ¶èãæ¿ããããããã©ã¼ãã³ã¹ãè½ã¡ãããã§ããã ãã·ã¼ã±ã³ã·ã£ã«ã«ãããã ããã§ã宿ãããã¼ã¿ã«ãªãã¾ã§ãã¼ã«ã«ãã£ãã·ã¥ã®SSDä¸ã«ç½®ãããã«ãã¦ããã¼ã¿ããªã¼ããªã³ãªã¼ã§ååãªç¶æ ã«ãªã£ããrsync/rrsyncã使ã£ã¦ã¢ãããã¼ãããã
ç§ãworldã¨å¼ãã§ããã¹ãã¬ã¼ã¸ç³»ã¯64TBã®å®¹éãããã®ã ããããã ããã¼ã¿ãããã°ã¢ã¯ã»ã¹ã«ã¯å¼·ã屿æ§ãããã ã ãããã使ããã¼ã¿ã¯æè¨±ã«ç½®ãã¦ããã°ã常æNASãèµ·åããã¦ããå¿ è¦ããªã(é»åçã«ããHDDã®å¯¿å½çã«ã大ãã)ããã¢ã¯ã»ã¹ãéãã¦å¿«é©ã
ç§ã®ãã¼ã«ã«ãã£ãã·ã¥ã¯æåéç¨ã§ã以åã¯èªä½ã®FUSE-FSã§å¦çãã¦ããã®ã ãããã¢ã¯ã»ã¹ã«åºã¥ããã£ãã·ã¥ãã ã¨å¿ è¦ã¨ãã¦ããã®ãåãããã£ã¦ããã®ã«NASãªãã§ã¯åä½ããªã(鳿¥½ãã©ã«ããªãæ¢ã«åçããæ²ãããªããã)ã¨ãããã¨ãå¤ãã®ã§æåã®ã»ããããã£ãã
æ¸ãæãã®å¤ããã¼ã¿ã«ã¤ãã¦ã¯åºæ¬çã«ãã¼ã«ã«ãã£ãã·ã¥ã§ããªãã·ã¹ãã ãã£ã¹ã¯ä¸ã«ç½®ãã¦ãã¦ãè¤æ°ãã·ã³ã§è¤è£½ãã¦åé·æ§ããããã¦ããã æ¹æ³ã¯åºæ¬çã«ã¯ã¯ã©ã¦ããã©ã¤ãã«ããåæããMercurialã§ããã ããã¤ã¾ã§çµã£ã¦ãæ¸ãæãã®æ¿ãããã¼ã¿ãã¨ããã®ã¯ã ãã¶éå®çãªã®ã§ãããã¯ç¹ã«å°ããªãã
ç§ã¯WindowsãMicrosoftã¢ã«ã¦ã³ãã¤ãã§ä½¿ããããªãã¨ã¯çµ¶å¯¾ã«ããªãã®ã§ãMicrosoftã¢ã«ã¦ã³ãã§ãµã¤ã³ã¤ã³ãã¦ããå ´åã«ã¦ã¼ã¶ã¼åãã©ã®ãããªãã®ã«ãªããã¯ç¥ããªããâ©ï¸