diskparts 928 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/rc
  2. # set up any disk partitions
  3. rfork e
  4. if (! test -e /dev/sdctl)
  5. bind -a '#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.
  11. for(disk in /dev/sd[0-9A-Zabd-z]*) {
  12. if(test -f $disk/data && test -f $disk/ctl)
  13. disk/fdisk -p $disk/data >$disk/ctl >[2]/dev/null
  14. if(test -f $disk/plan9)
  15. parts=($disk/plan9*)
  16. if not
  17. parts=($disk/data)
  18. for(part in $parts)
  19. if(test -f $part)
  20. disk/prep -p $part >$disk/ctl >[2]/dev/null
  21. }
  22. sysname=`{cat /dev/sysname}
  23. # set up any fs(3) partitions
  24. if (! test -e /dev/fs/ctl && test -e '#k/fs')
  25. bind -a '#k' /dev
  26. if (~ $#sysname 1 && ! ~ $sysname '' &&
  27. test -r /cfg/$sysname/fsconfig && test -w /dev/fs/ctl)
  28. read -m /cfg/$sysname/fsconfig >/dev/fs/ctl