|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
Unable to mount: Inappropriate file type or format
My box was booted up with my USB 2.0 flash drive plugged into a USB 2.0 port.
I logged in as root, opened up a terminal and typed: Code:
mount /dev/sd1i /mnt/usb0 Code:
mount_msdos: /dev/sd1i on /mnt/usb0 : Inappropriate file type or format 1. The USB stick was formatted as ext2 on a Ubuntu machine using gparted 2. The same stick was formatted as fat32 on the same Ubuntu machine using gparted 3. It was formatted as fat32 on a Microsoft Windows 7 machine ntfs_3g-2014.2.15p0.tgz was installed on OpenBSD 5.8-beta |
|
|||
Quote:
# fdisk sd1 Code:
# fdisk sd1 Disk: sd1 geometry: 1897/255/63 [30489408 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA info: #: id C H S - C H S [ start: size ] ---------------------------------------------------------------- 0: 0B 0 32 33 - 1897 210 41 [ 2048: 30486528 ] Win95 FAT-32 1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused # disklabel sd1 Code:
# disklabel sd1 # /dev/rsd1c: type: SCSI disk: OpenBSD/amd64 label: 5.8 Install CD duid: 0000000000000000 flags: bytes/sector: 512 sectors/track: 63 tracks/cylinder: 255 sectors/cylinder: 16065 cylinders: 1897 total sectors: 30489408 boundstart: 0 boundend: 30489408 drivedata: 0 16 partitions # size offset fstype [fsize bsize cpg] a: 30489408 0 ISO9660 c: 30489408 0 ISO9660 # Quote:
# mount -t msdos /dev/sd1i /mnt/usb0 and the same error message, as posted in my original post, appeared.If you don't mind, I'd appreciate more help on this issue. |
|
|||
At the MBR level, the USB partition is hardcoded as 0B, Windows FAT-32.
disklabel however, interprets the the partition as being ISO9660, the filesystem for CD's. Is there an CD ISO image on the disk? According to your info, the historical formatting sequence is first ext2fs, followed by two times as FAT-32. So I wonder why you would need ntfs_3g-2014.2.15p0.tgz (NTFS) to access it Becaues mounting as FAT did not work, you could try mounting with mount_cd9660(8) as a last resort.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump Last edited by J65nko; 10th August 2015 at 07:32 AM. Reason: changed to mount_cd9660 |
|
||||
I believe this device has a disklabel image remaining from a time when an OpenBSD CD image was written to it. (Which is unlikely to have booted, as a USB stick is not an optical device.)
The mounts are failing, because the disklabel is being used. It has no "i" partition, and the single CD9660 filesystem begins at sector 0. The MBR that is likely to be correct shows a FAT partition beginning at sector 2048. --- To clear the bad disklabel, and replace it with a correct disklabel, you could use the disklabel(8) label editor with -d to ignore the on-disk disklabel: # disklabel -dE sd1 At the first disklabel editor prompt, the "p" command can be used to inspect the replacement disklabel, a virtual one created solely from the MBR partition table. > p If correct, it can be written to disk. > w > q --- Another alternative would be to zero out the leading sectors of the device, but that is brute-force. The device would need to be reformatted and data recopied. Here is an example command which will zero out the first megabyte of the device, which will remove both the MBR and, in this instance, the on-disk disklabel: # dd if=/dev/zero of=/dev/rsd1c bs=1m count=1 The on-disk disklabel sector location depends on the architecture and the location of an OpenBSD MBR partition, if present. Last edited by jggimi; 10th August 2015 at 08:27 AM. Reason: added explanation and alternatives |
|
|||
There used to be. I thought reformatting the USB drive would remove everything, including the disklabel. This whole episode shows me that my assumption was incorrect.
|
|
|||||
Quote:
Thanks, I learned something new today. Can we somehow force OpenBSD to NOT use the disklabel to mount the USB flash drive? Quote:
If it's incorrect, what shall I do? Quote:
Can I reformat it using "gparted" package installed on my Ubuntu machine? What data were you referring to that need to be recopied? Quote:
Is there a corresponding command in Linux? The reason is I need to zero out a USB 3.0 flash drive that I'll plug into a USB 3.0 port. Native support for USB 3.0 protocol is still patchy in OpenBSD. Quote:
Suppose an OpenBSD MBR partition IS present because yesterday I used OpenBSD 5.8-beta (amd64) to fdisk the USB drive in order to reformat it. Are you saying that # dd if=/dev/zero of=/dev/rsd1c bs=1m count=1 won't work?------ N.B.: Thanks for teaching me new stuff today. |
|
|||
An alternative sequence of commands would be to dd(1) either the miniroot.fs or install58.fs image to your hard drive according to the FAQ and then reformat the drive using newfs(8)
# This would brute force the MBR and then construct an msdos (vfat) partition. Anything on the drive is overwritten and lost. My drives have always mounted as msdos after using this sequence. |
|
||||||||||
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
However, there is one special partition letter: "c". Partition "c" is always reserved, and is "the entire, physical drive." Whether there is a disklabel on the drive, an MBR on the drive, or nothing on the drive. Quote:
Quote:
If there is no OpenBSD MBR partition, the disklabel (if on disk) will be in the first few sectors. If there is an OpenBSD MBR partition, the disklabel will be in the first few sectors of the MBR partition, following the PBR (Partition Boot Record). Zeroing out the MBR would zero out the reference to the OpenBSD MBR partition and its offset from zero. --- Creating a FAT 32 USB Stick on OpenBSD that can be used on Windows or other OSes. Device "sd1" is used in this example.
Last edited by jggimi; 10th August 2015 at 10:56 AM. Reason: typos, clarity. repeatedly. |
|
||||
Quote:
Quote:
jggimi posted while I was typing. His post post is better anyway. |
|
||||
I couldn't recreate your success doing this on a test vnd(4) device just now. An existing MBR gets wiped, and the drive ends up without an MBR on it, with the entire drive formatted as a FAT16 filesystem. It can be successfully mounted, but only when using partition "c" -- since there is no partitioning metadata on the drive.
|
|
|||
Quote:
Quote:
Doesn't the act of deleting partitions also eliminate/delete the MBR? Quote:
What is count=1 ? Can I omit "w" and simply type "q" to write and quit? Sorry, what is your definition of "virtual disklabel"? Is there a "real" disklabel as opposed to a virtual one? How do I find out the "real disklabel" of the USB flash drive? |
|
||||
Correct.
Quote:
Quote:
Quote:
Quote:
On any drive that has nothing but zeros in every sector, there will be no MBR and there will be no disklabel. Let's make that drive a USB Stick. Let's stick that completely zeroed drive into a Windows machine and tell it to format the thing as a FAT drive. Windows will write an MBR, and it will format a FAT partition. There won't be an OpenBSD disklabel on this drive. When you now move that drive to OpenBSD, the OS will discover there is only an MBR partition table on the drive, and no disklabel on it. Since there is no disklabel physically on the drive, it will use the MBR partition table entries to try to see if it recognizes any filesystems. Behold! It discovers an MBR partition, of type 0B, or one of the other partition types that might be used for "FAT" partititions. OpenBSD will not write an OpenBSD disklabel on the drive. But it will create one, in memory, so that the recognized foreign filesystem can be mounted. The mount(8) command will use the in-memory disklabel. That disklabel will not be written to disk unless you do so from the disklabel(8) program yourself. A multiboot install will also write a disklabel to disk, picking up any recognized filesystems. To reiterate: an MBR, if present, will first be used to determine the location of the OpenBSD MBR partition, if present, so that the disklabel can be located and read into memory. If there is no OpenBSD MBR partition, a disklabel will be looked for from whichever leading sector might hold it for that architecture. If there is a disklabel found, it will be used, and any other partitioning in the MBR partition tables will be ignored. Last edited by jggimi; 10th August 2015 at 12:35 PM. Reason: spelling |
|
|||
Yes, this time you succeeded in your re-clarification. A big thank-you for your time, patience and effort.
Quote:
Code:
dd if=/dev/zero of=/dev/rsd1c bs=1M and at the completion of the process, I switched over to OpenBSD,typed # disklabel sd1 and noticed there was a disklabel for my USB drive.Quote:
Thanks for the precious information. Is that what other *BSD operating systems do too, viz. ignore MBR partition tables when a disklabel is found? Would you know if Linux distros adopt the same approach? |
|
||||
That is what I meant, yes.
Quote:
Quote:
Quote:
Quote:
BSD began life on other architectures, and adapted to dealing with MBRs when ported to Intel platforms. As an example of this, OpenBSD is currently supported on 16 architectures. I believe that only 6 of these architectures use MBRs: amd64, armish, i386, landisk, macppc, and zaurus. That leaves 10 supported architectures that do not use them. There are active development efforts for 3 additional architectures, and I believe only 1 of those uses MBRs. NetBSD and FreeBSD also use disklabels, but there has been divergence both internally and operationally in the many years since the BSDs branched. Last edited by jggimi; 10th August 2015 at 04:55 PM. Reason: MBRs were invented for the IBM PC/XT and its new BIOS. |
|
||||
A little lab experimentation during lunch today resulted in a simplified step.
# disklabel -dw sd1 Will replace the disklabel with one containing the "c" partition and only recognized MBR partition filesystems, without using the disklabel editor. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
roundcubemail-1.1.0p0 - unable to open database file | Valus | OpenBSD Packages and Ports | 2 | 15th March 2015 10:54 AM |
Update problem with .xz file format | Crotalus | FreeBSD Installation and Upgrading | 6 | 28th February 2011 12:25 AM |
Unable to mount second hard drive | Roric | OpenBSD General | 3 | 15th February 2011 05:02 AM |
unable to get packages/INDEX file from selected media... | clovis | FreeBSD Installation and Upgrading | 5 | 11th August 2010 07:39 PM |
Jails - mount: /usr/home: No such file or directory | chris | FreeBSD General | 6 | 6th August 2008 10:47 PM |