Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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!

share|improve this question
1  
Can you update your question showing current bsdlabel with bsdlabel ad0s2. –  kworr Sep 17 '12 at 12:04
add comment

2 Answers

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

# sysctl kern.geom.debugflags=16

share|improve this answer
add comment

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).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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