diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-08-28 02:25:48 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-08-28 02:25:48 -0700 |
| commit | 65a29ad42ab382a625a4a01c23c5b8e4a7ffa181 (patch) | |
| tree | 715b197b1823381019d032b250fabdd4df719a25 | |
| parent | a22f37b01cd4cf12d27816c665cbf014cce37aab (diff) | |
| download | seaweedfs-65a29ad42ab382a625a4a01c23c5b8e4a7ffa181.tar.xz seaweedfs-65a29ad42ab382a625a4a01c23c5b8e4a7ffa181.zip | |
add warning on unmount a folder
| -rw-r--r-- | weed/shell/command_remote_unmount.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/weed/shell/command_remote_unmount.go b/weed/shell/command_remote_unmount.go index 55b9bce05..c2857dbbf 100644 --- a/weed/shell/command_remote_unmount.go +++ b/weed/shell/command_remote_unmount.go @@ -31,7 +31,9 @@ func (c *commandRemoteUnmount) Help() string { remote.mount -dir=/xxx -remote=s3_1/bucket # unmount the mounted directory and remove its cache - remote.unmount -dir=/xxx + # Make sure you have stopped "weed filer.remote.sync" first! + # Otherwise, the deletion will also be propagated to the remote storage!!! + remote.unmount -dir=/xxx -iHaveStoppedRemoteSync ` } @@ -41,6 +43,7 @@ func (c *commandRemoteUnmount) Do(args []string, commandEnv *CommandEnv, writer remoteMountCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError) dir := remoteMountCommand.String("dir", "", "a directory in filer") + hasStoppedRemoteSync := remoteMountCommand.Bool("iHaveStoppedRemoteSync", false, "confirm to stop weed filer.remote.sync first") if err = remoteMountCommand.Parse(args); err != nil { return nil @@ -59,6 +62,9 @@ func (c *commandRemoteUnmount) Do(args []string, commandEnv *CommandEnv, writer return fmt.Errorf("directory %s is not mounted", *dir) } + if !*hasStoppedRemoteSync { + return fmt.Errorf("make sure \"weed filer.remote.sync\" is stopped to avoid data loss") + } // purge mounted data if err = c.purgeMountedData(commandEnv, *dir); err != nil { return fmt.Errorf("purge mounted data: %v", err) |
