[pbs-devel] [PATCH backup v2 2/2] disks: wipe: only zero out the first 1 MiB

Filip Schauer f.schauer at proxmox.com
Tue Feb 11 17:26:39 CET 2025


Reduce the number of MiB zeroed out at the start of the disk from 200 to
1. This should still be sufficient to remove any remaining signatures
missed by `wipefs`, preventing potential interference with later use of
the disk.

Signed-off-by: Filip Schauer <f.schauer at proxmox.com>
---
 src/tools/disks/mod.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/tools/disks/mod.rs b/src/tools/disks/mod.rs
index ad9df0b5..deee60a6 100644
--- a/src/tools/disks/mod.rs
+++ b/src/tools/disks/mod.rs
@@ -1145,7 +1145,7 @@ pub fn inititialize_gpt_disk(disk: &Disk, uuid: Option<&str>) -> Result<(), Erro
     Ok(())
 }
 
-/// Wipes all labels, the first 200 MiB and the last 4096 bytes of a disk/partition.
+/// Wipes all labels, the first 1 MiB and the last 4096 bytes of a disk/partition.
 /// If called with a partition, also sets the partition type to 0x83 'Linux filesystem'.
 pub fn wipe_blockdev(disk: &Disk) -> Result<(), Error> {
     let disk_path = match disk.device_path() {
@@ -1198,7 +1198,7 @@ pub fn zero_disk_start_and_end(disk: &Disk) -> Result<(), Error> {
         .custom_flags(libc::O_CLOEXEC | libc::O_DSYNC)
         .open(disk_path)
         .with_context(|| "failed to open device {disk_path:?} for writing")?;
-    let write_size = disk_size.min(200 * 1024 * 1024);
+    let write_size = disk_size.min(1024 * 1024);
     let zeroes = proxmox_io::boxed::zeroed(write_size as usize);
     file.write_all_at(&zeroes, 0)
         .with_context(|| "failed to wipe start of device {disk_path:?}")?;
-- 
2.39.5





More information about the pbs-devel mailing list