diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2022-09-26 14:53:16 +0100 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2022-09-26 14:53:16 +0100 |
commit | 21d193aea337380cb31e15d9022d22d4c1a4d66c (patch) | |
tree | 3e828a74ac343f37b5f3a5509304ce5e8231dd87 | |
parent | c87dc8c0f5c57a71a7eb7e054d2f380bd7913998 (diff) | |
parent | b2fe0628fbef03902773f529736bddefb9d62fa6 (diff) |
Merge branch 'master' of github.com:yulqen/yulqen.org
-rw-r--r-- | content/blog/trouble_with_usb_drives_in_openbsd.md | 36 | ||||
-rw-r--r-- | content/stream/2022_09_13.md | 9 |
2 files changed, 41 insertions, 4 deletions
diff --git a/content/blog/trouble_with_usb_drives_in_openbsd.md b/content/blog/trouble_with_usb_drives_in_openbsd.md index bc16237..ce4f0c3 100644 --- a/content/blog/trouble_with_usb_drives_in_openbsd.md +++ b/content/blog/trouble_with_usb_drives_in_openbsd.md @@ -1,9 +1,9 @@ --- title: "Trouble with USB drives in OpenBSD" date: 2022-09-13T08:31:41+01:00 -draft: true +draft: false categories: ['Computing'] -tags: ['openbsd'] +tags: ['openbsd', 'linux'] --- Coming from a Linux background, creating drives on OpenBSD is a little weird. @@ -20,7 +20,7 @@ FAT32, I thought. Great. Creating a FAT32 drive in OpenBSD is of course doable. -Of course I believed that you needed to have a MBR on the drive, so I ran `fdisk -iy sd3` to create the default OpenBSD `A6` meta partition. (I go the device name from doing `sysctl hw.disknames`). +Of course I believed that you needed to have a MBR on the drive, so I ran `fdisk -iy sd3` to create the default OpenBSD `A6` meta partition. (I got the device name from doing `sysctl hw.disknames`). Then I created a new `i` parition: `disklabel -E sd3`, `a i`, `w`, `q`. @@ -28,4 +28,32 @@ Next, the file system: `newfs_msdos -F 32 /dev/sd3i`. This last command did't produce any output, it just quit after thirty seconds or so. From my experience, `newfs` can take time, so I wasn't concerned about the time it took, but there was a problem. -After running `newfs` and running `disklabel -h sd3`, I saw that the `i` partition was gone. +After running `newfs` and running `disklabel -h sd3`, I saw that the `i` partition was gone and of course as a result I was unable to mount or do anything with the disk. + +At that point, I tried a few things, including formatting the partition using `newfs_ext2fs`, but that seemed to hang completely without doing anything at all. + +Stuck. + +It was then that I decided to look at a FAT 32 drive I was already using for my ~/Music folder, managed using `beets`. +I couldn't remember whether I created this drive in Linux or OpenBSD but I knew it was a FAT32 drive, mounted using `mount_msdos`. + +The interesting and surprising thing was that `fdisk sd2` revealed that it did *not* have a `A6` OpenBSD parition on it. Nothing. +`disklabel -h sd2` revealed an `i` partition of type `MSDOS` which is what I would have expected. +How was this? +Does a USB drive not require a MBR? Surely it needs a partition table, albeit the "boot" element of Master Boot Record is probably notable. + +And here is demonstrated my lack of knowledge about operating systems, particularly the boot process. No shame in that - no one is really supposed to know this stuff that doesn't have a computer science degree or is a sysadmin of sorts. + +So I decided I need to try and replicate the situation I could see with my Music drive. +To do this, I used `dd if=/dev/zero of=/dev/sd3 bs=1M`, but I didn't need it all doing so I quit after ten minutes (probably just needed to zero out the beginning of the drive with `count=1` but, as I said, what do I know?). + +`fdisk sd3` proved that the `A6` partition was gone. + +I repeated the steps, creating a new `i` parition and formatted the drive. +This time it worked. + +I could mount the drive on OpenBSD and on Linux, but without a partition number, which is very very weird to me: `mount /dev/sde`. +I have no idea if what I am doing breaks some universal law or it entirely congruent with one that I have no knowledge of. +Clearly the latter. + +Either way, I got my drive. diff --git a/content/stream/2022_09_13.md b/content/stream/2022_09_13.md new file mode 100644 index 0000000..e801a9e --- /dev/null +++ b/content/stream/2022_09_13.md @@ -0,0 +1,9 @@ +--- +title: "2022_09_13" +date: 2022-09-13T09:28:53+01:00 +draft: false +--- + +Lovely bright day today. + +A *great* day to release a [hastily-written blog post](../blog/trouble_with_usb_drives_in_openbsd) on formatting USB sticks. |