no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | netbsd_partitioning [2013/06/21 19:40] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== NetBSD Partitioning ====== | ||
+ | * [[NetBSD]] | ||
+ | * [[disklabel]] | ||
+ | * [[fdisk]] | ||
+ | * [[sysctl]] | ||
+ | |||
+ | ==== MBR Partitions ==== | ||
+ | |||
+ | Coming from Linux, setting up partitions in NetBSD is quite different. | ||
+ | |||
+ | For example, in a Linux setup with MBR, you may have something that looks like this: | ||
+ | |||
+ | ^ Device ^ Type ^ Mount ^ System ^ | ||
+ | | /dev/sda1 | ext2 | /boot | Linux ^ | ||
+ | | /dev/sda2 | swap | | Linux swap ^ | ||
+ | | /dev/sda3 | ext4 | / | Linux ^ | ||
+ | |||
+ | In this example, ''/ | ||
+ | |||
+ | Using '' | ||
+ | |||
+ | === Adding a NetBSD partition to MBR === | ||
+ | |||
+ | If you wanted to add a NetBSD partition to this table, you would create a new entry with fdisk, and end up with a table similar to this: | ||
+ | |||
+ | ^ Device ^ Type ^ Mount ^ System ^ | ||
+ | | /dev/sda1 | ext2 | /boot | Linux ^ | ||
+ | | /dev/sda2 | swap | | Linux swap ^ | ||
+ | | /dev/sda3 | ext4 | / | Linux ^ | ||
+ | | /dev/sda4 | | | NetBSD ^ | ||
+ | |||
+ | The partition solely for NetBSD resides alongside the other MBR entries. | ||
+ | |||
+ | === NetBSD and disklabel === | ||
+ | |||
+ | NetBSD occupies an entry in the MBR, but also creates its own partition table under that, using '' | ||
+ | |||
+ | NetBSD uses DOS partitioning naming schemes, with devices '' | ||
+ | |||
+ | Using this naming scheme, '' | ||
+ | |||
+ | NetBSD also reserves the '' | ||
+ | |||
+ | ^ Linux Device ^ NetBSD Device ^ NetBSD disklabel ^ Disk ^ | ||
+ | | /dev/sda | /dev/sd0d | d: | Entire disk | | ||
+ | | /dev/sda4 | /dev/sd0c | c: | Fourth MBR entry | | ||
+ | |||
+ | For the record, NetBSD also uses ''/ | ||
+ | |||
+ | ^ Linux Device ^ NetBSD Device ^ NetBSD disklabel ^ Disk ^ | ||
+ | | /dev/sda | /dev/sd0 | d: | Entire disk | | ||
+ | | /dev/sda | /dev/sd0d | d: | Entire disk | | ||
+ | | /dev/sda4 | /dev/sd0c | c: | Fourth MBR entry | | ||
+ | |||
+ | This graphic from the NetBSD guide is also helpful: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | See [[http:// | ||
+ | |||
+ | === Partitioning an MBR in NetBSD === | ||
+ | |||
+ | If, for any reason, you want to clear out the MBR completely of an existing device, you can use '' | ||
+ | |||
+ | < | ||
+ | dd if=/ | ||
+ | </ | ||
+ | |||
+ | == Using fdisk == | ||
+ | |||
+ | When you have a new device that needs to create an MBR table, use '' | ||
+ | |||
+ | Just running '' | ||
+ | |||
+ | Run '' | ||
+ | |||
+ | The first question it will ask you is if you want the change the disk geometry. | ||
+ | |||
+ | < | ||
+ | Do you want to change our idea of what BIOS thinks? [n] | ||
+ | </ | ||
+ | |||
+ | Next, fdisk will display the current MBR table layout. | ||
+ | |||
+ | < | ||
+ | Partition table: | ||
+ | 0: < | ||
+ | 1: < | ||
+ | 2: < | ||
+ | 3: < | ||
+ | </ | ||
+ | |||
+ | It's worth pointing out here that the MBR table lists four devices. | ||
+ | |||
+ | == Creating a partition == | ||
+ | |||
+ | Now, create a partition. | ||
+ | |||
+ | < | ||
+ | Which partition do you want to change?: [none] 0 | ||
+ | </ | ||
+ | |||
+ | The first value, the '' | ||
+ | |||
+ | The three following defaults are fine as well: | ||
+ | |||
+ | < | ||
+ | sysid: [0..255 default: 169] | ||
+ | start: [0..1cyl default: 63, 0cyl, 0MB] | ||
+ | size: [0..1cyl default: 16321, 1cyl, 8MB] | ||
+ | bootmenu: [] | ||
+ | </ | ||
+ | |||
+ | '' | ||
+ | |||
+ | < | ||
+ | Partition table: | ||
+ | 0: NetBSD (sysid 169) | ||
+ | start 63, size 16321 (8 MB, Cyls 0-1/5/4) | ||
+ | PBR is not bootable: All bytes are identical (0x00) | ||
+ | 1: < | ||
+ | 2: < | ||
+ | 3: < | ||
+ | </ | ||
+ | |||
+ | If you have no more partitions to create, then select ' | ||
+ | |||
+ | < | ||
+ | Which partition do you want to change?: [none] | ||
+ | Should we write new partition table? [n] y | ||
+ | </ | ||
+ | |||
+ | === Create NetBSD slices === | ||
+ | |||
+ | Short version: run '' | ||
+ | |||
+ | To remove a slice, set the size to 0 on both ends. To create one to fill the remaining space, use $. | ||
+ | |||
+ | Then use [[newfs]] to create new filesystems. :) |