增加导出
指定路径生成导出的配置文件,例如 /etc/ganesha/export1.conf
内容类似下面的EXPORT 配置
EXPORT {
# Export Id (mandatory, each EXPORT must have a unique Export_Id)
Export_Id = <export_id>;
# Exported path (mandatory)
Path = /;
# Pseudo Path (required for NFSv4 or if mount_path_pseudo = true)
Pseudo = <export_path>;
# Restrict the protocols that may use this export. This cannot allow
# access that is denied in NFS_CORE_PARAM.
Protocols = 3, 4;
# Allowed security types for this export
Sectype = sys,krb5,krb5i,krb5p;
# Verify permission or not
PermissionCheck = true;
# Exporting FSAL
FSAL {
FsName = <fsname>;
Name = VFS;
}
}
持久化配置,在ganesha.conf配置最后增加一行: %include “/etc/ganesha/export1.conf”
动态生效
#命令 需要指定配置文件路径和export_id
dbus-send --print-reply --system --dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr org.ganesha.nfsd.exportmgr.AddExport string:/etc/ganesha/export1.conf string:"export(export_id=3)"
#命令结果
method return time=1710486414.378115 sender=:1.1037142 -> destination=:1.1060978 serial=75661 reply_serial=2
string "1 exports added"
删除导出
持久化配置,在ganesha.conf配置中,删除指定行: %include “/etc/ganesha/export1.conf”
动态生效
#命令 指定export_id 这里是3 格式为uint16:3
dbus-send --print-reply --system --dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr org.ganesha.nfsd.exportmgr.RemoveExport uint16:3
#命令结果
method return time=1710486377.410891 sender=:1.1037142 -> destination=:1.1060960 serial=75623 reply_serial=2
更新配置
修改导出/etc/ganesha/export1.conf的配置,例如增加Client权限,
EXPORT {
# Export Id (mandatory, each EXPORT must have a unique Export_Id)
Export_Id = <export_id>;
# Exported path (mandatory)
Path = /;
# Pseudo Path (required for NFSv4 or if mount_path_pseudo = true)
Pseudo = <export_path>;
# Restrict the protocols that may use this export. This cannot allow
# access that is denied in NFS_CORE_PARAM.
Protocols = 3, 4;
# Allowed security types for this export
Sectype = sys,krb5,krb5i,krb5p;
# Verify permission or not
PermissionCheck = true;
# Exporting FSAL
FSAL {
FsName = <fsname>;
Name = VFS;
}
CLIENT {
Clients = 10.226.135.46, 10.226.135.42;
Access_Type = RW;
Squash = No_root_squash;
}
CLIENT {
Clients = 10.226.135.51;
Access_Type = RO;
Squash = No_root_squash;
}
}
动态生效
#命令
dbus-send --print-reply --system --dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr org.ganesha.nfsd.exportmgr.UpdateExport string:/etc/ganesha/fs-opf26dc682_dir1.conf string:"export(export_id=3)"
#命令结果
method return time=1710486951.711441 sender=:1.1037142 -> destination=:1.1061146 serial=76199 reply_serial=2
string "1 exports updated"