Re: [Nbd] determining next free nbd device
- To: Paul Clements <paul.clements@...856...>
- Cc: "nbd-general@lists.sourceforge.net" <nbd-general@lists.sourceforge.net>
- Subject: Re: [Nbd] determining next free nbd device
- From: Michal Belczyk <belczyk@...1274...>
- Date: Wed, 2 Oct 2013 09:04:49 +0200
- Message-id: <20131002070449.GN90362@...1273...>
- In-reply-to: <CAECXXi7C5RsWULQke=H-GoVwSdyVg-1dUrOm30n_trGmwu5Ldg@...18...>
- References: <CAONrwUFBRk2qLXF7qYmqsQ8x6Oa95Qc4yUgNTxOWZcaLzv0-TA@...18...> <CAECXXi7C5RsWULQke=H-GoVwSdyVg-1dUrOm30n_trGmwu5Ldg@...18...>
On Tue, Oct 01, 2013 at 04:27:14PM -0400, Paul Clements wrote:
> > Rather than looping over all nbd devices until I find one free to use, I
> > wondered if there's a way to immediately get the first free nbd device.
> >
> Also, the sysfs pid file is only present when the nbd is connected (i.e.,
> an nbd-client is running):
>
> debian-i386~$ cat /sys/block/nbd5/pid
> 18172
>
> debian-i386~$ ls -l /sys/block/nbd0/pid
> ls: cannot access /sys/block/nbd0/pid: No such file or directory
This is exactly what nbd-client -c does, right?
Scripted but without auto-find-unused-nbdX logic:
http://code.belo.io/bnbd/src/92bda8cb3cc1a0e4ab1727a55cccc68982ddd4d0/scripts/bnbd-client.sh?at=master
--
Michal Belczyk Sr.
Reply to: