OpenBSD: adding a partition


Add a new partition to a whole system is a matter of editing the bsdlabel and format the partition. In my case, the disk is structured as:

# fdisk sd1
Disk: sd1       geometry: 32301/240/63 [488397168 Sectors]
Offset: 0       Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S –      C   H   S [       start:        size ]
——————————————————————————-
*0: A6      0   1   1 –  12918 224  63 [          63:   195334272 ] OpenBSD    
 1: A6  12918 225   1 –  25818  19  63 [   195334335:   195035085 ] OpenBSD    
 2: 0C  25837 210   1 –  32301  14  63 [   390668670:    97723395 ] Win95 FAT32L
 3: 00      0   0   0 –      0   0   0 [           0:           0 ] unused    

Partition 1 is the new one to add.

The bsdlabel looks like:

# disklabel sd1 
# /dev/rsd1c:
type: SCSI
disk: SCSI disk
label: HTS545025B9A300
duid: cd5b1acbd1dffc77
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 30401
total sectors: 488397168
boundstart: 63
boundend: 195334335
drivedata: 0

16 partitions:
#                size           offset  fstype [fsize bsize  cpg]
  a:          2104449               63  4.2BSD   2048 16384    1 # /
  b:         17398398          2104512    swap                   # none
  c:        488397168                0  unused                  
  d:          4209024         19502912  4.2BSD   2048 16384    1 # /var
  e:         61432544         23711936  4.2BSD   2048 16384    1 # /usr
  f:          1044224         85144480  4.2BSD   2048 16384    1
  g:        109145600         86188704  4.2BSD   2048 16384    1 # /home
  i:         97723395        390668670   MSDOS                   # /mnt/dos

So, the next is add the new partition to the bsdlabel. The command to do it is:

disklabel sd1

Then insert a new line after last slice like:

  h:        195035085        195334335  4.2BSD   2048 16384    1 # /mnt/store

In this case, I’ll mount the partition in /mnt/store.

It only rests to format the partition /dev/sd1h:

newfs sd1h

The mounted partition:

df -h

# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/sd1a     1008M    289M    669M    30%    /
/dev/sd1g     51.2G   41.2G    7.5G    85%    /home
mfs:25101      484M   43.0K    460M     0%    /tmp
/dev/sd1e     28.8G   13.7G   13.7G    50%    /usr
/dev/sd1d      2.0G    1.4G    505M    74%    /var
/dev/sd1i     46.5G   39.5G    7.0G    85%    /mnt/dos
/dev/sd0l     91.6G   11.6G   75.3G    13%    /mnt/linux
/dev/sd1h     91.5G    2.0K   87.0G     0%    /mnt/store

About jjjesss

I'm a guy interested in technology, bsd fan and concerned about the world around.
This entry was posted in BSD, OpenBSD. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s