要从干净状态开始,我需要从命令行将硬盘重置为空状态.
它不是关于运行擦除实用程序,不必覆盖数据.
dd if=/dev/zero of=/dev/sda bs=512 count=1 conv=notrunc
但如果我想使用这样的覆盖磁盘,我会收到设备仍在使用的错误.
root@grml ~ # blockdev --rereadpt /dev/sda
BLKRRPART: Device or resource busy
要么
root@grml ~ # partprobe
Error: Partition(s) 2,3 on /dev/sda have been written,but we have been unable to inform the kernel of the change,probably because it/they are in use. As a result,the old partition(s) will remain in use. You should reboot now before making further changes.
Error: Partition(s) 2,3 on /dev/sdb have been written,the old partition(s) will remain in use. You should reboot now before making further changes.
所以我必须手动禁用“坐在”设备上的所有内容
umount /mnt/debootstrap
umount /mnt/debootstrap/tmp
umount /mnt/debootstrap/var/log
umount /mnt/debootstrap/var
umount /mnt/debootstrap/home
service mdadm stop
service lvm2 stop
vgremove vg_main
pvremove /dev/md1
mdadm --stop /dev/md0
mdadm --stop /dev/md1
mdadm --remove /dev/md0
mdadm --remove /dev/md1
之后,partprobe命令工作.
有一些命令更简单吗?喜欢
harddiskreset /dev/sda
所以它可以很容易地用在具有不同分区/ lvm / md布局的系统上?