Subject: Re: adding multiple partitions?
To: James Hartley <jjhartley@gmail.com>
From: Chavdar Ivanov <ci4ic4@gmail.com>
List: netbsd-users
Date: 09/06/2007 22:00:21
On 06/09/07, James Hartley <jjhartley@gmail.com> wrote:
> The following discusses how to add a disk to an existing system:
>
> http://netbsd.org/docs/misc/index.html#adding-a-disk
>
> However, this document only mentions the addition of a single slice.
> This generates three questions:
>
> 0.  disklabel asks for the starting offset in:  [0c, 0s, 0M].  Is the
> expected response only in cylinders, or sectors, or megabytes, or do
> all three values need to be specified?
> 1.  Is the same true for the partition size?
> 2.  If a swap partition is specified on a new disk, what needs to be
> done to notify the system that it is to split the existing swap across
> two disks?  ie.  I created two partitions on a new disk, swap &
> 4.2BSD.  After mounting the 4.2BSD partition, I saw no change in the
> amount of swap reported by top(1).
>
> Thanks for any candor shared.

If it is of any interest, a quick session adding a second (SCSI) disk
to a VMWare NetBSD 4.0RC1 machine:

nbsd4# disklabel -i sd0
partition> P
4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:   2097152         0     4.2BSD      0     0     0  # (Cyl.      0 -    511)
 d:   2097152         0     unused      0     0        # (Cyl.      0 -    511)
partition> E
# /dev/rsd0d:
type: SCSI
disk: VMware Virtual S
label: fictitious
flags:
bytes/sector: 512
sectors/track: 32
tracks/cylinder: 128
sectors/cylinder: 4096
cylinders: 512
total sectors: 2097152
rpm: 7200
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0

4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:   2097152         0     4.2BSD      0     0     0  # (Cyl.      0 -    511)
 d:   2097152         0     unused      0     0        # (Cyl.      0 -    511)
partition> a
Filesystem type [?] [4.2BSD]:
Start offset ('x' to start after partition 'x') [0c, 0s, 0M]:
Partition size ('$' for all remaining) [512c, 2097152s, 1024M]: 800m
 a:   1638400         0     4.2BSD      0     0     0  # (Cyl.      0 -    399)
partition> P
4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:   1638400         0     4.2BSD      0     0     0  # (Cyl.      0 -    399)
 d:   2097152         0     unused      0     0        # (Cyl.      0 -    511)
partition> b
Filesystem type [?] [unused]: ?
Supported file system types:
        4.1BSD          Eighth Edition  MSDOS           unknown
        4.2BSD          FILECORE        NTFS            unused
        4.4LFS          HFS             RAID            Version 6
        ADOS            HPFS            swap            Version 7
        Apple UFS       ISO9660         System V        vinum
        boot            jfs             SysVBFS
        ccd             Linux Ext2      UDF
Filesystem type [?] [unused]: swap
Start offset ('x' to start after partition 'x') [0c, 0s, 0M]: a
Partition size ('$' for all remaining) [0c, 0s, 0M]: $
 b:    458752   1638400       swap                     # (Cyl.    400 -    511)
partition> P
4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:   1638400         0     4.2BSD      0     0     0  # (Cyl.      0 -    399)
 b:    458752   1638400       swap                     # (Cyl.    400 -    511)
 d:   2097152         0     unused      0     0        # (Cyl.      0 -    511)
partition> W
Label disk [n]? y
Label written

....


echo /dev/sd0b none swap sw 0 0 >> /etc/fstab
swap -a

#### Make the filesystem on the new disk:

nbsd4# newfs /dev/sd0a
/dev/sd0a: 800.0MB (1638400 sectors) block size 8192, fragment size 1024
        using 18 cylinder groups of 44.45MB, 5689 blks, 11072 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 91056, 182080, 273104, 364128, 455152, 546176, 637200, 728224, 819248,
................................................................................

nbsd4# mkdir /mnt/spare
nbsd4# mount /dev/sd0a /mnt/spare
nbsd4# echo /dev/sd0a /mnt/spare ffs rw 2 2 >> /etc/fstab
nbsd4# umount /mnt/spare
nbsd4# mount /mnt/spare
...




>
> Jim
>
Chavdar