要从干净状态开始,我需要从命令行将硬盘重置为空状态。
这与运行擦除工具无关,数据不必被覆盖。
这个问题与从命令行删除所有分区非常相似
那里的解决方案效果很好,
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, 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.
所以我必须手动禁用设备上所有“坐”的东西
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布局的系统上使用?