Can't create a disk volume on reused hard drives (FreeNAS 8.0.4)

Status
Not open for further replies.
Joined
Apr 3, 2012
Messages
2
I have two SATA hard drives that had a FreeBSD 8.1 installation on them (UFS, geom mirror), and I wanted to reuse them for FreeNAS. On my system, the CF reader, the DVD drive and the two hard drives are installed on separate SATA ports.

I downloaded and installed FreeNAS 8.0.4 on a 4GB CF card. I successfully accessed the FreeNAS web GUI from another computer on my network. I then tried to create a ZFS mirrored disk volume using the two SATA hard drives using the volume name "test". At first it looked like it worked, and the volume was displayed on the left side under "Volumes" as /mnt/test, but the volume was not displayed on the right side, and an error message on the top menu bar said "An error occurred!" I tried creating different ZFS volume configurations, and different UFS volume configuration, with identical results. I then connected a blank hard drive to the system, and was able to create a ZFS volume right away with no errors.

It appears that FreeNAS will not erase an existing FreeBSD UFS configuration when creating a new disk volume. Has anyone else seen this error? I imagine it would work if I erased the disk first, but I shouldn't have to do that.

Thanks,
Chris
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Hi Chris,

Yes, this has been a problem plaguing users for awhile. I opened another ticket for it the other night, for now you need to wipe your disks from the command line. There's a link in my tutorial below, and actually the official docs have a section about it *somewhere*.

http://protosd.blogspot.com/2011/12/useful-commands-for-diagnosingmanaging.html

Look for the section on Wiping Disks, the list of sections at the top of the page is clickable and will take you directly to the section.
 

jenksdrummer

Patron
Joined
Jun 7, 2011
Messages
250
note which disk it is...if you get it wrong, you could destroy your data.

I did the same thing last night to clean out partition info on my disks...

from a root shell, get to the /dev directory.

ls - note your disks...make sure you see it listed. Mine, for example:

ada0
ada0p2
ada1
ada2
ada2p2
ada3
ada3p2


Something like that - lol...

I did the following:

dd if=zero of=ada0 bs=1G

Let that run for about 10 minutes...then just did a control-c to kill it.

Rebooted and then ada0 was all that was listed. Wiped out all the partition information and zeroed around 18G worth of the disk by the time I was done. Repeated on the other 3 disks, and they were effectively clean disks again.
 

sudleyplace

Cadet
Joined
Apr 25, 2012
Messages
4
I, too, have two previously formatted 500GB disks (from 0.7.??? as Software RAID, although I never got the RAID up and running).
From /dev I tried

dd if=zero of=ada1 bs=1g

to which 8.0.4 replied

dd: ada1: Operation not permitted

I'm trying to create a RAID1 on these two disks, but the Create Volume UI (RAID, ada1 & ada2, UFS, mirror) succinctly replies with "Error occurred!". I thought that by wiping the disks (there's no data on them) I could get Create Volume to work. No luck.

I also tried Import Volume on each disk (e.g., RAIDada1, ada1, UFS) to which it replied "The selected disks were not verified for this import rules."

Any help would be greatly appreciated.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
The info is in the FAQ for wiping disks.... of=/dev/ada1 Links are in signature below.....
 

sudleyplace

Cadet
Joined
Apr 25, 2012
Messages
4
1. If you mean question 20 in http://protosd.blogspot.com/2011/12/protosds-unofficial-freenas-8-faq.html, then I'm puzzled.

That's what I'm doing and am still getting "Operation not permitted". I wrote in my message that from the /dev directory I was typing, dd if=zero of=ada1 bs=1g count=1, but in case it made a difference, I just tried dd if=/dev/zero of=/dev/ada1 bs=1g count=1 and still got "Operation not permitted". I also tried the second command you mention

dd if=/dev/zero of=/dev/ada1 bs=1m oseek=`diskinfo ada1 | awk '{print int($3 / (1024*1024)) - 4;}'`

and got the same response: "Operation not permitted".

BTW, the diskinfo arg in your answer to Q20 is ada0 -- I assume you meant ada1.

2. One more piece of info: I just noticed that when FreeNAS shuts down it says (in bold) something like

GEOM_MIRROR: Device WDCRAID: provider mirror/WDCRAID destroyed.
GEOM_MIRROR: Device WDCRAID destroyed.

