# The only dvd disk that mounts is the FreeBSD 13_0_RELEASE_AMD64_CD



## Clippers (Oct 23, 2021)

Why don't other dvd's mount?  Only the FreeBSD Release 13 DVD 1 will mount.
The system is newly rebooted
I placed a dvd, containing data files, into the dvd tray

```
# mount_cd9660 /dev/cd0 /dvd        
mount_cd9660: /dev/cd0: Invalid argument
```
I put the 13_0_RELEASE_AMD64_CD disk in the dvd tray and the dvd drive spins up and then display gpart info: 

```
root@godzilla:/etc # GEOM_PART: cd0 was automatically resized. 
Use ‘gpart commit cd0’ to save changes or ‘gpart undo cd0’ to revert them
g_dev_taste: g_dev_taste(iso9660/13_0_RELEASE_AMD64_CD) failed to g-attach, error=6
```
NOTE: At this point, `#  mount_cd9660 /dev/cd0 /dvd`    will mount the 13_0_RELEASE_AMD64_CD dvd successfully
but, I follow the instructions, instead, as follows:  

```
# gpart commit cd0 
(cd0:ata4:0:0:0): WRITE(10).  CDB: 2a 00 00 00 00 00 00 00 01 00 
(cd0:ata4:0:0:0): CAM status: SCSI Status Error
(cd0:ata4:0:0:0): SCSI status: check Condition
(cd0:ata4:0:0:0): SCSI sense: ILLEGAL REQUEST asc:21,0 (Logical block address out of range)
(cd0:ata4:0:0:0): Error 22, Unretryable error
(cd0:ata4:0:0:0): cddone: got error 0x16 back
(cd0:ata4:0:0:0): gpart:  Invalid argument
```
So, I do this:

```
# camcontrol inquiry cd0
pass1: <ASUS DRW-24B1ST  j 1.11> Removable CD-ROM SCSI device
ata4: FAILURE – odd-sized DMA transfer attempt 255 % 2
ata4:  setting up DMA failed 
pass1:  150,000MB/s transfers (SATA 1.x, UDMA5, ATAPI 12bytes, PIO 8291bytes
```


----------



## grahamperrin@ (Oct 23, 2021)

grahamperrin said:


> Ignore phrases such as _disc_ and _DVD_ within filenames in these areas (the images are *not* intended to fit on normal discs).
> 
> Re: <https://docs.freebsd.org/en/books/handbook/bsdinstall/#bsdinstall-usb> the advice for an .img file can equally apply to creating a USB flash drive from an .iso file.



FreeBSD bug 257347 – Outdated directions to use standard optical media (CDs, DVDs) for installation of FreeBSD


----------



## eternal_noob (Oct 24, 2021)

grahamperrin said:


> FreeBSD bug 257347 – Outdated directions to use standard optical media (CDs, DVDs) for installation of FreeBSD


I don't like how this important issue gets so ignored.


----------



## grahamperrin@ (Oct 24, 2021)

Generally, there's encouragement to provide patch files. Not my forté.


----------



## SirDice (Oct 26, 2021)

Clippers said:


> I placed a dvd, containing data files, into the dvd tray
> 
> ```
> # mount_cd9660 /dev/cd0 /dvd
> ...


This just shows that that specific DVD didn't use the ISO 9660 format. DVDs could also be formatted with UDF or even a filesystem like FAT, UFS or EXT2/3/4.



Clippers said:


> At this point, `# mount_cd9660 /dev/cd0 /dvd` will mount the 13_0_RELEASE_AMD64_CD dvd successfully


Yes, it works here because the installation media used the ISO 9660 filesystem format for both the CD and DVD images. 



Clippers said:


> but, I follow the instructions, instead, as follows:


You do realize that a CD/DVD is _read-only_ media? You're trying to update the partition table by _writing_ to a _read-only_ medium.


----------



## SirDice (Oct 27, 2021)

Clippers said:


> I appended /, /root, /etc, /dev onto the default path which seems to help ejecting the disk without receiving


Remove those again. The issue has nothing to do with your PATH settings. And adding /etc and /dev isn't going to help anything, there are no executables to run there. Adding / and /root is not helpful either. Again, there are no executables there. 



Clippers said:


> The problem is making mount work in /etc/fstab


Why? If there's nothing in the drive when you boot it's going to fail and drop you to single user mode. You could add it with the `noauto` option, but you're still going to have an issue if you happen to use a disk that has a different format.



Clippers said:


> In particular, the BDS handbook says when a optical disc contains data, then by default, mount(8) assumes that a filesystem is of type ufs.


No, unless specified otherwise the mount(8) command is going to assume UFS. That's why it has a `-t` option:


```
-t [no]type[,type ...]
             The argument following the -t is used to indicate the file system
             type.  The type ufs is the default.  The -t option can be used to
             indicate that the actions should only be taken on file systems of
             the specified type.  More than one type may be specified in a
             comma separated list.  The list of file system types can be
             prefixed with no to specify the file system types for which
             action should not be taken.  For example, the mount command:

                   mount -a -t nonfs,nullfs

             mounts all file systems except those of type NFS and NULLFS.

             The default behavior of mount is to pass the -t option directly
             to the nmount(2) system call in the fstype option.

             However, for the following file system types: cd9660, mfs,
             msdosfs, nfs, nullfs, smbfs, udf, and unionfs mount will not call
             nmount(2) directly and will instead attempt to execute a program
             in /sbin/mount_type where type is replaced by the file system
             type name.  For example, nfs file systems are mounted by the
             program /sbin/mount_nfs.

             Most file systems will be dynamically loaded by the kernel if not
             already present, and if the kernel module is available.
```




