[9fans] Problem caused by recent change to diskparts - Plan9

This is a discussion on [9fans] Problem caused by recent change to diskparts - Plan9 ; 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 ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: [9fans] Problem caused by recent change to diskparts

  1. [9fans] Problem caused by recent change to diskparts

    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.


  2. Re: [9fans] Problem caused by recent change to diskparts

    > 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



+ Reply to Thread