SOLVED Why is drive not showing up in glabel status

NASbox

Guru
Joined
May 8, 2012
Messages
650
I am working on a backup script that mounts single drive pool in a hot swap drive caddy, and for some the drive does not show up when I do glabel status even though I have a pool mounted that is functioning correctly. I am hoping someone could tell me why/how to fix this.

Here is what I did:
  • I inserted an unformatted disk into the drive in the machine and spun it up
  • Did a zpool create BACKUP02 /dev/ada3 (The pool is correctly mounted as /BACKUP02)
    (which is what I want in this application-don't want the GUI managing/touching it in any way)
  • touch /BACKPUP02/junkfile successfully creates a file
  • zpool status reports the pool as online with no errors.
  • smartctl -a /dev/ada3 also works as expected.
My problem is that I have utilities that depend on glabel status reporting that the drive is present, but ada3 isn't showing up. glabel status reports the presence of all the other drives (da0p2, da1p2, da2p2, da3p2, da4p2, da5p2, da6p2, da7p2, ada0p2, ada1p2, ada2p1) on the system correctly.

Does anyone have any idea as to why this might be happening, and more importantly how I can fix it?
Thanks in advance for any assistance/hits/suggestions. Happy to provide additional information if need - just let me know what you need to know.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
What happens if you whack that and create it via the GUI (assuming this is a test...)?

Thanks, that seemed to do it. For the benefit of anyone who might have the same goal.

I did:
  • zpool destroy to get rid of the old pool.
  • Created BACKUP02 with the GUI (Checked to see that it showed up with glabel status.)
  • Used the GUI to detach BACKUP02
  • Imported the pool from the shell
Problem solved - drive shows up just fine.

I have the following ada devices listed:
BEFORE: (ada0p2, ada1p2, ada2p1)
AFTER: (ada0p2, ada1p2, ada2p1, ada3p2, ada3p1)

I'm wondering if it has something to do with the creation of a second partion/swap?

I don't mind the reserved space for the swap partition, but I would prefer the that removable drive not be in any way connected to FreeNAS's swap. I
ve got a main pool of 8x6TB which have swap, so there is no reason for it, and if I get careless and dismount the drive without detaching it, I don't want it to crash the whole system.

Is there some sort of set variable or other way to make sure BACKUP02 is never mounted for swap?

I'm hoping someone with FreeBSD/FreeNAS can maybe fill in a few details so I understand what is going on.

Thanks in advance for any help/suggestions.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I'm wondering if it has something to do with the creation of a second partion/swap?
I suspect it rather has to do with the partition table, not the presence or absence of any particular partitions.
Is there some sort of set variable or other way to make sure BACKUP02 is never mounted for swap?
You could have created BACKUP02 without the swap partition at all by setting that size to 0 in the GUI before creating the pool.
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Here is what I did:
  • I inserted an unformatted disk into the drive in the machine and spun it up
  • Did a zpool create BACKUP02 /dev/ada3 (The pool is correctly mounted as /BACKUP02)
    (which is what I want in this application-don't want the GUI managing/touching it in any way)
  • touch /BACKPUP02/junkfile successfully creates a file
  • zpool status reports the pool as online with no errors.
  • smartctl -a /dev/ada3 also works as expected.
My problem is that I have utilities that depend on glabel status reporting that the drive is present, but ada3 isn't showing up. glabel status reports the presence of all the other drives (da0p2, da1p2, da2p2, da3p2, da4p2, da5p2, da6p2, da7p2, ada0p2, ada1p2, ada2p1) on the system correctly.

Does anyone have any idea as to why this might be happening, and more importantly how I can fix it?
Thanks in advance for any assistance/hits/suggestions. Happy to provide additional information if need - just let me know what you need to know.
You never partition the drive for one thing and after partition, you need to assign a label which is generated by the system.

Someone else probably already answered.


Sent from my SAMSUNG-SGH-I537 using Tapatalk
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Last edited:

NASbox

Guru
Joined
May 8, 2012
Messages
650
You could have created BACKUP02 without the swap partition at all by setting that size to 0 in the GUI before creating the pool.
I couldn't find that option in the Volume Manager. Did I miss something, or did they remove it? (I'm running 11.1-U4)

Given the drive is a backup, I can't think of any reason that I would be attempting to "replace" it, I would likely recreate it from scratch using a new disk.
It's a single drive pool, so any its likely unrecoverable anyway. I've heard the argument made that when a drive is part of a multi-drive pool that having the swap space gives a bit of flex in the event that you want to replace a drive with one that happens to be a "few" sectors smaller. I'm assuming that is true, but I don't have first hand experience.

I don't have any real data on the disk, so I'm free to experiment a bit.

I started with this:
Code:
#>zpool destroy BACKUP02
#>gpart show ada3	  
=>		 40  19532873648  ada3  GPT  (9.1T)
		   40		   88		- free -  (44K)
		  128	  4194304	 1  freebsd-swap  (2.0G)
	  4194432  19528679248	 2  freebsd-zfs  (9.1T)
  19532873680			8		- free -  (4.0K)
#>gpart delete -i 1 ada3
ada3p1 deleted
#>gpart show ada3	  
=>		 40  19532873648  ada3  GPT  (9.1T)
		   40	  4194392		- free -  (2.0G)
	  4194432  19528679248	 2  freebsd-zfs  (9.1T)
  19532873680			8		- free -  (4.0K)
#>zpool create BACKUP02 ada3
#>zpool status BACKUP02
  pool: BACKUP02
 state: ONLINE
  scan: none requested
config:

		NAME		STATE	 READ WRITE CKSUM
		BACKUP02	ONLINE	   0	 0	 0
		  ada3	  ONLINE	   0	 0	 0
#>glabel status
(ada3 is missing!)

Not only was ada3 is missing, but it appeared as a candidate for volume creation in the GUI

I wiped the GPT on the ada3 and recreated the pool with zpool create BACKUP02:
#>gpart list ada3
gpart: No such geom: ada3.
#>gpart show ada3
gpart: No such geom: ada3.

So if IIUC what is happening is that zpool create on a blank (no partition table explicitly created) creates the zpool without any partition table.
That's a concept that I haven't seen coming from both Windoze/Linux - a file system without a partion table. Am I correct in my understanding?

I'm OK with letting the GUI create my pool, but is there any way to make sure the disk doesn't become part of the swap space pool?
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I couldn't find that option in the Volume Manager. Did I miss something
Yes, you did--that option isn't in the Volume Manager; it's in the advanced system settings:
upload_2018-5-30_18-54-13.png

Am I correct in my understanding?
Yes.
is there any way to make sure the disk doesn't become part of the swap space pool?
Yes, see above.
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
Does glabel status depend on the device having a GPT partition table?

Believe so. And if you use the whole drive for ZFS, as you did, it might not.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Believe so. And if you use the whole drive for ZFS, as you did, it might not.
...which was my suspicion (and was consistent with what OP was seeing), hence posing the question.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
Thanks all for the answers guys....

I just gave this a try which seemed to work: (Posted here for the benefit of others who may be walking a similar path)
Code:
MBR/GPT of drive ada3 successfully wiped
#>gpart create -s gpt ada3
ada3 created
#>gpart add -t freebsd-zfs -b 128 -s 19528679248 -i 1 ada3
ada3p1 added
#>gpart show ada3
=>		 40  19532873648  ada3  GPT  (9.1T)
		   40		   88		- free -  (44K)
		  128  19528679248	 1  freebsd-zfs  (9.1T)
  19528679376	  4194312		- free -  (2.0G)
#>glabel status
									  Name  Status  Components
[LINES DELETED]
gptid/b5793290-6474-11e8-8a07-001517d2677a	 N/A  ada3p1
#>zpool create BACKUP02 ada3p1
#>zpool status BACKUP02
  pool: BACKUP02
 state: ONLINE
  scan: none requested
config:

		NAME		STATE	 READ WRITE CKSUM
		BACKUP02	ONLINE	   0	 0	 0
		  ada3p1	ONLINE	   0	 0	 0

errors: No known data errors
#>ls -l /BACK*
total 0
#>ls -la /
total 200
[LINES DELETED]
drwxr-xr-x   2 root  wheel	 2 May 30 21:52 BACKUP02
[LINES DELETED]
and it seems to do what I need done. (Comments please - does this look OK?)

After slugging though the exercise of creating this, I just realized that the code I've written assumes 'xxxp2' and I have some backups that I've created that way. So I've decided I'm OK with letting FreeNAS create the partitions/pool (it only wastes about 2GB) as long as I can I make sure my removable volume isn't part of the swap space.

I wasn't sure if the drive (just because it had swap) was part of the swap pool, so after a bit of research I tried this command:
#>swapctl -l
Device: 1024-blocks Used:
/dev/mirror/swap0.eli 2097152 66852
/dev/mirror/swap1.eli 2097152 67656
/dev/mirror/swap2.eli 2097152 64916
/dev/mirror/swap3.eli 2097152 66920
/dev/mirror/swap4.eli 2097152 66336
So I'm not even sure if the drive actually is part of the swap area. How do I relate swapX.eli to a physical drive?
Maybe I have the problem solved??? If not:

How can I import/mount my removable volume so it doesn't become part of the swap space?
(Or what command can I run after importing to take the pool out of the swap)


Thanks for any hints/advice/assistance.
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
So if IIUC what is happening is that zpool create on a blank (no partition table explicitly created) creates the zpool without any partition table.
That's a concept that I haven't seen coming from both Windoze/Linux - a file system without a partion table. Am I correct in my understanding?
Yes, zpool create on blank disks does not bother partitioning the drive because you told it to use the whole drive.
The thing that you need to understand is that you can make a zpool from a set of (or even one) files on a drive. ZFS just shovels data into the place you tell it to use. It relies on the user (storage administrator) to make sure that the place is a good one.
If you make a zpool from a set of files, naturally you are not going to partition the file. So, if you want to partition the drive, you must do so first, then select the partition by the UUID instead of the da#.

When you create a pool from the FreeNAS user interface (instead of the command line) something called 'middleware' handles the partitioning of the drives and then puts the partitions in the pool. The default for FreeNAS is to have a swap partition on each drive first (2GB) then the rest of the drive as a ZFS partition.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
Yes, zpool create on blank disks does not bother partitioning the drive because you told it to use the whole drive.
The thing that you need to understand is that you can make a zpool from a set (or even one) files on a drive. ZFS just shovels data into the place you tell it to use. It relies on the user (storage administrator) to make sure that the place is a good one.
Thanks... Great insight. Any ideas about importing a pool on a disk that has a swap partition without using the swap-just importing the pool?
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Thanks... Great insight. Any ideas about importing a pool on a disk that has a swap partition without using the swap-just importing the pool?
My suggestion would be to set the swap to zero in the GUI, which was already mentioned above, then create the single disk pool on disk through the GUI. Since the swap size is set to zero, it won't create a swap partition on disk.
When I am provisioning a server at work, I will often set the swap size in the GUI to 8GB and create a two drive mirror pool for my first pool. That way it gets the system dataset and all the swap on that mirror and then I will set the swap size to zero before I provision the storage pool. I don't need 80 drives in a server to have mirrored swap space. It will never use 40GB of swap anyhow.
Sorry... Got a little off track there.
Once you have your drive prepped by the GUI, importing and exporting the pool is quite easy and the only time the system allocates swap is during boot. The swap stays stable while the system is up.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
My suggestion would be to set the swap to zero in the GUI, which was already mentioned above, then create the single disk pool on disk through the GUI. Since the swap size is set to zero, it won't create a swap partition on disk.
I tried to do this, and I couldn't find the setting. When I was creating the pool, I went to STORAGE > VOLUME MANAGER and created the pool with the dialog box. I didn't see any settings (even under the Manual tab). Did I do something wrong? I'm running v11.1-U4.
When I am provisioning a server at work, I will often set the swap size in the GUI to 8GB and create a two drive mirror pool for my first pool. That way it gets the system dataset and all the swap on that mirror and then I will set the swap size to zero before I provision the storage pool. I don't need 80 drives in a server to have mirrored swap space. It will never use 40GB of swap anyhow.
Sorry... Got a little off track there.
Good tip to keep in mind if/when I reprovision my server. I could not find the setting unfortunately this time.
Once you have your drive prepped by the GUI, importing and exporting the pool is quite easy and the only time the system allocates swap is during boot. The swap stays stable while the system is up.
I think this might be the key right here - IIUC as long as the backup is not in the machine during BOOT, the swap partition on it will never be used. Correct?

If I do make a mistake and boot with the removable drive in, will the system allow me to zpool export BACKUP and remove the disk from the swap?

If so, can I then zpool import BACKUP without the drive being added to the swap pool?
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
I think this might be the key right here - IIUC as long as the backup is not in the machine during BOOT, the swap partition on it will never be used. Correct?
Yes
If I do make a mistake and boot with the removable drive in, will the system allow me to zpool export BACKUP and remove the disk from the swap?
It should. But it will leave one of the swap mirrors broken until the next boot.
If so, can I then zpool import BACKUP without the drive being added to the swap pool?
Once a swap mirror is broken, it will stay broken until boot. The mirrors are established at boot only.
 
Last edited:

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Unless the development team changes it again.

They change things sometimes and I don't always catch it right away. I usually run a version, or several, behind the latest version in an effort to avoid having to struggle with the bugs that early adopters find.
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
I tried to do this, and I couldn't find the setting. When I was creating the pool, I went to STORAGE > VOLUME MANAGER and created the pool with the dialog box. I didn't see any settings (even under the Manual tab). Did I do something wrong? I'm running v11.1-U4.
It is in the System / Advanced menu, here:

upload_2018-5-31_22-40-49.png
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
It is in the System / Advanced menu, here:
View attachment 24280
Thanks... I'm assuming once the system is configured and there is sufficient swap space set up on other pools that setting this value to 0 only suppresses the creation of new new swap space.

I also assume the "not recommended" applies to disabling swap completely.
 
Top