使用 CLI 创建手动快照
要访问共享资源的快照,请导航到该共享资源和快照上下文。
clownfish:> shares select default select builds
clownfish:shares default/builds> snapshots
clownfish:shares default/builds snapshots>
列出快照 (CLI)
可使用标准 CLI 命令列出快照。
clownfish:shares default/builds snapshots> list
today
yesterday
clownfish:shares default/builds snapshots>
创建手动快照 (CLI)
要创建手动项目级快照,请导航到项目和快照节点,然后使用 snapshot 命令:
clownfish:cd /
clownfish:shares select myproject snapshots
clownfish:shares myproject snapshots> snapshot cob_monday
要为单个共享资源创建手动共享资源级快照,请导航到该共享资源,在此处使用 snapshot 命令:
clownfish:cd /
clownfish:shares select myproject select share1 snapshots
clownfish:snapshot lunchtime
重命名快照 (CLI)
要重命名快照,请使用 rename 命令:
clownfish:shares default/builds snapshots> rename test test2
clownfish:shares default/builds snapshots>
销毁快照 (CLI)
要销毁快照,请使用 destroy 命令:
clownfish:shares default/builds snapshots> select test2
clownfish:shares default/builds@test2> destroy
This will destroy this snapshot. Are you sure? (Y/N)
clownfish:shares default/builds snapshots>
您还可以在共享资源上下文中使用 destroy 命令而无需选择单个快照:
clownfish:shares default/builds snapshots> destroy test2
This will destroy this snapshot. Are you sure? (Y/N)
clownfish:shares default/builds snapshots>
回滚到某个快照 (CLI)
要回滚到某个快照,请选择目标快照并运行 rollback 命令:
clownfish:shares default/builds snapshots> select today
clownfish:shares default/builds@today> rollback
Rolling back will revert data to snapshot, destroying newer data. Active
initiators will be disconnected.
Continue? (Y/N)
clownfish:shares default/builds@today>
克隆快照 (CLI)
要克隆快照,请使用 clone 命令。此命令将您置于一个未提交的共享资源上下文中,该上下文与用于创建共享资源的上下文相同。在此处,您可以根据需要调整属性,然后再提交更改以创建克隆。
clownfish:shares default/builds snapshots> select today
clownfish:shares default/builds@today> clone testbed
clownfish:shares default/testbed (uncommitted clone)> get
aclinherit = restricted (inherited)
aclmode = discard (inherited)
atime = true (inherited)
checksum = fletcher4 (inherited)
compression = off (inherited)
copies = 1 (inherited)
mountpoint = /export/testbed (inherited)
quota = 0 (default)
readonly = false (inherited)
recordsize = 128K (inherited)
reservation = 0 (default)
secondarycache = all (inherited)
nbmand = false (inherited)
sharesmb = off (inherited)
sharenfs = on (inherited)
snapdir = hidden (inherited)
vscan = false (inherited)
sharedav = off (inherited)
shareftp = off (inherited)
root_group = other (default)
root_permissions = 777 (default)
root_user = nobody (default)
quota_snap = true (default)
reservation_snap = true (default)
clownfish:shares default/testbed (uncommitted clone)> set quota=10G
quota = 10G (uncommitted)
clownfish:shares default/testbed (uncommitted clone)> commit
clownfish:shares default/builds@today>
此命令还支持一个可选参数(第一个参数),此参数是将在其中创建克隆的项目。默认情况下,将在要克隆的共享资源所属的项目中创建克隆。
使用 CLI 列出从属克隆
要列出从特殊快照(从属克隆)中创建的所有克隆,请导航至该快照,然后使用列出克隆命令。
clonefish:shares default/builds> snapshots
clonefish:shares default/builds snapshots> select today
clonefish:shares default/builds@today> list clones
Clones: 2 total
PROJECT SHARE
default testbed
default production
clonefish:shares default/builds@today>
结果显示克隆名称和克隆所在的项目。
使用 CLI 调度的快照
可以在单个共享资源的项目级使用 automatic 命令在快照上下文中配置自动调度的快照。在此上下文中,可以使用 create 和 destroy 命令添加和删除新时间间隔。每个时间间隔都具有一组属性,这些属性与 BUI 视图中的频率、偏移量和要保留的快照数相对应。调度表是以 UTC 格式维护的。
clownfish:shares default/builds snapshots> automatic
clownfish:shares default/builds snapshots automatic> create
clownfish:shares default/builds snapshots automatic (uncommitted)> set frequency=day
frequency = day (uncommitted)
clownfish:shares default/builds snapshots automatic (uncommitted)> set hour=14
hour = 14 (uncommitted)
clownfish:shares default/builds snapshots automatic (uncommitted)> set minute=30
minute = 30 (uncommitted)
clownfish:shares default/builds snapshots automatic (uncommitted)> set keep=7
keep = 7 (uncommitted)
clownfish:shares default/builds snapshots automatic (uncommitted)> get
frequency = day (uncommitted)
day = (unset)
hour = 14 (uncommitted)
minute = 30 (uncommitted)
keep = 7 (uncommitted)
clownfish:shares default/builds snapshots automatic (uncommitted)> commit
clownfish:shares default/builds snapshots automatic> list
NAME FREQUENCY DAY HH:MM KEEP
automatic-000 day - 14:30 7
clownfish:shares default/builds snapshots automatic> done
clownfish:shares default/builds snapshots>
使用 CLI 设置调度的快照标签
在 BUI 中,可以对项目或共享资源设置 "scheduled snapshot label"(调度的快照标签)属性。同样,在 CLI 中,可以通过首先导航到项目上下文或共享资源上下文来设置标签。要创建调度的快照标签,请使用 set snaplabel 命令:
clownfish:shares project1/share1> set snaplabel=project1:share1