# gpart label missing



## BostonDriver (Jan 2, 2013)

Hi,

I've moved FreeBSD 9.0 Release to a larger disk.  The steps followed the disk setup document by wblock@ on a USB attached disk.  Each gpart add used -l to provide a label.

Once the partitions and ufs filesystems were created, I used dump/restore to copy the old (smaller) partitions to their larger new homes.

Both gpart show -l  and ls /dev/gpt showed the labels supplied to the gpart add command 

When swapping the disks, the new disk da0 when USB attached became ada0 (in case that matters) and only 2 of the labels show up using in ls /dev/gpt.  The two are the labels for the boot partition and another partition that exists but hasn't been used yet (e.g. never mounted.)  All the rest don't show.  Using gpart show -l all labels seem to be there.

Should /dev/gpt list these?


----------



## wblock@ (Jan 2, 2013)

When you mount a partition with a label, the label disappears because the partition is in use.


----------



## BostonDriver (Jan 2, 2013)

wblock@ said:
			
		

> When you mount a partition with a label, the label disappears because the partition is in use.



Thanks.  Since /dev/ada0p1 etc. existed, I thought e.g. /dev/gpt/gprootfs should have as well and thought I set things up wrong.


----------



## Savagedlight (Jan 3, 2013)

wblock@ said:
			
		

> When you mount a partition with a label, the label disappears because the partition is in use.



This is not the case for me, on my system. Root is on UFS2, and its label is still present in /dev/gpt/. Same goes for the swap partition, and every label used by the zpools. I.e., all gpt labels are present in the directory, regardless of the mount status.

`$ uname -a
FreeBSD (...) 9.0-RELEASE-p5 FreeBSD 9.0-RELEASE-p5 #1: Sat Dec 29 03:27:31 CET 2012     root@(...):/usr/obj/usr/src/sys/GENERIC  amd64`


----------



## wblock@ (Jan 3, 2013)

For reasons I've never worked out, it is not always consistent.  It may matter if there are other labels or which was used when mounting the partition.


----------



## xtaz (Jan 3, 2013)

wblock@ said:
			
		

> When you mount a partition with a label, the label disappears because the partition is in use.



My understanding of it was that the label vanishes if the partition is mounted using an alternative method. So if you have a gpt label but mount it using the raw /dev/ada0p1 device then the gpt label vanishes. But I thought if you mounted it using the label then the label remains.

For what it's worth I have all my labels present:


```
# ls /dev/gpt
boot root swap
# mount
/dev/gpt/root on / (ufs, local, journaled soft-updates)
# cat /etc/fstab
/dev/gpt/root           /               ufs     rw      1       1
/dev/gpt/swap           none            swap    sw      0       0
```

But my experience in the past was if I mounted it without using the label then the label was removed from devfs during boot.


----------



## BostonDriver (Feb 17, 2013)

xtaz said:
			
		

> But my experience in the past was if I mounted it without using the label then the label was removed from devfs during boot.



This seems to be exactly what I am seeing... well, was.  I've changed /etc/fstab to use labels now


----------

