|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
Add partition to disk ?
Hello everyone,
I'm trying to partition the unallocated space on a disk. I have created a bootable USB stick which contains two partitions and a vast amount of unallocated space: Code:
$ dmesg sd1 at scsibus4 targ 1 lun 0: <Lexar, USB Flash Drive, 1100> SCSI2 0/direct removable serial.05dca81d3020YVD48SBQ sd1: 7646MB, 512 bytes/sector, 15659008 sectors Code:
$ fdisk sd1 Disk: sd1 geometry: 974/255/63 [15659008 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------------- 0: EF 0 1 2 - 0 16 16 [ 64: 960 ] EFI Sys 1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused *3: A6 0 16 17 - 45 227 54 [ 1024: 736256 ] OpenBSD Code:
$ disklabel sd1 # /dev/rsd1c: type: vnd disk: vnd device label: fictitious duid: 9e5b01f8dc3ea3f3 flags: bytes/sector: 512 sectors/track: 100 tracks/cylinder: 1 sectors/cylinder: 100 cylinders: 7382 total sectors: 15659008 boundstart: 1024 boundend: 737280 drivedata: 0 16 partitions: # size offset fstype [fsize bsize cpg] a: 736256 1024 4.2BSD 2048 16384 16142 c: 15659008 0 unused i: 960 64 MSDOS I think I need to do something like the following: Code:
$ doas disklabel -E sd1 Label editor (enter '?' for help at any prompt) >p OpenBSD area: 1024-737280; size: 736256; free: 0 # size offset fstype [fsize bsize cpg] a: 736256 1024 4.2BSD 2048 16384 16142 c: 15659008 0 unused i: 960 64 MSDOS > r Total free sectors: 0. > a j No space left, you need to shrink a partition > x Or is this the wrong approach? Many thanks to anyone who can help. |
|
||||
Learning the difference between the slices (MBR or GPT) and BSD partitions (disklabel) would be helpful.
https://www.dragonflybsd.org/docs/ha...sics/#index7h2 BSD partitions can't be shrink to my knowledge. They can be grown if you have empty space next to them Code:
man growfs |
|
|||
Hi jggimi and Oko,
Thanks for your quick replies. There is clearly something I'm missing about how disks work. I'm going to try finding and reading (or re-reading) all the disk-related man pages, cross-references, and the OpenBSD Disk Setup FAQ. In the meantime, I think this means that I cannot simply partition the unallocated space on a disk, then build a new file system on the added partition, and leave the existing partitions and boot sector untouched. |
|
||||
Another way to look at it:
fdisk() and disklabel(8) both report that there are 15,659,008 512-byte sectors on the drive. That's 8,017,412,096 bytes. The vendor will call that "8 GB" but computer users prefer using 1,024 bytes for byte counts in KB, MB, GB, TB .. .and using 1,024 instead of 1,000 we get a value slightly smaller than 7.5 GB. --- Yes, you could override the GPT partition from within the disklabel() program - it's the internal editor's "b" command, described in the man page. But .. the purpose of an MBR or GPT partition table, beyond booting, is to ensure that different operating systems don't scribble over each other's data. You risk this if you decide to override the range defined by the GPT partition. What's better than overriding a mistake in the GPT partition table? Correcting it, with fdisk(). A more useful value will expand the range of available OpenBSD space. You can even have fdisk expand the size automatically to the end of the disk, with "*". See the fdisk() man page. After editing the GPT partition, you can either add new disklabel partitions as needed, or you could grow the existing partition as Oko suggested. Or, you could backup, reformat, and reload data. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Install OpenBSD in more than one disk partition? | betweendayandnight | OpenBSD Installation and Upgrading | 6 | 17th July 2015 05:51 PM |
add another partition? | amandus | FreeBSD General | 2 | 11th June 2013 02:51 PM |
disk partition layout advise | Fred974 | FreeBSD Installation and Upgrading | 14 | 8th November 2011 12:10 PM |
Partition help needed. | ros2468 | OpenBSD Installation and Upgrading | 9 | 22nd March 2010 01:25 PM |
Disk geometry for Seagate disk | phreud | FreeBSD Installation and Upgrading | 5 | 8th November 2008 10:51 PM |