Re: SDD partitioning and allocations
On 7/13/25 13:23, David Christensen wrote:
`dd if=/dev/zero bs=1M /dev/sdX`
I apologize -- that command is wrong, in more than one way. Here is an
console session from when I zeroed a 1 TB HDD:
1. Find the number of sectors:
2024-11-28 13:59:57 root@bullseye-bios ~
# parted /dev/disk/by-id/ata-TOSHIBA_DT01ACA100_***REDACTED*** u s p free
Model: ATA TOSHIBA DT01ACA1 (scsi)
Disk /dev/sdc: 1953525168s
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name
Flags
1 34s 32767s 32734s Microsoft
reserved partition msftres
2 32768s 1953521663s 1953488896s ntfs Basic data
partition msftdata
1953521664s 1953525134s 3471s Free Space
2. Factor the number of sectors:
2024-11-28 14:00:40 root@bullseye-bios ~
# factor 1953525168
1953525168: 2 2 2 2 3 3 3 7 547 1181
3. Find a suitable block size and count so that the zero-fill is exact
with no fractional blocks:
2024-11-28 14:01:51 root@bullseye-bios ~
# perl -e 'print 512*2*2*2*2*3*3*3*7, $/, 547*1181, $/'
1548288
646007
4. Zero-fill, making sure that input blocks are full:
2024-11-28 14:02:16 root@bullseye-bios ~
# time dd bs=1548288 count=646007 if=/dev/zero
of=/dev/disk/by-id/ata-TOSHIBA_DT01ACA100_***REDACTED*** status=progress
iflag=fullblock
1000177016832 bytes (1.0 TB, 931 GiB) copied, 6414 s, 156 MB/s
646007+0 records in
646007+0 records out
1000204886016 bytes (1.0 TB, 932 GiB) copied, 6433.63 s, 155 MB/s
real 107m13.633s
user 0m0.000s
sys 6m36.420s
David
Reply to: