View Single Post
  #1   (View Single Post)  
Old 21st October 2017
gustaf gustaf is offline
Fdisk Soldier
 
Join Date: Dec 2016
Posts: 69
Default 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 would like to create an additional 4.2BSD formatted partition so I can use this space for storing other files. This new partition should use the entire unallocated space.

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
Which partition do I shrink and how do I shrink it? The only one to shrink is 'c' -- the entire disk??

Or is this the wrong approach?

Many thanks to anyone who can help.
Reply With Quote