Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Bug 196102] New: "gpart: device busy" even though it's not in use

1,205 views
Skip to first unread message

bugzilla...@freebsd.org

unread,
Dec 18, 2014, 1:00:03 PM12/18/14
to
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196102

Bug ID: 196102
Summary: "gpart: device busy" even though it's not in use
Product: Base System
Version: 11.0-CURRENT
Hardware: amd64
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: bin
Assignee: freebs...@FreeBSD.org
Reporter: da...@bitmail.cc

i bought a new hard drive, and am trying to setup geli with ZFS on it.
geli refuses to write the metadata, when the first partition is too big.
so i am trying to delete the first partition, to recreate a smaller one.
yet gpart claims my drive is "busy". here's the relevant output:

root@mango:/etc/ > gpart delete -i0 da0
gpart: index '0': No such file or directory
root@mango:/etc/ > gpart delete -i1 da0
gpart: Device busy
root@mango:/etc/ > gpart destroy -F da0
gpart: Device busy
root@mango:/etc/ > sysctl kern.geom.debugflags=16
kern.geom.debugflags: 16 -> 16
root@mango:/etc/ > gpart show da0
=> 40 7814037088 da0 GPT (3.6T)
40 7814037080 1 freebsd-zfs (3.6T)
7814037120 8 - free - (4.0K)

root@mango:/etc/ > dd if=/dev/zero of=/dev/da0 bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes transferred in 2.630170 secs (39867229 bytes/sec)
root@mango:/etc/ > gpart show da0
=> 40 7814037088 da0 GPT (3.6T)
40 7814037080 1 freebsd-zfs (3.6T)
7814037120 8 - free - (4.0K)

root@mango:/etc/ > gpart destroy -F da0
gpart: Device busy
root@mango:/etc/ > mount
sys/ROOT/default on / (zfs, local, noatime, nfsv4acls)
devfs on /dev (devfs, local, multilabel)
data on /data (zfs, local, noatime, nfsv4acls)
backup/default on /mnt (zfs, local, noatime, nfsv4acls)
sys/ports on /usr/ports (zfs, local, noatime, nfsv4acls)
sys/src on /usr/src (zfs, local, noatime, nfsv4acls)
root@mango:/etc/ > umount /dev/da0
umount: /dev/da0: unknown file system
root@mango:/etc/ > fuser /dev/da0
/dev/da0:
root@mango:/etc/ > uname -a
FreeBSD mango 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r275830: Wed Dec 17 13:33:45
CET 2014 root@mango:/usr/obj/usr/src/sys/GENERIC-NODEBUG amd64

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebs...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs...@freebsd.org"

bugzilla...@freebsd.org

unread,
Dec 19, 2014, 12:02:55 PM12/19/14
to
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196102

--- Comment #1 from da...@bitmail.cc ---
FYI: after i rebooted the device is working just fine.

bugzilla...@freebsd.org

unread,
Aug 14, 2016, 10:16:32 AM8/14/16
to
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196102

Stefan <blac...@b-tu.de> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |blac...@b-tu.de

--- Comment #2 from Stefan <blac...@b-tu.de> ---
Just installed FreeBSD 11 RC1 on da1, da2, da3 (mirrored zpool) without swap,
intending to add swap space on da0 after installation.
At the end of the installer I went to the console to add swap space, starting
with "gpart destroy da0" (it contained an NTFS partition). gpart says "Device
busy".
So I rebooted and after the first bootup I retried. Still "Device busy".
Rebooted a third time. Device still "busy".
Then I zeroed the first gigabyte of da0 using dd. After this, "gpart show" did
not list da0 anymore.
Now "gpart destroy da0" resulted in "gpart: arg0 'da0': Invalid argument".
However, "gpart create -s GPT da0" now succeeded "da0 created".

I guess this bug only occurs if the system is being installed not on da0 but on
da1 or higher. So it could probably be reproduced by installing FreeBSD onto
da1+ and then attempting to manually repartition da0.

Hope this helps.

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebs...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs

bugzilla...@freebsd.org

unread,
Aug 14, 2016, 10:23:45 AM8/14/16
to
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196102

Andrey V. Elsukov <a...@FreeBSD.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |a...@FreeBSD.org

--- Comment #3 from Andrey V. Elsukov <a...@FreeBSD.org> ---
(In reply to Stefan from comment #2)
> Just installed FreeBSD 11 RC1 on da1, da2, da3 (mirrored zpool) without
> swap, intending to add swap space on da0 after installation.
> At the end of the installer I went to the console to add swap space,
> starting with "gpart destroy da0" (it contained an NTFS partition). gpart
> says "Device busy".

It is busy, because before destroying a partition table you must to delete all
its partitions or use -F flag.

> I guess this bug only occurs if the system is being installed not on da0 but
> on da1 or higher. So it could probably be reproduced by installing FreeBSD
> onto da1+ and then attempting to manually repartition da0.

This isn't bug. It works as expected.

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebs...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs

bugzilla...@freebsd.org

unread,
Aug 14, 2016, 10:50:03 AM8/14/16
to
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196102

--- Comment #4 from Stefan <blac...@b-tu.de> ---
Thank you for the quick reply, Andrey.

Sounds plausible, but then the message "Device busy" is very misleading imho.

Suggestion:
Could the message maybe changed to something more informative and less
confusing like "Please delete the partitions first or force destroying the
partition table using the -F flag"?

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebs...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs

bugzilla...@freebsd.org

unread,
Sep 12, 2017, 6:18:35 AM9/12/17
to
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196102

Alexey Dokuchaev <da...@FreeBSD.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |da...@FreeBSD.org
Severity|Affects Only Me |Affects Some People
Hardware|amd64 |Any

--- Comment #5 from Alexey Dokuchaev <da...@FreeBSD.org> ---
I agree, this is pretty annoying. I've filed a DR
(https://reviews.freebsd.org/D12336) to include more elaborate example of how
to properly delete partitions and partition table in the gpart(8) manual page.

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebs...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs

bugzilla...@freebsd.org

unread,
Sep 19, 2017, 11:16:50 AM9/19/17
to
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196102

Alexey Dokuchaev <da...@FreeBSD.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|New |Closed
Resolution|--- |FIXED

--- Comment #6 from Alexey Dokuchaev <da...@FreeBSD.org> ---
gpart(8) manual page was updated to include example of how to properly delete
partitions and partitioning scheme as of base r323764, hence I'm closing this
PR.

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebs...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
0 new messages