Journal eno2001's Journal: TOPIC: Pop 3 (Pop it in the drive...) 2
Have you ever been frustrated that you've got a nice DVD drive in one Linux box and not the other and wished there was a way to have another box access it as if it were in the box itself? Me too. Our wishes have been granted. (We're not talking file sharing here or NFS. We're talking direct, low level access to a remote drive over the network as if it were in the box) Read on...
As many of my one or two readers know, I'm a HUGE fan of virtualization. I started out with VMWare pretty much from when they first went into business and moved to Xen within the past two years. One of the things I've been wanting to delve into is centralized storage at home for my Xen VMs. Much nicer to have everything in one place on a hardware RAIDed system that does automated nightly disk-to-disk backups and has automated off-site backups via rsync. Keep in mind that I'm just talking plain old home PCs here. Not enterprise level stuff at all. Anyone who knows their way around Linux really well can make this a reality at home and experience the multiple benefits (hardware cost savings, more efficient use of your computing resources, space savings,etc...) of virtualization. But this JE is NOT about virtualization. It's about something else entirely that I discovered and played with last night quite successfully and simply. I'll get to that in a bit.
While reading through the Xen documentation a few years ago, I saw that they mentioned that your VMs could have their storage backed by a variety of methods. One of the methods intrigued me. They mentioned something called NBD. I had no idea at that point, what that was. It stands for "Network Block Devices" and is part of Linux kernel. You can either build it into the kernel or as a module as is the norm. I use the 2.6 series kernels and the NBD support can be found here:
DEVICE DRIVERS-->BLOCK DEVICES-->Network Block Device Support
You also need the nbd-server and nbd-client software which can be found here: http://sourceforge.net/project/showfiles.php?group_id=13229. The main project page is here: http://nbd.sourceforge.net/. Most of what you need to know is in the README file included with the source code and in the man pages for nbd-server and nbd-client.
I was experimenting with NBD last night in order to begin moving ahead with my virtualization schemes for home using Xen and my new AMD64 with hardware virtualization support. And when I was reading the README file, I noted that they mentioned remote access to ANY kind of block device including CD-ROMs. Not just
1. Compiled in the NBD support on my media center and my notebook in module form
2. Did the usual
3. Modprobed the nbd kernel module so that the kernel would recognize the NDB devices
4. Created the device nodes in
5. Then on the laptop I popped in a DVD and typed: 'nbd-server -r 2000
6. On the media center PC I typed: 'nbc-client nc6220.mydomain.private 2000
7. I manually set the perms/owner/group on
8. I then ran Xine and configured it's DVD device to be
My original plan with my media center was to get a USB DVD drive and plug it into the extension hub I have in the living room. But, we also keep a laptop next to the sofa all the time and it's wireless with a DVD drive in it. This solution is not only free and super cool (a wireless DVD player!) but on a pracitcal level it would look better than having a USB cable coming down from behind the wide-screen monitor to a DVD drive. If you've got questions, I'll try and answer them. For the security nuts out there, yeah, this is all totally insecure at the moment. But there is a way to limit the hosts that can access the NBD exported devices. I'll likely explore those features. My first order of business is to write up some scripting that will allow me to just pop a DVD into the laptop and have it automatically export the DVD drive and then automatically run Xine on the media center so it's as seamless as possible. Another script will unexport and then eject the DVD and I might actually put that on the media center PC so that the only thing the latop really seems like in this one respect is just a wireless DVD drive that you pop the DVD into.
When I got my crazy idea last night, I didn't think it would really work well if at all since I find wireless to be very slow compared to my gigabit network. I also expected that the data flow from the DVD drive would be somewhere areound 100 to 250 Mb/s. I guess I was wrong. I'm sure it wouldn't work on an 802.11b system. But I'll be damned if it doesn't work on 802.11g! The only glitch I had was at the very beginning of the movie after hitting the "Play" link from the DVD navigation menu. For about a second or two there was a slight pause and then the movie played smoothly for the next 30 minutes that I spent watching it. I honestly didn't expect it to work. Of course it totally sidetracked me from my virtualization project, but this was just TOO cool. My house is really starting to work out the way I want it to with the way I'm borgifying it.
Sweet! (Score:2)
That's a cool setup you have there. :) I'll keep that in mind as I'm bound to either find a use for that in the future, or try it out just for the heck of it.
I really want to get into Xen VMs as well. I just recently made a major upgrade to my desktop though, and so I'm not ready to replace it or add another PC that has a processor with hardware virtualization. (Current desktop has an Athlon64 3700 clawhammer core proc in it - its still plenty fast enough for me).
Re: (Score:2)