[email protected] (Jeff) writes: >I've been reading the documentation and doing searches, and the impression = >that I get is that one needs to use entirely different tools to work with M= >BR vs GPT partitions, and that most of the documentation is specific to MBR= >. Is this true?
The distinction is not about MBR vs GPT. NetBSD uses two partitioning schemes: 1. BSD disklabel (e.g. wd0a, wd0b, wd0c, ...) 2. Wedges (e.g. dk0, dk1, dk2, ...) The BSD disklabel is limited to 32bit block numbers, for regular disks (with 512 byte sectors) that limits disk size to 2TB. The disklabel is usually stored on the disk but some architectures may use a virtual disklabel that is generated from other information. With wedges, every partition gets its own unit number, there is nothing like e.g. "dk0a". Wedges are usually generated from other information, the generic kernel supports GPT and Apple (MacOS) partition tables, but there are other options too. By default MBR isn't used anywhere, but with MBR you would use BSD disklabel and with GPT you would use wedges auto-generated from the GPT. MBR vs. GPT is more relevant for booting as e.g. a PC BIOS or UEFI firmware support either. >Based on advice I got elsewhere, I would like to put an ext2 filesystem on = >an existing partition that I can share between NetBSD and Gentoo on a dual = >boot system. The advice was to create the filesystem from in NetBSD. That's because NetBSD supports only part of the ext2/ext3/ext4 filesystems and creating the filesytem on NetBSD is the easiest way to have something understood by both systems. >- How do I learn what NetBSD calls the partition that I want to work with.= >=C2=A0 For instance, if "fdisk -l" in Linux tells me that it's /dev/sda4, w= >hat command can I run in NetBSD to find out what NetBSD calls it? It may not even be visible. A 'sda' device on Linux probably corresponds to a 'wd0' device on NetBSD, 'sdb' would be 'wd1', etc.. but that depends on the exact hardware. If you are using MBR partitioning, then: Linux uses MBR partitions directly, so you use /dev/sda1, /dev/sda2, etc for the partitions. On NetBSD you use the BSD disklabel, you have to add an entry for the MBR partition to the disklabel with the right offset, size and type. This can be done manually with the disklabel program, or you use the mbrlabel program to assist. The disklabel partitioned are named 'a' to 'p' (with 'a' to 'd' having special meanings). The name is then e.g. /dev/wd0e if you use the slot for partition 'e' in the disklabel. But that partition letter is something you assign in the disk label, it is independent of the partition number used by Linux. If you are using GPT partitioning, then: Linux uses GPT partitions directly and something like /dev/sda3 would be the third partition on the first disk. NetBSD uses wedge units 'dk0', 'dk1', etc but there is no 1:1 relationship and it's even possible (but unlikely for internal disks) that the unit numbers change from boot to boot. You can use e.g. 'dkctl wd0 listwedges' to show all wedge units that are located on disk 'wd0' (i.e. the first SATA disk). Since wedge units can change from boot to boot, most tools dealing with disks have another way to access them. Each wedge has a unique name, that is taken from e.g. the GPT and the tools interpret the syntax NAME=<partitonname> and translate it into the right /dev/dk123 unit for you. E.g.: % dkctl wd1 listwedges /dev/rwd1: 6 wedges: dk1: gossam-efi, 206814 blocks at 34, type: msdos dk2: gossam-root, 819200 blocks at 206848, type: ffs dk3: gossam-swap, 134217728 blocks at 1026048, type: swap dk4: gossam-usr, 67108864 blocks at 135243776, type: ffs dk5: gossam-var, 16777216 blocks at 202352640, type: ffs dk6: gossam-home, 3687899136 blocks at 219129856, type: ffs and an entry in /etc/fstab would look like: NAME=gossam-usr /usr ffs rw,log 1 2 N.B. If the GPT doesn't contain such names, there is always a UUID that is used as a default name. >- Once I know what identifier I should use in NetBSD to refer to the partit= >ion (or slice? wedge?), what tool(s) do I use to create the ext2 filesystem= > on it? The tool is named newfs_ext2fs. >- Are there any other steps or tools needed that would not occur to me, com= >ing from Linux? The only missing part might the 'gpt' tool that lets you create or edit the GPT stored on a disk.