Now WDCRAID is the old name for the Software RAID I was trying to create under 0.7.???. I found it in /dev/mirror/WDCRAID and /dev/mirror/WDCRAIDs1. I tried to move those files to another directory but was told I couldn't as this was a "Read-only file system". Is there a way to zap those files (or make them work)?

3. Is there an equivalent set of shell commands that emulates what "Create Volume" does so I can try them individually from the shell and see where the error occurs and what it says?

4. I took out the two disks from the FreeNAS machine and put them into a Windows machine, and initialized each (I think it just wrote an MBR), partitioned without formatting, and then put them back into the FreeNAS machine with no change in behavior from "Create Volume" or the above dd commands. I can format them under Windows as NTFS, which I'll try as long as I can reformat them as UFS (or ZFS) for mirroring later on under FreeNAS. Is that feasible?

Many thanks for your help!
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Thanks for catching that typo in the FAQ, it's fixed now!

How are you getting to the command prompt to run the commands, from the console or Putty?

3. Is there an equivalent set of shell commands that emulates what "Create Volume" does so I can try them individually from the shell and see where the error occurs and what it says?
You're already trying some of them, the "operation not permitted" is a pretty good clue to why the GUI is failing.

Can you post the output of "gpart show" and "glabel status" without the quotes?



4. I took out the two disks from the FreeNAS machine and put them into a Windows machine, and initialized each (I think it just wrote an MBR), partitioned without formatting, and then put them back into the FreeNAS machine with no change in behavior from "Create Volume" or the above dd commands. I can format them under Windows as NTFS, which I'll try as long as I can reformat them as UFS (or ZFS) for mirroring later on under FreeNAS. Is that feasible?

If you do a complete format, not the quick format, that should work without any problems reformatting them to UFS/ZFS later.

If you can answer the questions above, doing it without Windows should go much faster once we discover what the issue is.
 

sudleyplace

Cadet
Joined
Apr 25, 2012
Messages
4
How are you getting to the command prompt to run the commands, from the console or Putty?

Was using the console, choosing option 9 (Shell). Now I'm using Putty.

Can you post the output of "gpart show" and "glabel status" without the quotes?
Code:
admin@freenas-> gpart show
=>     63  8204175  da0  MBR  (3.9G)
       63  1930257    1  freebsd  [active]  (943M)
  1930320       63       - free -  (32K)
  1930383  1930257    2  freebsd  (943M)
  3860640     3024    3  freebsd  (1.5M)
  3863664    41328    4  freebsd  (20M)
  3904992  4299246       - free -  (2.1G)

=>       34  976773101  ada0  GPT  (466G)
         34  976773101     1  freebsd-ufs  (466G)

=>      0  1930257  da0s1  BSD  (943M)
        0       16         - free -  (8.0K)
       16  1930241      1  !0  (943M)

=>       63  976773042  mirror/WDCRAID  MBR  (466G)
         63  976768002               1  !6  (466G)
  976768065       5040                  - free -  (2.5M)

admin@freenas-> glabel status
          Name  Status  Components
 ufs/FreeNASs3     N/A  da0s3
 ufs/FreeNASs4     N/A  da0s4
     ufs/Disk1     N/A  ada0p1
ufs/FreeNASs1a     N/A  da0s1a


If you do a complete format, not the quick format, that should work without any problems reformatting them to UFS/ZFS later.

If you can answer the questions above, doing it without Windows should go much faster once we discover what the issue is.
I'll wait on that.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
I think you need to do "gmirror clear WDCRAID" or "gmirror remove WDCRAID" from the command line. I'm not up on the gmirror stuff, but I think it's something along those commands.


EDIT: Here's a link on the gmirror command:

http://man.cx/gmirror(8)
 

sudleyplace

Cadet
Joined
Apr 25, 2012
Messages
4
I think you need to do "gmirror clear WDCRAID" or "gmirror remove WDCRAID" from the command line. I'm not up on the gmirror stuff, but I think it's something along those commands.
The commands are
Code:
gmirror remove -v WDCRAID /dev/ada1
amd
Code:
gmirror remove -v WDCRAID /dev/ada2
And that worked! It allowed me to go back to "Create Volume" and create (WDCRAID, ada1, ada2, ufs, mirror) the mirror drives, and then share them via CIFS.

Well done! Nice job on a tough problem.
 

jason00084

Cadet
Joined
Aug 10, 2012
Messages
1
The commands are
Code:
gmirror remove -v WDCRAID /dev/ada1
amd
Code:
gmirror remove -v WDCRAID /dev/ada2
And that worked! It allowed me to go back to "Create Volume" and create (WDCRAID, ada1, ada2, ufs, mirror) the mirror drives, and then share them via CIFS.

