Use a device over SSH?

14

2

I have 2 PCs with Ubuntu at home and a network link between them.

If I do

 $ sshfs pc2root@192.168.0.2:/ /media/pc2

can I use a remote device as a local one? (in this case: /media/pc2/dev/sr0 as a local DVD-RW). In the end, everything in Unixes is a file, right?

I did

 culebrón@culebrón:/dev$ sudo ln -s /media/pc2/dev/sr0 dvdrw

but without a success: Brasero and K3b don't see any DVD device.

I know, for most tasks, SSH and sshfs are more than enough, but would like to know if there's a general solution.

culebrón

Posted 2009-11-20T17:05:21.590

Reputation: 460

SSHFS cannot handle block devices. Look into Network Block Device if this is something you really need.

– Zaz – 2018-06-28T10:17:25.380

Answers

15

SSHFS does not work that way -- it handles files, but not devices. Everything is a file, but there are many types of files, including: regular files, directories, symbolic links, sockets, character devices, and block devices.

% ls -l /dev/sda
brw-r----- 1 root disk 8, 0 Oct  9 20:59 /dev/sda

The letter b indicates this is a block device. These types of files support ioctl in addition to the normal read and write functions. The purpose of ioctl is to allow a way to do "extra" operations to the device. These operations are different for each type of device: a DVD device can open/close its door, but an ethernet device cannot.

This is why the SSHFS software cannot make device files available over the network.

You will need a different system that is made for this purpose, something like webCDwriter.

Kevin Panko

Posted 2009-11-20T17:05:21.590

Reputation: 6 339

1I sort of can't believe webCDwriter is still around. – phresus – 2009-11-20T17:29:19.903

1I never tried it -- if it sucks, don't blame me :D – Kevin Panko – 2009-11-20T17:40:01.050

11

If you want to remotely access a block device, there is such a tool called 'nbd' (Network Block Device). I have used this in the past to clone a harddrive using dd if=/dev/nbd0 of=/dev/hda with reasonable success.

However, I doubt this will work for optical drives.

I think you'd be better off running the burning software locally on the remote machine (say with X or VNC), and have it pull files using regular file sharing mechanisms like samba or NFS.

Suppressingfire

Posted 2009-11-20T17:05:21.590

Reputation: 1 158

6

Linux/UNIX are not Plan 9. "Everything is a file" doesn't mean that they're all the same sort of files. FIFOs and device nodes being prime examples.

No, you cannot do it this way. My recommendation would be to use a virtual writer (celebron writes to an image, .iso or other) and pipe that to cdrecord over ssh.

phresus

Posted 2009-11-20T17:05:21.590

Reputation: 866

2

Brasero and K3b don't see a DVD device because your local computer's OS kernel doesn't see a DVD device.

Mounting filesystems remotely is easy; there are network protocols like CIFS, NFS, AFS, and even SSHFS to handle all the details of file access. But low-level device access is a different animal -- note that none of these protocols would allow, for example, repartitioning or reformatting the filesystem being accessed.

You would need a low-level protocol like iSCSI, FCoE (Fibre Channel over Ethernet), or ATAoE (ATA over Ethernet) to do what you want to do. This would involve driver-level software on the remote device to export the device, and driver-level software on the local device to attach to it. There's Windows software called Starport that claims this capability, and a Linux-iSCSI site that may give you more information about what's currently possible.

But generally, these technologies are used in corporate data centers with expensive hardware. For general home use, you really want to run Brasero on your remote computer and just display the GUI window on your local system (via X, VNC, or some other remote desktop technology).

quack quixote

Posted 2009-11-20T17:05:21.590

Reputation: 37 382

1AFAIK, iSCSI will not send ATAPI commands. Remote X, FreeNX, VNC are great sugggestions. – phresus – 2009-11-20T17:28:40.763

hmmm, maybe not, but burning to a remote optical device is given as an iSCSI example on the Starport site. might need a SCSI burner device for that tho. or use ATAoE, which (theoretically) should handle ATAPI just fine. – quack quixote – 2009-11-20T18:09:57.467