TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: go-nbd – A Pure Go NBD Server and Client

113 点作者 pojntfx大约 2 年前
Hey HN! I just released go-nbd, a lightweight Go library for effortlessly creating NBD servers and clients. Its a neat tool for creating custom Linux block devices with arbitrary backends, such as a file, byte slice or what I&#x27;m planning to use it for, a tape drive. While there are a few partially abandoned projects like this out there already, this library tries to be as maintainable as possible by only implementing the most recent handshake revision and baseline functionality for both the client and the server, while still having enough support to be useful.<p>I&#x27;d love to get your feedback :)

9 条评论

davidjfelix大约 2 年前
NBD = network block device. Hope I saved somebody a google.
评论 #35361786 未加载
评论 #35361309 未加载
评论 #35362871 未加载
评论 #35365665 未加载
评论 #35360545 未加载
rkeene2大约 2 年前
NBD is a simple protocol, I used it to recover a RAID5 hardware array that lost parity [0] [1], in just a few lines of C.<p>[0] <a href="https:&#x2F;&#x2F;dev.to&#x2F;rkeene&#x2F;raid5-lost-raid5-recovered-3kld" rel="nofollow">https:&#x2F;&#x2F;dev.to&#x2F;rkeene&#x2F;raid5-lost-raid5-recovered-3kld</a><p>[1] <a href="https:&#x2F;&#x2F;www.rkeene.org&#x2F;projects&#x2F;info&#x2F;resources&#x2F;diatribes&#x2F;bloglog&#x2F;raid5&#x2F;raid5d.c" rel="nofollow">https:&#x2F;&#x2F;www.rkeene.org&#x2F;projects&#x2F;info&#x2F;resources&#x2F;diatribes&#x2F;blo...</a>
评论 #35369379 未加载
cellularmitosis大约 2 年前
Very cool! I&#x27;m curious if you&#x27;ve explored testing error cases yet? Years ago I fooled around with nbdkit and developed a &quot;bad sectors&quot; and &quot;bad disk&quot; plugin and found that the error handling around these scenarios left a little to be desired.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;pepaslabs&#x2F;nbdkit-baddisk-plugin">https:&#x2F;&#x2F;github.com&#x2F;pepaslabs&#x2F;nbdkit-baddisk-plugin</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;pepaslabs&#x2F;nbdkit-badsector-plugin">https:&#x2F;&#x2F;github.com&#x2F;pepaslabs&#x2F;nbdkit-badsector-plugin</a>
评论 #35361662 未加载
Thaxll大约 2 年前
You should probably defer mutex unlock() and not use naked returns: <a href="https:&#x2F;&#x2F;github.com&#x2F;pojntfx&#x2F;go-nbd&#x2F;blob&#x2F;main&#x2F;pkg&#x2F;backend&#x2F;file.go#L17">https:&#x2F;&#x2F;github.com&#x2F;pojntfx&#x2F;go-nbd&#x2F;blob&#x2F;main&#x2F;pkg&#x2F;backend&#x2F;file...</a><p>Defering overhead is very small nowdays.
评论 #35361072 未加载
latchkey大约 2 年前
Since this heavily involves networking, take a look into using gnet [0]. You might find some interesting performance improvements by using that over just net.Conn.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;panjf2000&#x2F;gnet">https:&#x2F;&#x2F;github.com&#x2F;panjf2000&#x2F;gnet</a>
评论 #35361863 未加载
评论 #35360845 未加载
coppsilgold大约 2 年前
I use NBD for my single-user NAS. You can use FDE (full disk encryption, luks) client-side.<p>The system managing the physical block devices never sees unencrypted data.<p>Such a setup shines when you use a laptop as your main machine and wish to have a lot of secure storage. The approach I chose was to bond ethernet &amp; wifi6e, use wireguard (w&#x2F; PSK). And wonder the house with uninterrupted access.
评论 #35368912 未加载
rvalles大约 2 年前
NBD is fairly simple. I wrote a minimal server in Python[0]. It is just a few lines.<p>0. <a href="https:&#x2F;&#x2F;github.com&#x2F;rvalles&#x2F;pyamigadebug&#x2F;blob&#x2F;master&#x2F;NBDServer.py">https:&#x2F;&#x2F;github.com&#x2F;rvalles&#x2F;pyamigadebug&#x2F;blob&#x2F;master&#x2F;NBDServe...</a>
评论 #35370668 未加载
lenkite大约 2 年前
I misread this as NZB for usenet and was excited someone had written one in Go.
i5heu大约 2 年前
NBD = <a href="https:&#x2F;&#x2F;de.wikipedia.org&#x2F;wiki&#x2F;Network_Block_Device" rel="nofollow">https:&#x2F;&#x2F;de.wikipedia.org&#x2F;wiki&#x2F;Network_Block_Device</a>
评论 #35360956 未加载
评论 #35362073 未加载