Plan 9 from Bell Labs’s /usr/web/sources/patch/applied/diskparts-mute/diskparts

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
# set up any disk partitions
rfork e
if (! test -e /dev/sdctl)
	bind -a '#S' /dev

# set up any /dev/sd partitions.
# note that really big disks (e.g., aoe devices) may have no mbr
# partition table because the mbr partition table can't cope with large
# block numbers, so we may have to examine the data file with prep if
# there's no plan9 file.  beware that `disk/prep -p data' on a disk with
# no plan 9 partition table will delete all extant partitions.
for(disk in /dev/sd*) {
	if(test -f $disk/data && test -f $disk/ctl)
		disk/fdisk -p $disk/data >$disk/ctl >[2]/dev/null
	if(test -f $disk/plan9)
		parts=($disk/plan9*)
	if not
		parts=($disk/data)
	for(part in $parts)
		if(test -f $part)
			disk/prep -p $part >[2]/dev/null |
				grep -v '^delpart ' >$disk/ctl >[2]/dev/null
}

sysname=`{cat /dev/sysname}

# set up any fs(3) partitions
if (! test -e /dev/fs/ctl && test -e '#k/fs')
	bind -a '#k' /dev
if (~ $#sysname 1 && ! ~ $sysname '' &&
    test -r /cfg/$sysname/fsconfig && test -w /dev/fs/ctl)
	read -m /cfg/$sysname/fsconfig >/dev/fs/ctl

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.