Public repo to distribute scripts and config's
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

30 rindas
861 B

pirms 11 mēnešiem
  1. #!/usr/bin/bash
  2. set -x
  3. DISK=${1:-nodisk}
  4. if [ "x${DISK}" = "xnodisk" ]; then
  5. echo "What disk ? (sda, sdb, nvme0n1,...)"
  6. exit 1
  7. fi
  8. SIZE=$(sudo blockdev --getsz /dev/${DISK})
  9. PBSZ=$(sudo blockdev --getpbsz /dev/${DISK})
  10. SEEK=$(($SIZE - 256 * 1024 * 2 / $PBSZ))
  11. LEN=$((256 *2 *1024 /$PBSZ))
  12. # SEEK=$(( $(sudo blockdev --getsz "/dev/sdX1") - 256 * 1024 * 2 / $(sudo blockdev --getpbsz "/dev/sdX1")))
  13. echo $SIZE $PBSZ $SEEK $LEN
  14. for i in 1 2 3 4 ; do
  15. TOWIPE=${DISK}${i}
  16. if [ -b /dev/$TOWIPE ] ; then
  17. sudo wipefs -a -f /dev/${TOWIPE}
  18. sudo dd if=/dev/zero of=/dev/${TOWIPE} bs=$PBSZ count=$LEN
  19. sudo dd if=/dev/zero of=/dev/${TOWIPE} seek=$SEEK bs=$PBSZ count=$LEN
  20. fi
  21. done
  22. sudo wipefs -a -f /dev/${DISK}
  23. sudo dd if=/dev/zero of=/dev/${DISK} bs=$PBSZ count=$LEN
  24. sudo dd if=/dev/zero of=/dev/${DISK} seek=$SEEK bs=$PBSZ count=$LEN