1
0

diskparts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/rc
  2. # set up any disk partitions
  3. rfork e
  4. if (! test -e /dev/sdctl)
  5. bind -b '#S' /dev
  6. bind -a /bin/disk /bin >[2]/dev/null # work with /boot too
  7. # set up any /dev/sd partitions.
  8. # note that really big disks (e.g., aoe devices) may have no mbr
  9. # partition table because the mbr partition table can't cope with large
  10. # block numbers, so we may have to examine the data file with prep if
  11. # there's no plan9 file. beware that `disk/prep -p data' on a disk with
  12. # no plan 9 partition table will delete all extant partitions.
  13. for(disk in /dev/sd*) {
  14. if(test -f $disk/data && test -f $disk/ctl)
  15. { fdisk -p $disk/data |
  16. grep -v '^delpart ' >$disk/ctl } >[2]/dev/null
  17. if(test -f $disk/plan9)
  18. parts=($disk/plan9*)
  19. if not
  20. parts=($disk/data)
  21. for(part in $parts)
  22. if(test -f $part)
  23. { prep -p $part |
  24. grep -v '^delpart ' >$disk/ctl } >[2]/dev/null
  25. }
  26. sysname=`{cat /dev/sysname}
  27. # set up any fs(3) partitions
  28. if (! test -e /dev/fs/ctl && test -e '#k/fs')
  29. bind -b '#k' /dev
  30. if (~ $#sysname 1 && ! ~ $sysname '' &&
  31. test -r /cfg/$sysname/fsconfig && test -w /dev/fs/ctl)
  32. read -m /cfg/$sysname/fsconfig >/dev/fs/ctl