Detect secure a clean hard disk.

Michał Dwużnik michal.dwuznik at gmail.com
Sun Feb 5 14:44:28 CET 2012


Hi,

keep in mind that members of software RAID, lvm physical volumes and
so on may house the data despite zeroed out first sector:

 #dd if=/dev/md0 of=file  count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00886503 s, 57.8 kB/s

#dd if=/dev/zero of=zero  count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 6.3684e-05 s, 8.0 MB/s

#diff file zero
#

md0 is a perfectly healthy device, btw...
(LVM housing the root filesystem of the machine I used for that example...)

 cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdc4[1] sdb4[0]
      64725760 blocks [2/2] [UU]

unused devices: <none>

 PV /dev/md0   VG fatvg    lvm2 [61.73 GiB / 17.73 GiB free]



Making assumptions on the basis of the first sector (which you seem to
make due to
'clean the disk with dd if=/dev/zero of=/dev/sda count=1')
would actually destroy most of machines I call 'mine', so please
forgive me the warning.


Regards
Michal


On Sun, Feb 5, 2012 at 11:19, Andreas Schockenhoff <asc at gmx.li> wrote:
> Hi,
>
> i am searching for a small shell script that detects, if the
> hard disk is clean.
>
> I will use it for virtual machines. There I create always new clean
> virtuell hard disks. I will stop the installation if the hard disk is
> not clean.
>
> I will use it for easy automatic fai-cd testing. To be sure that they do
> not destroy any data on real hard disks.
>
> In this case the user will use a hard disk with old data. He can clean
> the hard disk with example dd if=/dev/zero of=/dev/sda count=1. And
> start again.
>
> The new GUID Partition or EFI ... hard disks seams to have also data in
> the first sector of the hard disk?
>
> Better ideas?
>
> regards Andreas Schockenhoff
>



-- 
Michal Dwuznik


More information about the linux-fai mailing list