{"id":734,"date":"2024-07-22T08:00:35","date_gmt":"2024-07-22T00:00:35","guid":{"rendered":"https:\/\/www.zhoubin.asia\/?p=734"},"modified":"2024-07-21T21:49:50","modified_gmt":"2024-07-21T13:49:50","slug":"samba-mdadm_kodi","status":"publish","type":"post","link":"https:\/\/www.zhoubin.asia\/index.php\/2024\/07\/22\/samba-mdadm_kodi\/","title":{"rendered":"[\u5176\u4ed6]\u5982\u4f55\u5229\u7528samba, mdadm\u548cKodi\u6253\u9020\u5bb6\u5ead\u5f71\u97f3\u7cfb\u7edf"},"content":{"rendered":"<p>\u56e0\u4e3a\u624b\u5934\u6709\u4e24\u4e2a\u79fb\u52a8\u786c\u76d8\uff0c\u8003\u8651\u5230\u5bb6\u91cc\u5c0f\u670b\u53cb\u7684\u7167\u7247\u6bd4\u8f83\u591a\uff0c\u60f3\u7740\u6b63\u597d\u901a\u8fc7\u4e24\u4e2a\u79fb\u52a8\u786c\u76d8\u6253\u9020\u4e00\u4e2a\u7b80\u6613\u7684RAID\u78c1\u76d8\u9635\u5217\uff0c\u7136\u540e\u5229\u7528samba\u5b9e\u73b0\u5c40\u57df\u7f51\u5171\u4eab\uff0c\u6700\u540e\u5229\u7528Kodi\u5c40\u57df\u7f51\u67e5\u770b\u89c6\u9891\u4e0e\u7167\u7247\u3002<\/p>\n<div class=\"container\">\n<h2>\u914d\u7f6e\u78c1\u76d8\u9635\u5217<\/h2>\n<p>\u6211\u8fd9\u8fb9\u53ea\u67091\u4e2a2T\u4ee5\u53ca\u4e00\u4e2a1T\u7684\u79fb\u52a8\u786c\u76d8\uff0c\u7ecf\u8fc7\u8003\u8651\u6253\u7b97\u7528RAID1\u505a\u4e00\u4e2a1T\u7684\u78c1\u76d8\u9635\u5217\u4fdd\u5b58\u6bd4\u8f83\u91cd\u8981\u7684\u5bb6\u5ead\u7167\u7247\u4ee5\u53ca\u5176\u4ed6\u91cd\u8981\u7684\u5b66\u4e60\u8d44\u6599\uff0c\u7136\u540e\u989d\u5916\u76841T\u7a7a\u95f4\u5355\u72ec\u5f04\u51fa\u6765\u7559\u7ed9\u5b58\u653e\u5bb6\u5ead\u5f71\u97f3\u7cfb\u7edf\u7684\u5f71\u89c6\u89c6\u9891\u6587\u4ef6\u3002<\/p>\n<h3>\u6b65\u9aa41: \u786e\u4fdd\u4f60\u5b89\u88c5\u4e86\u5fc5\u8981\u7684\u8f6f\u4ef6\u5305<\/h3>\n<pre><code>sudo apt update\r\nsudo apt install mdadm<\/code><\/pre>\n<h3>\u6b65\u9aa42: \u51c6\u5907\u78c1\u76d8<\/h3>\n<p>\u4f7f\u7528<code>lsblk<\/code>\u6216<code>fdisk -l<\/code>\u547d\u4ee4\u8bc6\u522b\u4f60\u7684\u78c1\u76d8\u3002\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u5047\u8bbe1TB\u7684\u78c1\u76d8\u662f<code>\/dev\/sda<\/code>\uff0c2TB\u7684\u78c1\u76d8\u662f<code>\/dev\/sdb<\/code>\u3002<\/p>\n<h3>\u6b65\u9aa43: \u5206\u533a\u78c1\u76d8<\/h3>\n<p>\u5728\u4e24\u4e2a\u78c1\u76d8\u4e0a\u521b\u5efa\u5206\u533a\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528<code>fdisk<\/code>\u6216<code>parted<\/code>\u3002\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528<code>fdisk<\/code>\uff1a<\/p>\n<pre><code>sudo fdisk \/dev\/sda<\/code><\/pre>\n<p>\u5728<code>fdisk<\/code>\u4e2d\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u5206\u533a\u5e76\u5c06\u7c7b\u578b\u8bbe\u7f6e\u4e3a&#8221;Linux raid autodetect&#8221;\uff08\u7c7b\u578b\u4ee3\u7801<code>fd<\/code>\uff09\uff1a<\/p>\n<ul>\n<li>\u6309<code>n<\/code>\u521b\u5efa\u4e00\u4e2a\u65b0\u5206\u533a\u3002<\/li>\n<li>\u6309<code>p<\/code>\u9009\u62e9\u4e3b\u5206\u533a\u3002<\/li>\n<li>\u6309<code>1<\/code>\u9009\u62e9\u7b2c\u4e00\u4e2a\u5206\u533a\u3002<\/li>\n<li>\u4f7f\u7528\u9ed8\u8ba4\u7684\u8d77\u59cb\u6247\u533a\u3002<\/li>\n<li>\u5c06\u5927\u5c0f\u8bbe\u7f6e\u4e3a1TB\uff08<code>+1T<\/code>\uff09\u3002<\/li>\n<li>\u6309<code>t<\/code>\u66f4\u6539\u5206\u533a\u7c7b\u578b\u3002<\/li>\n<li>\u8f93\u5165<code>fd<\/code>\u8868\u793a&#8221;Linux raid autodetect&#8221;\u3002<\/li>\n<li>\u6309<code>w<\/code>\u5199\u5165\u66f4\u6539\u5e76\u9000\u51fa\u3002<\/li>\n<\/ul>\n<p>\u5bf9<code>\/dev\/sdb<\/code>\u91cd\u590d\u76f8\u540c\u7684\u6b65\u9aa4\uff0c\u4f46\u786e\u4fdd\u5206\u533a\u5927\u5c0f\u4e3a1TB\uff0c\u4ee5\u5339\u914d<code>\/dev\/sda<\/code>\u4e0a\u7684\u5206\u533a\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-735\" src=\"https:\/\/www.zhoubin.asia\/wp-content\/uploads\/2024\/07\/raid_format.jpg\" alt=\"\" width=\"1245\" height=\"374\" \/><\/p>\n<h3>\u6b65\u9aa44: \u521b\u5efaRAID\u9635\u5217<\/h3>\n<pre><code>sudo mdadm --create --verbose \/dev\/md0 --level=1 --raid-devices=2 \/dev\/sda1 \/dev\/sdb1<\/code><\/pre>\n<h3>\u6b65\u9aa45: \u521b\u5efa\u6587\u4ef6\u7cfb\u7edf<\/h3>\n<pre><code>sudo mkfs.ext4 \/dev\/md0<\/code><\/pre>\n<h3>\u6b65\u9aa46: \u6302\u8f7dRAID\u9635\u5217<\/h3>\n<pre><code>sudo mkdir -p \/mnt\/raid\r\nsudo mount \/dev\/md0 \/mnt\/raid<\/code><\/pre>\n<h3>\u6b65\u9aa47: \u66f4\u65b0fstab\u4ee5\u5b9e\u73b0\u81ea\u52a8\u6302\u8f7d<\/h3>\n<p>\u901a\u8fc7<code>sudo blkid \/dev\/md0<\/code>\u83b7\u53d6\u8bbe\u5907\u7684UUID\u3002<\/p>\n<p>\u5c06\u4ee5\u4e0b\u884c\u6dfb\u52a0\u5230<code>\/etc\/fstab<\/code>\uff1a<\/p>\n<pre><code>UUID= \/mnt\/raid ext4 defaults,nofail 0 0<\/code><\/pre>\n<p>\u56e0\u4e3a\u6211\u8fd9\u8fb9\u5c06\u989d\u5916\u76841TB\u5f04\u6210\u4e86<code>\/dev\/sdb2<\/code>\uff0c\u6240\u4ee5\u6211\u7cfb\u7edf\u4e2d<code>fstab<\/code>\u4e2d\u6709\u4e24\u884c\uff1a<\/p>\n<pre><code>UUID=e8d94613-399a-4c93-bfe9-a5ee41fe7381 \/mnt\/raid ext4 defaults,nofail 0 0\r\nUUID=68937d4e-8b14-4e6b-8a22-f4f7381039d4 \/mnt\/data ext4 defaults,nofail 0 0<\/code><\/pre>\n<h3>\u6b65\u9aa48: \u9a8c\u8bc1\u8bbe\u7f6e<\/h3>\n<pre><code>cat \/proc\/mdstat<\/code><\/pre>\n<h3>\u6b65\u9aa49: \u4fdd\u5b58RAID\u914d\u7f6e<\/h3>\n<pre><code>sudo mdadm --detail --scan | sudo tee -a \/etc\/mdadm\/mdadm.conf<\/code><\/pre>\n<h2>\u914d\u7f6eSamba<\/h2>\n<h3>\u6b65\u9aa41: \u5b89\u88c5Samba<\/h3>\n<pre><code>sudo apt update\r\nsudo apt install samba<\/code><\/pre>\n<h3>\u6b65\u9aa42: \u914d\u7f6eSamba<\/h3>\n<p>\u7f16\u8f91Samba\u914d\u7f6e\u6587\u4ef6\uff0c\u6dfb\u52a0\u5171\u4eab\u5e76\u6307\u5b9a\u7f51\u7edc\u8bbf\u95ee\u6743\u9650\u3002\u7528\u4f60\u559c\u6b22\u7684\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00<code>\/etc\/samba\/smb.conf<\/code>\u6587\u4ef6\uff1a<\/p>\n<pre><code>[raid]\r\npath = \/mnt\/raid\r\nbrowseable = yes\r\nread only = no\r\nguest ok = yes\r\nwritable = yes\r\n\r\n[data]\r\npath = \/mnt\/data\r\nbrowseable = yes\r\nread only = no\r\nguest ok = yes\r\nwritable = yes<\/code><\/pre>\n<h3>\u6b65\u9aa43: \u5176\u4ed6\u57fa\u672c\u6743\u9650\u7684\u914d\u7f6e<\/h3>\n<p>\u5c06\u76ee\u5f55\u7684\u6240\u6709\u6743\u8bbe\u7f6e\u4e3asamba\u7528\u6237\u6216\u7ec4\uff08\u901a\u5e38\u4f7f\u7528<code>nobody<\/code>\u548c<code>nogroup<\/code>\u8fdb\u884c\u6765\u5bbe\u8bbf\u95ee\uff09\uff1a<\/p>\n<pre><code>sudo chown -R nobody:nogroup \/mnt\/raid\r\nsudo chown -R nobody:nogroup \/mnt\/data<\/code><\/pre>\n<p>\u8bbe\u7f6e\u76ee\u5f55\u7684\u9002\u5f53\u6743\u9650\uff1a<\/p>\n<pre><code>sudo chmod -R 0777 \/mnt\/raid\r\nsudo chmod -R 0777 \/mnt\/data<\/code><\/pre>\n<h3>\u6b65\u9aa44: \u91cd\u542fSamba\u670d\u52a1<\/h3>\n<pre><code>sudo systemctl restart smbd<\/code><\/pre>\n<p>\u8fd9\u6837\u7684\u8bdd\uff0c\u6211\u4eec\u5728\u5c40\u57df\u7f51\u4e2d\u5176\u4ed6\u8bbe\u5907\u5c31\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee\u8fd9\u4e24\u4e2a\u76ee\u5f55\u4e86\u3002\u4f8b\u5982\uff1aWindows\u4e2d\uff0c\u5982\u679c\u9700\u8981\u8bbf\u95ee\u7684\u8bdd\uff0c\u76f4\u63a5\u5728\u6587\u4ef6\u680f\u8f93\u5165<code>\/\/192.168.0.2\/raid<\/code>\u6216\u8005<code>\/\/192.168.0.2\/data<\/code>\uff0c\u9700\u8981\u8f93\u5165Samba\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\u4e0e\u5bc6\u7801\u3002<\/p>\n<p>android\u4e0eIOS\u65b9\u9762\uff0c\u53ef\u4ee5\u5728\u7535\u89c6\u4e0a\u5b89\u88c5\u7b2c\u4e09\u65b9\u7684Kodi app\u6216\u8005\u5176\u4ed6\u652f\u6301Samba\u670d\u52a1\u7684app\uff0c\u8fd9\u4e9bapp\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7Samba\u53bb\u8bbf\u95ee\u670d\u52a1\u5668\u4e2d\u7684\u6587\u4ef6\uff0c\u4ece\u800c\u8fbe\u5230\u5bb6\u5ead\u5f71\u97f3\u7cfb\u7edf\u7684\u670d\u52a1\u3002<\/p>\n<p>\u540e\u7eed\uff0c\u53ef\u80fd\u4f1a\u8003\u8651\u589e\u52a0\u5982\u4f55\u5728\u5e7f\u57df\u7f51\u8303\u56f4\u5185\uff0c\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee\u5230\u8fd9\u4e2aSamba\u670d\u52a1\u5668\uff0c\u4ece\u800c\u5b9e\u73b0\u5728\u6237\u5916\u7684\u65f6\u5019\u62cd\u6444\u7684\u56fe\u7247\u4e0e\u89c6\u9891\u76f4\u63a5\u4f20\u8f93\u5230\u8fd9\u4e2a\u670d\u52a1\u5668\u4e2d\uff0c\u800c\u4e0d\u9700\u8981\u7b49\u5230\u56de\u5bb6\u4ee5\u540e\u518d\u4f20\u8f93\uff0c\u5b9e\u73b0\u7167\u7247\u89c6\u9891cloud\u81ea\u7531\u3002<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u56e0\u4e3a\u624b\u5934\u6709\u4e24\u4e2a\u79fb\u52a8\u786c\u76d8\uff0c\u8003\u8651\u5230\u5bb6\u91cc\u5c0f\u670b\u53cb\u7684\u7167\u7247\u6bd4\u8f83\u591a\uff0c\u60f3\u7740\u6b63\u597d\u901a\u8fc7\u4e24\u4e2a\u79fb\u52a8\u786c\u76d8\u6253\u9020\u4e00\u4e2a\u7b80\u6613\u7684RAID\u78c1\u76d8\u9635\u5217\uff0c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[1,12],"tags":[],"class_list":["post-734","post","type-post","status-publish","format-standard","hentry","category-tech","category-others"],"_links":{"self":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts\/734","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/comments?post=734"}],"version-history":[{"count":1,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts\/734\/revisions"}],"predecessor-version":[{"id":736,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts\/734\/revisions\/736"}],"wp:attachment":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/media?parent=734"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/categories?post=734"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/tags?post=734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}