Well done! Nice job on a tough problem.

YES YES YES! Thank you!
 

dw235

Cadet
Joined
Nov 13, 2013
Messages
1
Also wanted to thank you and add that I had a similar issue with old raid settings being associated with an old server setup. In my case, before I could create a volume, I had to use:

Code:
graid remove -v RAIDNAME /dev/ada1
graid remove -v RAIDNAME /dev/ada2


This thread was very helpful to this server newbie.
 

MRBeery

Cadet
Joined
Jan 25, 2017
Messages
2
I've researched this issue on the forums and in FreeBSD without much success. I have the same issue as listed above -- reusing drives from a very old (FreeNAS 7?) server. The drives were part of a RAID pool and I'm attempting to start from the beginning on the new system -- don't care about the data, would be happy to format/wipe the drive, but can't seem to get direct access to it. I'm an accomplished Windows and OS X user, but FreeNAS/FreeBSD/Linux is a bit foreign.

Code:
gmirror remove -v RAIDNAME /dev/ada1


Returned the message: "Can't remove the last ACTIVE component /dev/ada0.

Suggestions?
 

gpsguy

Active Member
Joined
Jan 22, 2012
Messages
4,472
You might try DBAN. Download it from DBAN.org and run it with the "quick" option.
 

wblock

Documentation Engineer
Joined
Nov 14, 2014
Messages
1,506
If it really was a gmirror, then back up any data (yes, I know you said you didn't care). I suggest not doing this on the FreeNAS machine, but temporarily hooking the drive to another system. It is just too easy to get drives mixed up and erase the wrong one.

Anyway, after a full backup (seriously), and wearing safety glasses, hard hat, and steel-toed boots:
diskinfo -v ada0 (compare the serial number shown with that on the drive to make very, very sure it is the same one)
gmirror list to get the name of the mirror.
gmirror destroy -f mirrorname to destroy the mirror and clear the metadata from all the mirror drives.

There are more brute-force methods. DBAN is overkill. dd from a FreeNAS boot disk, or FreeBSD, or Linux, can do it. All that really needs to be done is overwrite the last block of the disk. But since that mirror was automatically started, the GEOM system is protecting it. There is a sysctl to disable that, but it's dangerous, so try this first. After making a backup.
 

MRBeery

Cadet
Joined
Jan 25, 2017
Messages
2
Thanks to all. DBAN, while perhaps overkill and certainly a time-consuming process (even the quick command), did the trick.
 
Joined
Mar 21, 2017
Messages
1
I have two SATA hard drives that had a FreeBSD 8.1 installation on them (UFS, geom mirror), and I wanted to reuse them for FreeNAS. On my system, the CF reader, the DVD drive and the two hard drives are installed on separate SATA ports.

....

It appears that FreeNAS will not erase an existing FreeBSD UFS configuration when creating a new disk volume. Has anyone else seen this error? I imagine it would work if I erased the disk first, but I shouldn't have to do that.

Thanks,
Chris

I am running a V11 of NAS4Free, and was getting 4 new 4 TB drives running (two clean and two used a little). After adding the disks, I moved to format for ZFS, but only /dev/ada3 was offered by the GUI for formatting. Thinking there was a problem with previous data, I tried many of the methods suggested here and elsewhere to wipe the disks, including formatting them on my iMAC with a USB to SATA converter, to no avail. In the end I set the GUI to a "factory reset", and the problem went away i.e. I could format all 4 drives, make vdev's and then pools. Seems that if you are playing with the GUI, you can inadvertently get some settings into the database, that are then not properly removed by the GUI.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
I am running a V11 of NAS4Free, and was getting 4 new 4 TB drives running (two clean and two used a little). After adding the disks, I moved to format for ZFS, but only /dev/ada3 was offered by the GUI for formatting. Thinking there was a problem with previous data, I tried many of the methods suggested here and elsewhere to wipe the disks, including formatting them on my iMAC with a USB to SATA converter, to no avail. In the end I set the GUI to a "factory reset", and the problem went away i.e. I could format all 4 drives, make vdev's and then pools. Seems that if you are playing with the GUI, you can inadvertently get some settings into the database, that are then not properly removed by the GUI.
Yeah, that's really not applicable to FreeNAS. FreeNAS doesn't behave that way.
 
Status
Not open for further replies.
Top