[{"data":1,"prerenderedAt":401},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fmachines\u002Flifecycle":3},{"id":4,"title":5,"body":6,"description":393,"extension":394,"meta":395,"navigation":396,"path":397,"seo":398,"stem":399,"__hash__":400},"docs\u002Fdocs\u002Fmachines\u002Flifecycle.md","Status, rollback and destroy",{"type":7,"value":8,"toc":382},"minimark",[9,13,17,22,55,66,77,81,99,106,156,175,179,197,203,211,224,257,260,266,276,281,287,293,305,309,363,367,378],[10,11,5],"h1",{"id":12},"status-rollback-and-destroy",[14,15,16],"p",{},"Once a machine exists, three verbs cover the rest of its life. Only one of them is read-only, so learn which.",[18,19,21],"h2",{"id":20},"status-whats-there-and-what-drifted","Status: what's there, and what drifted",[23,24,29],"pre",{"className":25,"code":26,"language":27,"meta":28,"style":28},"language-bash shiki shiki-themes github-dark-high-contrast","sg machine status --config node-a.yaml\n","bash","",[30,31,32],"code",{"__ignoreMap":28},[33,34,37,41,45,48,52],"span",{"class":35,"line":36},"line",1,[33,38,40],{"class":39},"s_sBn","sg",[33,42,44],{"class":43},"sTRMh"," machine",[33,46,47],{"class":43}," status",[33,49,51],{"class":50},"sCcAr"," --config",[33,53,54],{"class":43}," node-a.yaml\n",[14,56,57,60,61,65],{},[30,58,59],{},"status"," compares the ledger with the host and reports recorded state, drift and when each change was last applied. It ",[62,63,64],"strong",{},"never repairs"," anything, and a report that shows drift still exits 0. Use it in scripts without fear.",[14,67,68,69,72,73,76],{},"When it shows drift, run ",[30,70,71],{},"sg machine plan"," to see what ",[30,74,75],{},"create"," would do about it, then decide.",[18,78,80],{"id":79},"rollback-undo-the-last-run","Rollback: undo the last run",[23,82,84],{"className":25,"code":83,"language":27,"meta":28,"style":28},"sg machine rollback --config node-a.yaml\n",[30,85,86],{"__ignoreMap":28},[33,87,88,90,92,95,97],{"class":35,"line":36},[33,89,40],{"class":39},[33,91,44],{"class":43},[33,93,94],{"class":43}," rollback",[33,96,51],{"class":50},[33,98,54],{"class":43},[14,100,101,102,105],{},"Rollback undoes the most recent run's changes in reverse order, using what the ledger captured before each change ran. It shows the plan and asks ",[30,103,104],{},"Roll back N changes on node-a? [y\u002FN]",".",[107,108,109,122],"table",{},[110,111,112],"thead",{},[113,114,115,119],"tr",{},[116,117,118],"th",{},"Flag",[116,120,121],{},"Does",[123,124,125,136,146],"tbody",{},[113,126,127,133],{},[128,129,130],"td",{},[30,131,132],{},"--all",[128,134,135],{},"Select every currently applied change, not just the last run's",[113,137,138,143],{},[128,139,140],{},[30,141,142],{},"--force",[128,144,145],{},"Skip changes that are named as irreversible. It never skips a safety or ownership check",[113,147,148,153],{},[128,149,150],{},[30,151,152],{},"--yes",[128,154,155],{},"Approve the shown plan without asking",[14,157,158,159,162,163,166,167,170,171,174],{},"Rollback ",[62,160,161],{},"never"," removes ",[30,164,165],{},"storage.zfs"," or ",[30,168,169],{},"install.lxd",". They hold your instances' data. Only ",[30,172,173],{},"destroy"," takes those away.",[18,176,178],{"id":177},"destroy-take-it-all-back","Destroy: take it all back",[23,180,182],{"className":25,"code":181,"language":27,"meta":28,"style":28},"sg machine destroy --config node-a.yaml\n",[30,183,184],{"__ignoreMap":28},[33,185,186,188,190,193,195],{"class":35,"line":36},[33,187,40],{"class":39},[33,189,44],{"class":43},[33,191,192],{"class":43}," destroy",[33,194,51],{"class":50},[33,196,54],{"class":43},[14,198,199,200,202],{},"Destroy tears down every artifact the ledger says ",[30,201,40],{}," created, in reverse order. The plan spells out the damage before it asks:",[23,204,209],{"className":205,"code":207,"language":208,"meta":28},[206],"language-text","Destroy plan for node-a — teardown in reverse order, sg-owned artifacts only:\n\n  1  install.lxd        undo 3 recorded artifact(s)\n       data loss: instance shop-web-0 and its snapshots will be deleted\n  …\nwarning: destroy deletes sg-owned data, including recorded instances and the pool file.\n","text",[30,210,207],{"__ignoreMap":28},[212,213,215],"note",{"kind":214},"warning",[14,216,217,219,220,223],{},[30,218,173],{}," deletes recorded instances ",[62,221,222],{},"and the ZFS pool file",". Everything inside is gone. There is no undo for destroy.",[107,225,226,234],{},[110,227,228],{},[113,229,230,232],{},[116,231,118],{},[116,233,121],{},[123,235,236,249],{},[113,237,238,243],{},[128,239,240],{},[30,241,242],{},"--with-packages",[128,244,245,246,248],{},"Also remove packages ",[30,247,40],{}," installed. Kept by default, because other software may use them",[113,250,251,255],{},[128,252,253],{},[30,254,152],{},[128,256,155],{},[14,258,259],{},"When it finishes:",[23,261,264],{"className":262,"code":263,"language":208,"meta":28},[206],"run \u003Crun-id> finished: ok. 7 changes reverted.\n",[30,265,263],{"__ignoreMap":28},[14,267,268,271,272,275],{},[30,269,270],{},"verify.isolation"," holds no state, so destroy never selects it. Anything it can't prove it owns is listed as ",[30,273,274],{},"retained"," and left alone. If destroy fails partway, it stops and tells you to investigate before re-running. It never recreates deleted data to try again.",[277,278,280],"h3",{"id":279},"cluster-members-cant-be-destroyed-directly","Cluster members can't be destroyed directly",[14,282,283,284,286],{},"If the machine is a recorded member of a cluster, ",[30,285,173],{}," refuses:",[23,288,291],{"className":289,"code":290,"language":208,"meta":28},[206],"the machine is a member of a registered cluster\n",[30,292,290],{"__ignoreMap":28},[14,294,295,296,299,300,105],{},"Tear the cluster down with ",[30,297,298],{},"sg cluster destroy --with-machines"," instead. See ",[301,302,304],"a",{"href":303},"\u002Fdocs\u002Fmachines\u002Fclusters#taking-a-cluster-apart","Form a cluster",[18,306,308],{"id":307},"what-each-one-keeps","What each one keeps",[107,310,311,324],{},[110,312,313],{},[113,314,315,318,321],{},[116,316,317],{},"Command",[116,319,320],{},"Removes",[116,322,323],{},"Keeps",[123,325,326,342],{},[113,327,328,333,336],{},[128,329,330],{},[30,331,332],{},"sg machine rollback",[128,334,335],{},"The last run's reversible changes",[128,337,338,339,341],{},"ZFS pool, LXD, anything ",[30,340,40],{}," didn't create",[113,343,344,349,355],{},[128,345,346],{},[30,347,348],{},"sg machine destroy",[128,350,351,352,354],{},"Every recorded ",[30,353,40],{}," artifact, including instances and the pool file",[128,356,357,358,360,361,341],{},"Packages (unless ",[30,359,242],{},"), anything ",[30,362,40],{},[18,364,366],{"id":365},"known-gap","Known gap",[14,368,369,371,372,374,375,377],{},[30,370,173],{}," skips a change whose verification failed. So if ",[30,373,169],{}," failed its check, a later destroy won't tear down that half-installed LXD. Clean it up by hand, or run ",[30,376,75],{}," again until it verifies and then destroy.",[379,380,381],"style",{},"html pre.shiki code .s_sBn, html code.shiki .s_sBn{--shiki-default:#FFB757}html pre.shiki code .sTRMh, html code.shiki .sTRMh{--shiki-default:#ADDCFF}html pre.shiki code .sCcAr, html code.shiki .sCcAr{--shiki-default:#91CBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":28,"searchDepth":383,"depth":383,"links":384},2,[385,386,387,391,392],{"id":20,"depth":383,"text":21},{"id":79,"depth":383,"text":80},{"id":177,"depth":383,"text":178,"children":388},[389],{"id":279,"depth":390,"text":280},3,{"id":307,"depth":383,"text":308},{"id":365,"depth":383,"text":366},"Check a machine for drift, undo the last run, or tear down everything sg created, and know exactly what each one keeps.","md",{},true,"\u002Fdocs\u002Fmachines\u002Flifecycle",{"title":5,"description":393},"docs\u002Fmachines\u002Flifecycle","VGE7ZfDZi40sfXDAj9rHWwdECp3CY4GvqyO-5tn1Fvo",1796464240883]