Bug 236006

Summary: 'bectl destroy' doesn't remove snapshots
Product: Base System Reporter: Sergey <kpect>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed DUPLICATE    
Severity: Affects Some People CC: rew
Priority: ---    
Version: CURRENT   
Hardware: amd64   
OS: Any   

Description Sergey 2019-02-24 18:06:37 UTC
Hello,
When I destroy BE, snopshot is still there, and they keep laying around until you delete them manually...

$ zfs list -t snap
NAME USED AVAIL REFER MOUNTPOINT
$ bectl list
BE Active Mountpoint Space Created
default NR / 582M 2018-12-20 19:10
$ doas bectl create backup
$ bectl list
BE Active Mountpoint Space Created
default NR / 582M 2018-12-20 19:10
backup - - 1K 2019-02-22 20:58
$ zfs list -t snap
NAME USED AVAIL REFER MOUNTPOINT
zroot/ROOT/default@2019-02-22-20:58:39 0 - 582M -
$ doas bectl destroy backup
$ bectl list
BE Active Mountpoint Space Created
default NR / 582M 2018-12-20 19:10
$ zfs list -t snap
NAME USED AVAIL REFER MOUNTPOINT
zroot/ROOT/default@2019-02-22-20:58:39 0 - 582M -

Best regards,
Sergey
Comment 1 Robert Wing freebsd_committer freebsd_triage 2019-02-26 00:09:18 UTC
Hey Sergey,

As of R343993, bectl accepts the '-o' flag to destroy the origin snapshot when you a boot environment is destroyed.

From the man page (CURRENT): 
    ...
    ...
    destroy [-Fo] {beName | beName@snapshot}
               Destroys the given beName boot environment or beName@snapshot
               snapshot without confirmation, unlike in beadm.  Specifying -F
               will automatically unmount without confirmation.

               By default, bectl will warn that it is not destroying the
               origin of beName.  The -o flag may be specified to destroy the
               origin as well.
    ...
    ...


so, the following *should* delete the origin snapshot as well:

$ bectl create backup

$ bectl destroy -o backup


I say should because deleting the origin snapshot with the '-o' flag failed for
me. I submitted a bug report and a proposed patch: 

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236043
Comment 2 Sergey 2019-02-26 06:43:24 UTC
(In reply to Rob from comment #1)
Thanx Rob, then I'm closing this ticket.
BR,
Sergey.
Comment 3 Sergey 2019-02-26 06:44:16 UTC

*** This bug has been marked as a duplicate of bug 236043 ***