SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
mount: add option to auto create dir to mount
Chris Lu0d1d83a5a506
diff --git a/weed/command/mount.go b/weed/command/mount.goindex efa4650ab7..fefc4ff53e 100644--- a/weed/command/mount.go+++ b/weed/command/mount.go@@ -8,6 +8,7 @@ type MountOptions struct {filer *stringfilerMountRootPath *stringdir *string+ dirAutoCreate *booldirListCacheLimit *int64collection *stringreplication *string@@ -33,6 +34,7 @@ func init() {mountOptions.filer = cmdMount.Flag.String("filer", "localhost:8888", "weed filer location")mountOptions.filerMountRootPath = cmdMount.Flag.String("filer.path", "/", "mount this remote path from filer server")mountOptions.dir = cmdMount.Flag.String("dir", ".", "mount weed filer to this directory")+ mountOptions.dirAutoCreate = cmdMount.Flag.Bool("dirAutoCreate", false, "auto create the directory to mount to")mountOptions.dirListCacheLimit = cmdMount.Flag.Int64("dirListCacheLimit", 1000000, "limit cache size to speed up directory long format listing")mountOptions.collection = cmdMount.Flag.String("collection", "", "collection to create the files")mountOptions.replication = cmdMount.Flag.String("replication", "", "replication(e.g. 000, 001) to create to files. If empty, let filer decide.")diff --git a/weed/command/mount_std.go b/weed/command/mount_std.goindex b6715fc304..9157541669 100644--- a/weed/command/mount_std.go+++ b/weed/command/mount_std.go@@ -88,6 +88,9 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {uid, gid := uint32(0), uint32(0)// detect mount folder mode+ if *option.dirAutoCreate {+ os.MkdirAll(dir, 0755)+ }mountMode := os.ModeDir | 0755fileInfo, err := os.Stat(dir)if err == nil {