Re: read and write back full disk to trigger relocation
Date: Mon, 29 May 2023 23:12:24 UTC
On 5/29/23 04:25, Sysadmin Lists wrote: > David Christensen May 29, 2023, 12:04:41 AM >> On 5/28/23 14:45, Sysadmin Lists wrote: >>> From the dd(1) manpage: >>> >>> Do a refresh of a disk drive, in order to prevent presently recoverable >>> read errors from progressing into unrecoverable read errors: >>> >>> dd if=/dev/ada0 of=/dev/ada0 bs=1m >> >> >> gmirror(8) examples indicate the device node should be: >> >> /dev/mirror/name >> >> >> Where "name" is the argument provided when the mirror was created: >> >> # gmirror label name prov ... > > One of the examples is: > > gmirror label -v -b split -s 2048 data da0 da1 da2 > > Which tells me to look for /dev/da0, /dev/da1, /dev/da2 for the dd command. Your mail client and my mail client (Thunderbird) indent things differently. I have reformatted the above per Thunderbird conventions. I have had to do this every time I reply to your messages. I do not have this issue with most other messages I reply to. Testing dd(1) and gmirror(8): 2023-05-29 15:21:32 toor@vf1 ~ # freebsd-version ; uname -a 12.4-RELEASE-p2 FreeBSD vf1.tracy.holgerdanske.com 12.4-RELEASE-p1 FreeBSD 12.4-RELEASE-p1 GENERIC amd64 2023-05-29 15:23:05 toor@vf1 ~ # gmirror label mymirror ada3 ada4 2023-05-29 15:24:11 toor@vf1 ~ # gmirror status mymirror Name Status Components mirror/mymirror COMPLETE ada3 (ACTIVE) ada4 (ACTIVE) 2023-05-29 15:52:41 toor@vf1 ~ # dd if=/dev/ada3 of=/dev/ada3 bs=1m dd: /dev/ada3: Operation not permitted 2023-05-29 15:53:45 toor@vf1 ~ # dd if=/dev/ada4 of=/dev/ada4 bs=1m dd: /dev/ada4: Operation not permitted 2023-05-29 15:53:52 toor@vf1 ~ # dd if=/dev/mirror/mymirror of=/dev/mirror/mymirror bs=1m 1023+1 records in 1023+1 records out 1073741312 bytes transferred in 3.299006 secs (325474224 bytes/sec) This confirms that the kernel will not allow writes to mirror components when they are active, as it should. If a process could write to a component of a mirror, that would bypass the mirror driver, defeat the purpose of the mirror, allow race conditions, and result in data loss/ data corruption. David