2

I have recently installed FreeBSD but I don't like the partition sizes that I accepted during installation and would like to change them. I have followed the instructions to do so in the man pages, so as root I did

# bsdlabel -e ad0s2

(ad0s2 is the partition on which FreeBsd is installed). After I make my changes, I try to save and exit but I get the following message:

/tmp/EdDk.RBNU2c8vnz: unmodified: line 1
bsdlabel: cannot open provider /dev/ad0s2 for writing label: Operation not permitted
re-edit the label? [y]:

If I try to re-edit, I get the same message again. I even get this message if I try to save without making any changes. I am new to FreeBSD and thought maybe there is something I must do prior to altering the disk label but I cannot find any such information anywhere. Can anyone please help me here? Thanks!

  • 1
    Can you update your question showing current bsdlabel with bsdlabel ad0s2. – kworr Sep 17 '12 at 12:04
2

Did you enable "foot-shooting" in the GEOM debug flags?

# sysctl kern.geom.debugflags=16

1

I don't know what exactly you're trying to do, but beware you can't resize filesystems by editing the disklabel.

The only way to resize the filesystem is by using growfs(8), but this'll only work for appending size to the end, this won't work if there's another filesystem in the way. To explain with an image:

Before:    After:
+-----+    +-----+
| fs1 |    + fs1 +
+-----+    |     |
|     |    +-----+
| fs2 |    | fs2 |
+-----+    +-----+

As you see, enlarging fs1 means moving the start of fs2. This is not something you can do with UFS on FreeBSD. So if you would edit the disklabel like this, fs1 would be fine, but fs2 would be corrupted.

In other words: If you don't like the filesystem size you choose at install time, you'll need to backup & reinstall, or live with it.

That being said, you can use sysctl kern.geom.debugflags=16 to make the changes anyway, (this will allow you to edit the partition label and/or disklabel on a mounted disk).

0

You can always use gpart to modify both MBR partition table and BSD disk label. For example, in order to change the type of the partition b of the slice 1 of ada0 type:

# gpart modify -i 2 -t freebsd-ufs /dev/ada0s1 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.