1010//! - SSHFS mounts via sshfs
1111//! - NFS storage via mount -t nfs
1212//! - Local directory bind mounts
13- //! - WolfDisk mounts via wolfdiskctl
13+ //! - WolfDisk mounts via wolfdisk CLI
1414//! - Global mounts replicated across the cluster
1515//! - Import of S3 configs from rclone.conf
1616
@@ -212,7 +212,7 @@ pub fn unmount_storage(id: &str) -> Result<String, String> {
212212 return Ok ( "Not mounted" . to_string ( ) ) ;
213213 }
214214
215- // For S3 mounts, try fusermount first (for s3fs), then regular umount (for rust-s3 bind mounts)
215+ // Type-specific unmount handling
216216 let output = if config. mounts [ idx] . mount_type == MountType :: S3 {
217217 // Try fusermount first (s3fs), fall back to regular umount (rust-s3 bind mount)
218218 let fuse_result = Command :: new ( "fusermount" )
@@ -224,6 +224,17 @@ pub fn unmount_storage(id: &str) -> Result<String, String> {
224224 . arg ( & config. mounts [ idx] . mount_point )
225225 . output ( ) ,
226226 }
227+ } else if config. mounts [ idx] . mount_type == MountType :: Wolfdisk {
228+ // WolfDisk uses FUSE — try wolfdisk unmount, fall back to fusermount
229+ let wd_result = Command :: new ( "wolfdisk" )
230+ . args ( [ "unmount" , "--mountpoint" , & config. mounts [ idx] . mount_point ] )
231+ . output ( ) ;
232+ match & wd_result {
233+ Ok ( o) if o. status . success ( ) => wd_result,
234+ _ => Command :: new ( "fusermount" )
235+ . args ( [ "-u" , & config. mounts [ idx] . mount_point ] )
236+ . output ( ) ,
237+ }
227238 } else {
228239 Command :: new ( "umount" )
229240 . arg ( & config. mounts [ idx] . mount_point )
@@ -695,17 +706,22 @@ fn mount_directory(mount: &StorageMount) -> Result<String, String> {
695706}
696707
697708fn mount_wolfdisk ( mount : & StorageMount ) -> Result < String , String > {
698- // Check if wolfdiskctl exists
699- if !Path :: new ( "/usr/local/bin/wolfdiskctl" ) . exists ( )
700- && !Path :: new ( "/opt/wolfdisk/wolfdiskctl" ) . exists ( ) {
709+ // Check if wolfdisk binary exists (wolfdisk has mount, wolfdiskctl is monitoring only)
710+ if !has_wolfdisk ( ) {
701711 return Err ( "WolfDisk is not installed. Install it first via Components." . to_string ( ) ) ;
702712 }
703-
704- let output = Command :: new ( "wolfdiskctl" )
705- . args ( [ "mount" , & mount. source , & mount. mount_point ] )
713+
714+ let mut args = vec ! [ "mount" , "--mountpoint" , & mount. mount_point] ;
715+ // If source specifies a config path, use it (otherwise wolfdisk uses /etc/wolfdisk/config.toml)
716+ if !mount. source . is_empty ( ) {
717+ args. extend ( [ "--config" , & mount. source ] ) ;
718+ }
719+
720+ let output = Command :: new ( "wolfdisk" )
721+ . args ( & args)
706722 . output ( )
707- . map_err ( |e| format ! ( "Failed to run wolfdiskctl : {}" , e) ) ?;
708-
723+ . map_err ( |e| format ! ( "Failed to run wolfdisk : {}" , e) ) ?;
724+
709725 if output. status . success ( ) {
710726 Ok ( "WolfDisk storage mounted" . to_string ( ) )
711727 } else {
@@ -796,9 +812,9 @@ fn has_nfs() -> bool {
796812}
797813
798814fn has_wolfdisk ( ) -> bool {
799- Path :: new ( "/usr/local/bin/wolfdiskctl " ) . exists ( )
800- || Path :: new ( "/opt/wolfdisk/wolfdiskctl " ) . exists ( )
801- || Command :: new ( "which" ) . arg ( "wolfdiskctl " ) . output ( ) . map ( |o| o. status . success ( ) ) . unwrap_or ( false )
815+ Path :: new ( "/usr/local/bin/wolfdisk " ) . exists ( )
816+ || Path :: new ( "/opt/wolfdisk/wolfdisk " ) . exists ( )
817+ || Command :: new ( "which" ) . arg ( "wolfdisk " ) . output ( ) . map ( |o| o. status . success ( ) ) . unwrap_or ( false )
802818}
803819
804820fn install_s3fs ( ) -> Result < ( ) , String > {
0 commit comments