Skip to contentSkip to conversation

SCSI DVD-RAM partitions

DISCUSSION Thomas Heinz 2 participants 5 messages Jul 9, 2005 – Aug 5, 2005

lore
Share & tools
lore
#0 lore raw

Hi

My SCSI DVD-RAM is available as /dev/sr1. fdisk -l /dev/sr1 shows for a certain medium:

Note: sector size is 2048 (not 512)

Disk /dev/sr1: 2496 MB, 2496430080 bytes 255 heads, 63 sectors/track, 75 cylinders Units = cylinders of 16065 * 2048 = 32901120 bytes

Device Boot Start End Blocks Id System
/dev/sr1p1 * 1 75 2409624 b W95 FAT32

Note that /dev/sr1p1 does not exist. Neither does /dev/sdX.

Mounting /dev/sr1 does not work. However, I was able to mount the partition with the following "trick":

# losetup -o 129024 /dev/loop0 /dev/sr1
# mount /dev/loop0 /mnt

Is it possible to make the DVD-RAM partitions available as device nodes (or at least directly mountable without the losetup hack)? One solution would be to make the device available as /dev/sdX and /dev/srX. Is that possible?

Thanks for your help. If this is a known issue, I would appreciate a pointer on that topic.

Here is some more information about my system:

Linux version 2.6.11-gentoo-r9 (root@localhost) (gcc version 3.3.5-20050130 (Gentoo Hardened 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1))

Host: scsi0 Channel: 00 Id: 04 Lun: 00
Vendor: MATSHITA Model: PD-2 LF-D100 Rev: A113
Type: CD-ROM ANSI SCSI revision: 02

Regards,

Thomas

#1 lore raw
Quoted 4 lines · Thomas Heinz

Is it possible to make the DVD-RAM partitions available as device nodes (or at least directly mountable without the losetup hack)? One solution would be to make the device available as /dev/sdX and /dev/srX. Is that possible?

While adding support for partitions on sr is trivial it has a huge
drawback: it's chaning the dev_t space by using up device numbers for partitions, so /dev/sr0 ff will have different device numbers with that change applied. I have an old patch that's supposed to enable support for partitioned scsi removable devices at
http://rechner.lst.de/~hch/hacks/sr-parts.diff, I'm not sure it actually ever worked (but you should get the basic idea from it)

#2 lore raw

Hi Christoph

Quoted 7 lines · You

While adding support for partitions on sr is trivial it has a huge
drawback: it's chaning the dev_t space by using up device numbers for partitions, so /dev/sr0 ff will have different device numbers with that change applied. I have an old patch that's supposed to enable support for partitioned scsi removable devices at
http://rechner.lst.de/~hch/hacks/sr-parts.diff, I'm not sure it actually ever worked (but you should get the basic idea from it)

Ok, thanks for your valuable input. In fact, I thought about making the device available both as /dev/srX and /dev/sdX at the same time in order to support partitions. In my case it would even suffice to make it available as /dev/sdX instead of /dev/srX.

Since I have no expert knowledge about this topic, I would be interested in the general attitude towards "partitions on SCSI DVD-RAM media / SCSI removable devices":
- Are partitions intentionally not supported? If so, why?
- Does it usually work but not with my specific DVD-RAM model? If so, why?
- Do you think that this should be fixed?

Please note that personally, I can live with the "losetup hack" since it is easy enough to write a program which encapsulates partition mounting. However, there might be people which would prefer plugging in a (possibly pre-)partitioned medium and having the partitions work out of the box in the expected way.

Regards,

Thomas

#3 lore raw
Quoted 11 lines · Thomas Heinz

Hi Christoph

Quoted 7 lines · You

While adding support for partitions on sr is trivial it has a huge
drawback: it's chaning the dev_t space by using up device numbers for partitions, so /dev/sr0 ff will have different device numbers with that change applied. I have an old patch that's supposed to enable support for partitioned scsi removable devices at
http://rechner.lst.de/~hch/hacks/sr-parts.diff, I'm not sure it actually ever worked (but you should get the basic idea from it)

Quoted 4 lines

Ok, thanks for your valuable input. In fact, I thought about making the device available both as /dev/srX and /dev/sdX at the same time in order to support partitions. In my case it would even suffice to make it available as /dev/sdX instead of /dev/srX.

That doesn't make sense because sd is a very different driver from sd. Besides that aliasing different dev_ts to the same underlying blockdevice can't work, it's cause all sorts of aliasing problems.

Quoted 4 lines

Since I have no expert knowledge about this topic, I would be interested in the general attitude towards "partitions on SCSI DVD-RAM media / SCSI removable devices":
- Are partitions intentionally not supported? If so, why?

Historical coincidence.

Quoted 3 lines

- Does it usually work but not with my specific DVD-RAM model? If so, why?
- Do you think that this should be fixed?

There's no nice way to fix it unfortunately.

Quoted 5 lines

Please note that personally, I can live with the "losetup hack" since it is easy enough to write a program which encapsulates partition mounting. However, there might be people which would prefer plugging in a (possibly pre-)partitioned medium and having the partitions work out of the box in the expected way.

It would probably be better to use device-mapper than the loop device. I think there's already userland partition parsing code for dm, and having a simple command line tool to do that, and maybe even automatically run through udev and creating /dev/sr<num>p<partition> devices would be very nice to have as an almost invisible workaround.

#4 lore raw

Hi Christoph

Quoted 8 lines · You
Quoted 4 lines

Ok, thanks for your valuable input. In fact, I thought about making the device available both as /dev/srX and /dev/sdX at the same time in order to support partitions. In my case it would even suffice to make it available as /dev/sdX instead of /dev/srX.

That doesn't make sense because sd is a very different driver from sd. Besides that aliasing different dev_ts to the same underlying blockdevice can't work, it's cause all sorts of aliasing problems.

Ok.

Quoted 5 lines

It would probably be better to use device-mapper than the loop device. I think there's already userland partition parsing code for dm, and having a simple command line tool to do that, and maybe even automatically run through udev and creating /dev/sr<num>p<partition> devices would be very nice to have as an almost invisible workaround.

Ok, that sounds reasonable. I have not yet searched for the partition parsing code for dm but it should not be too hard to write this on one's own. However, it is not clear to me whether this would work automatically, i.e. insert dvd-ram medium -> udev event is triggered -> device nodes are created via dmsetup.

Will there some (udev) event be triggered once a dvd-ram medium is inserted?

Moreover, some event would have to be triggered if the dvd-ram medium is removed in order to delete the device nodes.

Regards,

Thomas