DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD Installation and Upgrading

FreeBSD Installation and Upgrading Installing and upgrading FreeBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 14th January 2010
Jago Jago is offline
New User
 
Join Date: Jan 2010
Posts: 7
Thanked 0 Times in 0 Posts
Default glabels and GPT

What is considered the "proper" way to combine using glabel to label disks and GPT partitioning? If I do it like this:

Code:
glabel label -v disk00 /dev/ad1
gpart create -s GPT /dev/ad1
<create partitions>
Then I am guessing that writing out the partition table will overwrite the last sector, deleting the glabel metadata, correct?

So should I instead do this:

Code:
gpart create -s GPT /dev/ad1
<create partitions>
glabel label -v disk00 /dev/ad1
But won't the label overwrite a part of partition data? Or, should I instead do this:

Code:
glabel label -v disk00 /dev/ad1
gpart create -s GPT /dev/label/disk00
<create partitions>
And from that point on, always avoid ever dealing with the disk device directly, only ever accessing and modifying it through the label?
Reply With Quote
  #2   (View Single Post)  
Old 14th January 2010
Jago Jago is offline
New User
 
Join Date: Jan 2010
Posts: 7
Thanked 0 Times in 0 Posts
Default

Additionally, the gpart manpage refers to "logical blocks" in a couple of places. Am I right in thinking these parts actually refer to "sectors", because both seem to be 512 bytes?
Reply With Quote
  #3   (View Single Post)  
Old 14th January 2010
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is online now
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,074
Thanked 198 Times in 156 Posts
Default

Just the -L option for newfs isn't enough?
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #4   (View Single Post)  
Old 14th January 2010
Jago Jago is offline
New User
 
Join Date: Jan 2010
Posts: 7
Thanked 0 Times in 0 Posts
Default

That's for labelling filesystems, not for labelling disks.
Reply With Quote
  #5   (View Single Post)  
Old 15th January 2010
phoenix's Avatar
phoenix phoenix is offline
Risen from the ashes
 
Join Date: May 2008
Posts: 699
Thanked 90 Times in 81 Posts
Default

Start at the outer (largest) layer, and work your way in from there.

IOW, you label the disk. Then you partition the label. Then you format the partitions. Finally, you use the filesystems.
__________________
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote
  #6   (View Single Post)  
Old 26th January 2010
DNAeon DNAeon is offline
Shell Scout
 
Join Date: Sep 2008
Location: Bulgaria
Posts: 138
Thanked 6 Times in 6 Posts
Default

Quote:
Originally Posted by phoenix View Post
Start at the outer (largest) layer, and work your way in from there.

IOW, you label the disk. Then you partition the label. Then you format the partitions. Finally, you use the filesystems.
That is not exactly true.

If I do it this way, the data is being overwritten actually.

Code:
# glabel label -v disk_ad4 ad4
Metadata value stored on ad4.
Done.

# ls /dev/label
disk_ad4
Now if I do a gpart, see what happens:

Code:
# gpart create -s gpt label/disk_ad4
GEOM: ad4: the secondary GPT table is corrupt or invalid.
GEOM: ad4: using the primary only -- recovery suggested.
label/disk_ad4 created.
And if I do a freebsd-boot partition for example on ad4.

Code:
# gpart add -s 64K -t freebsd-boot ad4
ad4p1 added.
Then I lose the glabel from /dev/label
Code:
# ls /dev/label
#
__________________
"I never think of the future. It comes soon enough." - A.E

Useful links: FreeBSD Handbook | FreeBSD Developer's Handbook | The Porter's Handbook | PF User's Guide | unix-heaven.org
Reply With Quote
  #7   (View Single Post)  
Old 27th January 2010
phoenix's Avatar
phoenix phoenix is offline
Risen from the ashes
 
Join Date: May 2008
Posts: 699
Thanked 90 Times in 81 Posts
Default

Hrm, in that case, I guess GPT overrides disk-level glabels.

I've never used GPT, just MBR-style partitioning, and I've always done it by labelling the disk (glabel label disk00 da0), slicing the label (fdisk -i /dev/label/disk00), partitioning the slice *bsdlabel -e /dev/label/disk00s1), formatting the partition (newfs /dev/label/disk00s1a), and mounting the filesystem.

I guess I'll leave it up to those with more experience with GPT to chime in.

I do know that GPT includes label support, which is accessed via glabel, so perhaps you can use that? Although, then it's partition-level labelling instead of disk-level labelling.
__________________
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote
  #8   (View Single Post)  
Old 27th January 2010
DNAeon DNAeon is offline
Shell Scout
 
Join Date: Sep 2008
Location: Bulgaria
Posts: 138
Thanked 6 Times in 6 Posts
Default

Using glabel together with fdisk and bsdlabel should work without issues, since only glabel is actually writing to the providers last sector.

The problem comes when you try to combine glabel with gpart and gmirror for example

- I've tried labeling a disk and then slicing it with gpart, but then I lose the labels.

- I've tried labeling the filesystem with the -L flag of newfs, when I create the filesystem, but when I use them with gmirror to create a raid-1, then I lose the entries in /dev/ufs

You can label the partitions using gpart, this way:

Code:
# gpart add -s <size> -t freebsd-ufs -l <your-label> <provider>
And then the labels go to /dev/gpt, but if you then use again those labels with gmirror again, you lose the labels.

Currently I cannot think of a good and clean way to put those labels in place, without losing them, after re-using them with gmirror of other GEOM tool.

Regards,
DNAeon
__________________
"I never think of the future. It comes soon enough." - A.E

Useful links: FreeBSD Handbook | FreeBSD Developer's Handbook | The Porter's Handbook | PF User's Guide | unix-heaven.org
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:26 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick