Issue with gpart "Device Busy"

ian at dijix.com ian at dijix.com
Thu Apr 16 23:00:37 UTC 2020


Thank you for the advices, however it turns out it was user error.. I swapped the drive in from an apple machine, the new drive took ada0 and my existing drive moved to ada1.

I’m just playing with ZFS at the moment and what I didn’t realise is that the system swap was still assigned to ada0p2 but of course instead of being on my new ZFS drive was instead pointing to an apple-hfs data partition on the freshly added drive.

For some reason I assumed it was something to do with HFSFUSE and gpart when in actual fact it was just me not paying attention to the basics!


> On 16 Apr 2020, at 18:44, Harry Schmalzbauer <freebsd at omnilan.de <mailto:freebsd at omnilan.de>> wrote:
> 
> Am 15.04.2020 um 20:35 schrieb ian at dijix.com <mailto:ian at dijix.com>:
>> I have an issue with gpart, it will not let me delete partition ada0p2 responding with “Device Busy”
>> The man page gpart(8) says this may be shown if a partition exists but I cannot seem to delete partition 2 in my case via gpart delete or gpart destroy
>> 
>> This is a used disk but new to the machine, I can modify the partition type and create partitions before and after partition 2 but I cannot delete it.
>> 
>> Here’s what I have tried so far:
>> 
>> 
>> root at beastie:~ # gpart show
>> =>        34  1250263661  ada0  GPT  (596G)
>>        34      409606        - free -  (200M)
>>    409640  1249591904     2  freebsd-ufs  (596G)
>> 1250001544      262151        - free -  (128M)
>> 
>> =>       40  976773088  ada1  GPT  (466G)
>>       40       1024     1  freebsd-boot  (512K)
>>     1064        984        - free -  (492K)
>>     2048    4194304     2  freebsd-swap  (2.0G)
>>  4196352  972576768     3  freebsd-zfs  (464G)
>> 976773120          8        - free -  (4.0K)
>> 
>> root at beastie:~ # gpart delete -i2 ada0
>> gpart: Device busy
> :
> :
>> :
>> root at beastie:~ # gpart destroy -F ada0
>> gpart: Device busy
> 
> There might still be situations where 'sysctl kern.geom.debugflags=16' helps, but I never needed it in the last years (since 7.x I guess).
> Are you sure p2 (-i2) of ada0, most likely home for a ufs filesystem, isn't mounted anymore? Was it a mountpoint inside a jail?  Stopping the jail might leave network related active sockets blocking the filesystem (reboot without starting the jail before deleteing the partition should work in that case).
> 
> -harry



More information about the freebsd-stable mailing list