diskparts 1.0 KB

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