@@ -78,12 +78,22 @@ pub fn lvcreate_snapshot(vg: &str, source: &str, name: &str) -> Result<()> {
7878 if !status. success ( ) {
7979 anyhow:: bail!( "lvcreate snapshot failed: {}/{} -> {}" , vg, source, name) ;
8080 }
81- info ! ( vg, source, name, "snapshot created" ) ;
82- // Wait for udev to process the new device node before returning so callers
83- // can immediately open or mount the device path under /dev.
81+ // Thin snapshots are created with the "skip activation" flag (k) set by
82+ // default. Plain lvchange -ay silently respects that flag and does nothing.
83+ // -K (--ignoreactivationskip) overrides it, creating the DM device so the
84+ // /dev/<vg>/<lv> node is present before we return.
85+ let status = Command :: new ( "lvchange" )
86+ . args ( [ "-K" , "-ay" , & format ! ( "{}/{}" , vg, name) ] )
87+ . status ( )
88+ . context ( "failed to run lvchange -K -ay" ) ?;
89+ if !status. success ( ) {
90+ anyhow:: bail!( "lvchange -K -ay failed for {}/{}" , vg, name) ;
91+ }
92+ // Wait for udev to finish creating the /dev/<vg>/<lv> symlink.
8493 let _ = Command :: new ( "udevadm" )
8594 . args ( [ "settle" , "--timeout=5" ] )
8695 . status ( ) ;
96+ info ! ( vg, source, name, "snapshot created and activated" ) ;
8797 Ok ( ( ) )
8898}
8999
0 commit comments