This is the old XigmaNAS forum in read only mode,
it will taken offline by the end of march 2021!



I like to aks Users and Admins to rewrite/take over important post from here into the new fresh main forum!
Its not possible for us to export from here and import it to the main forum!

Automatically remove old metadata from disks that are formatted

Post/Debate your Suggestions & Requests of XigmaNAS here. This ONLY pertains to XigmaNAS.
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
selulven
Starter
Starter
Posts: 29
Joined: 01 Jan 2016 20:47
Status: Offline

Automatically remove old metadata from disks that are formatted

Post by selulven »

I recently encountered a situation where RAID5 metadata was still left on a disk -- and was causing trouble -- after the disk had been formatted as a ZFS Storage Pool device. graid5 dump <dev> showed that the RAID5 metadata were causing the graid subsystem to recognize the drive as being part of a RAID5 set -- and the disk's activation triggered a rebuild of the RAID set -- even after it had been formatted and added to a pool.

This is both counter-intuitive and potentially extremely damaging. No one expects data on the disk to persist after a format. It's worse that it triggers further automatic actions to be taken without user interaction or any possibility of intervention. It's especially aggravating that this will likely result in the loss of data on the disk (in my case, a RAID5 being rebuilt on top of a ZFS Storage Pool with a zvol on it).

The consensus in the ZFS sphere seems to be that the user must resolve this manually, on the command line, by dd-ing 4K of data to the start and end of the disk to wipe any residual metadata. As far as targeting users goes, that's bordering on hopeless.

In my opinion, there are no use cases that require metadata from the previous storage system to persist after the disk has been repurposed. This applies regardless of which is the previous and which is the next storage system. Users who format their disks will not and can not expect any of the existing data to persist.

Therefore, I propose that whenever a disk is formatted using the web GUI, the recommended wiping actions (4K start and end, or whatever is considered appropriate) are performed automatically.

User avatar
mooblie
experienced User
experienced User
Posts: 85
Joined: 23 Jun 2012 13:31
Location: The Highlands, Scotland
Contact:
Status: Offline

Re: Automatically remove old metadata from disks that are formatted

Post by mooblie »

+1
Maybe this is why some disks won't appear in the "Format" GUI menu - a constant problem for me, when trying to build/test different configurations.
Martin

User avatar
JoseMR
Hardware & Software Guru
Hardware & Software Guru
Posts: 1058
Joined: 16 Apr 2014 04:15
Location: PR
Contact:
Status: Offline

Re: Automatically remove old metadata from disks that are formatted

Post by JoseMR »

This should be done automatically indeed, but for manually remove any metadata on disk, the following link could help: http://wiki.nas4free.org/doku.php?id=faq:0129

Below is a sample script to wipe the first and last 100M of selected disk, similar technique Western Digital uses for quickly wipe a miss behaving disk, you can modify the count to anything you need in Blocks.

Code: Select all

#!/bin/sh
# Quick Disk Wiper
printf "\033[31m%s\33[0m\n" "Warning: This will wipe the first and the last 100MB of the selected disk."
echo "What disk do you want to wipe?"
camcontrol devlist
echo "For example - ada0 :"
read disk
printf "\033[31m%s\33[0m\n" "All data on the following disk will be destroyed: $disk!"
echo "Press Enter to continue or CTRL+C to abort!"
read next
echo "Disk wiping started!"
diskinfo ${disk} | while read disk sectorsize size sectors other
    do
        # Wipe the first 100MB.
        /bin/dd if=/dev/zero of=/dev/${disk} bs=${sectorsize} count=204800
        # Wipe the last 100MB.
        /bin/dd if=/dev/zero of=/dev/${disk} bs=${sectorsize} oseek=`expr $sectors - 204800` count=204800
        echo "e." > /dev/speaker
    done
echo "Done!"
System: FreeBSD 12 RootOnZFS Mirror, MB: Supermicro X8SI6-F, Xeon X3450, 16GB DDR3 ECC RDIMMs.
XigmaNAS RootOnZFS
Addons at GitHub
BastilleBSD
Boot Environments Intro
Resources Home Page

Post Reply

Return to “Suggestions & Requests”