Clippers said:


> But, if BSD assumed a data disk is udf by default, why do I receive, mount: /dev/cd0: No such file or directory, when I attempt the mount with: #mount /dev/cd0 /dvd ?


Again, mount(8) assumes UFS unless you specify otherwise.

Assuming you have put this in /etc/fstab:

```
/dev/cd0 /dvd udf noauto rw 0 0
```
Then you can mount this with `mount /dvd`. There is a difference between executing `mount /dev/cd0 /dvd` (which doesn't look at fstab) and `mount /dvd` (which does lookup the /dvd in fstab).


----------



## Clippers (Oct 27, 2021)

Thank you for your help, but I still have a ways to go. I am using a clean install of BSD 13.0, default options, and no additional programs/modifications except in /root/.cshrc and I use TCSH. I appended /, /root, /etc, /dev onto the default path which seems to help ejecting the disk without receiving: Error received from stop unit command; and, I added a few TCSH alias, including camcontrol to eject the optical tray. The good news is that # mount_udf /dev/cd0 /dvd and # mount_cd9660 /dev/cd0 /dvd work correctly. Unfortunately, since the handbook (3.7.1) says the default BSD file system is ufs, it prevents me from mounting a data disk in udf format at the console by using the shorter form # mount /dev/cd0 /dvd

The problem is, in particular, the entry in /etc/fstab. Man mount(8) says for file types, blah, blah, msdosfs, udf, cd9660, mount will not call nmount(2) but will attempt to execute a program in /sbin/mount_type where type is replaced by the file system type name. In fstab, the file system type is specified as udf, and /sbin contains mount_udf, and yet the mount command does not work from fstab. Can you shed light on how fstab processes the mount differently than it is processed if entered on the console? This is what happens in fstab:

```
/dev/cd0 /dvd udf noauto rw 0 0
# mount -av
fstab: /etc/fstab:6: Inappropriate file type or format (* line 6 is the cd0 mount).
```

I've tried but I cannot correct the entry for fstab to work. Of course, as a work around, I can assign the mount command to a shell alias. But without the support of fstab, I cannot use automountd. Can you suggest a cd0 mount to use in fstab? I've gone so far as to add, option ‘udf # udf FS’ to GENERIC, rebuild and install, but it didn't have any effect on the operation of fstab.


----------



## SirDice (Oct 27, 2021)

```
/dev/cd0 /dvd udf noauto rw 0 0
```
Options need to be separated by commas. And you can't mount a CD/DVD read-write, it's a _read-only_ medium. You require an application like cdrecord(1) to write to CD/DVDs. You can't simply use it as a read-write medium the same way you can with a (hard, floppy, solid-state, flash) disk. 

```
/dev/cd0 /dvd udf ro,noauto 0 0
```


----------



## Clippers (Oct 27, 2021)

I would like you to be correct.  If you look at the default /etc/fstab you will see this:
/dev/ada0p1   /boot/efi      <blank>   msdosfs rw   2   2     
In other words, no it does not use commas.  In fact, I tried using comma but it errored out.
Are you absolutely sure?  It may be that I can use a comma if a space follows it.  If so, then it's not that a comma is needed, it's that a space is needed


----------



## SirDice (Oct 27, 2021)

Clippers said:


> I would like you to be correct. If you look at the default /etc/fstab you will see this:
> 
> ```
> /dev/ada0p1 /boot/efi <blank> msdosfs rw 2 2
> ...


Yes, and that's correct. You, however, put this in fstab:

```
/dev/cd0 /dvd udf noauto rw 0 0
```
The `noauto` and `rw` are options. Those need to be comma separated, not space separated as you're showing here. It should be this:

```
/dev/cd0 /dvd udf noauto,rw 0 0
```
The format is:

```
diskdevice <space> mountpoint <space> filesystem <space> options <space> dump <space> pass
```
If you have more than one option those need to be comma separated:

```
device <space> mountpoint <space> filesystem <space> option1,option2,option3 <space> dump <space> pass
```


----------



## Clippers (Oct 27, 2021)

Thanks, as usual, you were correct, again.


----------



## astyle (Oct 27, 2021)

SirDice said:


> The `noauto` and `rw` are options. Those need to be comma separated, not space separated as you're showing here. It should be this:
> 
> ```
> /dev/cd0 /dvd udf noauto,rw 0 0
> ```


Really? according to the Handbook, a tab is plenty. I use tabs in my /etc/fstab, and it works fine.


----------



## SirDice (Oct 27, 2021)

astyle said:


> Really? according to the Handbook, a tab is plenty. I use tabs in my /etc/fstab, and it works fine.


Strictly speaking; Fields are separated by _whitespace_ (so one or more tabs and/or one or more spaces is accepted), _options_ however need to be comma separated. There is a difference here. I was referring to the fourth field, the options.

```
Each file system is described on a separate line; fields on each line are separated by tabs or spaces.
```


```
The fourth field, (fs_mntops), describes the mount options associated
     with the file system.  It is formatted as a comma separated list of
     options.
```


----------

