View Single Post
  #7   (View Single Post)  
Old 3rd September 2017
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,984
Default

Assumed:
  • You are starting with a zeroed 2TB drive.
  • You want to have a 2TB FAT32 partition on this disk drive, for sharing files between OpenBSD and your Mac.
FAT32 partitions have two key size limitations, which you should be aware of:
  1. The total capacity of a FAT32 filesystem is 2TB on a drive with 512-byte sectors, or 16TB on a drive with 4096-byte sectors.
  2. Individual files are limited to one byte under 4GB in size, regardless of the size of the filesystem or the drive's sector size.
If the individual file size limit is not a factor, you may proceed with this relatively simple solution: Use OpenBSD's fdisk(8) to create an MBR partition table containing a single 2TB FAT32 partition, and only ever use a virtual disklabel partition to adddress it.

The fdisk(8) and newfs_msdos(8) man pages will be helpful.

You will begin by using fdisk(8) to create an MBR with a single OpenBSD partition, then edit this MBR partition type so that it is defined as FAT32. You will complete the process by formatting the partition as FAT32 using newfs_msdos(8).
  1. Start the fdisk(8) program with the -e option to start its interactive editor. If the 2TB drive is attached as sd1 as noted above, the command is:

    # fdisk -e sd1
  2. Instruct fdisk to create a new MBR, with a partition table containing a single OpenBSD MBR partition in the last partition table entry extending the length of the entire drive excepting a leading set of sectors for boot blocks:

    fdisk: 1> reinit mbr

    You will see the output of the newly created partition table. The last entry will be an OpenBSD partition of type A6.
  3. Modify the OpenBSD partition (number 3, as the first empty partition is number 0) with:

    fdisk:*1> e 3
  4. You will be prompted for a partition type. Select type 0C, which is the MBR partition type used for FAT32 partitions with long file names:

    Partition id ('0' to disable) [01 - FF : [A6] (? for help) c
  5. You will be asked if you wish to edit in CHS mode. Press ENTER to take the default response of "n" for "No."
  6. You will be asked if you want to revise the partition's starting offset. Press ENTER to leave this unchanged.
  7. You will be asked if you want to revise the partition's size. Press ENTER to leave this unchanged.
  8. Swap this newly revised partition 3 with partition number 0, so that the MBR partition is in the first position, rather than the last. Some operating systems may only recognize the MBR partition if it is in the first postion.

    fdisk:*1> swap 0 3
  9. Confirm your newly edited partition is in the first position:

    fdisk:*1> p
  10. Write the MBR and the partition table to the disk:

    fdisk:*1> w
  11. Quit the fdisk(8) program:

    fdisk: 1> q
  12. OpenBSD will scan the MBR partition table and assign virtual disklabel partition "i" to this newly created partition. You may now format it with newfs_msdos(8) as FAT32:

    # newfs_msdos -F 32 sd1i
Reply With Quote