9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Problem caused by recent change to diskparts
@ 2008-06-17 18:59 Sander van Dijk
  2008-06-17 19:19 ` erik quanstrom
  0 siblings, 1 reply; 2+ messages in thread
From: Sander van Dijk @ 2008-06-17 18:59 UTC (permalink / raw)
  To: 9fans

Hi,

Between 11 and 12 June, there has been a change to /rc/bin/diskparts
to detect plan9 partitions on disks without a mbr. This change seems
to cause a problem with disks that do not have a plan9 partition at
all though: after running diskparts, one of my harddisks (the one
without a plan9 partition), shows only the files 'ctl', 'raw' and
'data'.  I would expect my 'linux' and 'linux1' to be there as well.
When I run 'disk/fdisk -p $disk/data > $disk/ctl' on it by hand, the
files 'linux' and 'linux1' do show up. Here is the code that sets up
the partitions:

for(disk in /dev/sd[0-9A-Zabd-z]*) {
	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 >$disk/ctl >[2]/dev/null
}

The 'disk/fdisk' line sets the partitions up correctly, but then after
that, the 'disk/prep' line seems to erase them again. I guess the
output of the 'disk/fdisk' and 'disk/prep' lines should be accumulated
and written to the $disk/ctl file all at once?

Greetings, Sander.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] Problem caused by recent change to diskparts
  2008-06-17 18:59 [9fans] Problem caused by recent change to diskparts Sander van Dijk
@ 2008-06-17 19:19 ` erik quanstrom
  0 siblings, 0 replies; 2+ messages in thread
From: erik quanstrom @ 2008-06-17 19:19 UTC (permalink / raw)
  To: 9fans

> for(disk in /dev/sd[0-9A-Zabd-z]*) {
> 	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 >$disk/ctl >[2]/dev/null
> }

definately a bug.

there are certainly better solutions to this, but the one that
requires the least code would be something like this

for(disk in /dev/sd?[0-9]) {
	if(test -f $disk/data && test -f $disk/ctl){
		disk/fdisk -p $disk/data >$disk/ctl >[2]/dev/null
		if(test -f $disk/plan9){
			for(part in $disk/plan9*)
				disk/prep -p $part >$disk/ctl >[2]/dev/null
		}
		if not{
			part=$disk/data
			if(! disk/prep -p $part>[2=1] | grep -s '^no plan 9')
				disk/prep -p $part >$disk/ctl >[2]/dev/null
			parts=($disk/data)
		}
	}
}

- erik




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-17 19:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-17 18:59 [9fans] Problem caused by recent change to diskparts Sander van Dijk
2008-06-17 19:19 ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).