{"id":869,"date":"2011-11-18T11:17:30","date_gmt":"2011-11-18T08:17:30","guid":{"rendered":"http:\/\/www.unixpin.com\/wordpress\/?p=869"},"modified":"2011-11-18T11:20:04","modified_gmt":"2011-11-18T08:20:04","slug":"%d0%bf%d0%b5%d1%80%d0%b5%d0%b4%d0%b0%d1%87%d0%b0-%d1%81%d0%bd%d0%b0%d0%bf%d1%88%d0%be%d1%82%d0%b0-zfs-%d0%bf%d0%be-%d1%81%d0%b5%d1%82%d0%b8","status":"publish","type":"post","link":"https:\/\/www.unixpin.com\/?p=869","title":{"rendered":"\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u0430 ZFS \u043f\u043e \u0441\u0435\u0442\u0438"},"content":{"rendered":"<p>\u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e<br \/>\n\u0441\u043d\u0438\u043c\u043a\u0430 ZFS \u043f\u043e \u0441\u0435\u0442\u0438. \u0412 \u0443\u0447\u0435\u0431\u043d\u044b\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u0445 \u0438 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e<br \/>\n\u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u043e \u0441\u0435\u0442\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b send\\recv \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 ssh<br \/>\n\u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0439\u043f. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0436\u0435 \u044d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u043c<br \/>\n\u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u043e\u0432. \u041b\u0438\u0447\u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0443\u043f\u0435\u0440\u043b\u0430\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 8 MB\/sec<br \/>\n\u043f\u043e \u0433\u0438\u0433\u0430\u0431\u0438\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0437\u0430 12 \u0447\u0430\u0441\u043e\u0432 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c 300<br \/>\n\u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442 \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>\n\u0427\u0442\u043e \u0436\u0435 \u0434\u0435\u043b\u0430\u0442\u044c?<\/p>\n<p><!--more--><\/p>\n<p><a name=\"more\"><\/a>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f<br \/>\n\u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0430 \u043e\u0431\u0435\u0438\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 <a href=\"http:\/\/www.maier-komor.de\/mbuffer.html\">mbuffer<\/a>. \u041e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430<br \/>\nssh \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438.<br \/>\n\u0414\u0435\u043b\u0430\u0435\u043c \u0441\u043d\u0430\u043f\u0448\u043e\u0442:<br \/>\n# zfs snapshot<br \/>\ntank\/tones@$(date +%y%m%d%H%M)<br \/>\n\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430<br \/>\n\u0434\u0430\u043d\u043d\u044b\u0445<br \/>\n#\u00a0 \/usr\/local\/bin\/mbuffer -s 128k -m 1G -I 9090 | zfs receive<br \/>\nzshare\/test<br \/>\n\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0441\u043d\u0438\u043c\u043a\u0430 \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0435<br \/>\n# zfs send<br \/>\ntank\/tones@1105101812 | \/usr\/local\/bin\/mbuffer -s 128k -m 1G -O<br \/>\n10.99.88.55:9090<br \/>\n\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u0432 \u043c\u0430\u043d\u0430\u0445 \u043a mbuffer &#8212; \u0442\u0430\u043c<br \/>\n\u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u043e\u043a\u043e\u043b\u043e \u0441\u043e\u0442\u043d\u0438 \u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0440\u0430\u0434\u0443\u0435\u043c\u0441\u044f.<br \/>\n\u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u044b \u0432\u0441\u0435<br \/>\n\u0436\u0435 \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u043d\u0438\u043c\u043e\u043a \u043f\u043e ssh (\u043c\u0430\u043b\u044b\u0439 \u043e\u0431\u044a\u0435\u043c\\\u043d\u0435\u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c), \u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0434\u043e<br \/>\n\u044d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<br \/>\n\u0414\u0435\u043b\u0430\u0435\u043c \u0441\u043d\u0438\u043c\u043e\u043a \u043a\u0430\u043a \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435. \u041d\u0430 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0435 \u0434\u0430\u0435\u043c<br \/>\n\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435<br \/>\n# zfs<br \/>\nallow user create,mount,receive zshare<br \/>\n\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043d\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0435<br \/>\n#<br \/>\nzfs send tank\/tones@1105101812 | ssh -C -b 10.0.64.50 user@10.99.88.55<br \/>\n\/usr\/sbin\/zfs recv zshare\/tones<\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430: \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c 2 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0430\u0445 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e<br \/>\n\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438<br \/>\n\u0438\u043d\u043a\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u0434\u0432\u0443\u0445 \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u043e\u0432.<br \/>\n<a name=\"more\"><\/a><br \/>\n\u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u0431\u044b\u043b \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043d\u0430\u043f\u0448\u043e\u0442 \u043e\u0431\u044a\u0435\u043c\u043e\u043c \u043e\u043a\u043e\u043b\u043e \u0442\u0435\u0440\u0440\u0430\u0431\u0430\u0439\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e mbuffer, \u043a\u0430\u043a \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u00a0\u0432\u044b\u0448\u0435. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0438<br \/>\n\u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u044b rsa-\u043a\u043b\u044e\u0447\u0438. \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u043d\u044f\u043b \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 4 \u0447\u0430\u0441\u0430 \u043f\u043e \u0433\u0438\u0433\u0430\u0431\u0438\u0442\u043d\u043e\u043c\u0443<br \/>\n\u043a\u0430\u043d\u0430\u043b\u0443.<br \/>\n\u0414\u0430\u043b\u044c\u0448\u0435 \u0432 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<div>\n<div>\n<div>\n<div>\n<div><code>#!\/usr\/bin\/bash <\/code><\/div>\n<div><code>#=== Options ============== <\/code><\/div>\n<div><code>zfs_pool=zshare <\/code><\/div>\n<div><code>zfs_dataset=dataset <\/code><\/div>\n<div><code>lockfile=<\/code><code>\"\/var\/run\/zfs_operation.lock\"<\/code><\/div>\n<div><code>zsnapname=auto_$(<\/code><code>date<\/code> <code>+%y%m%d%H%M) <\/code><\/div>\n<div><code>mail_recipients=<\/code><code>\"admin@tele2.com\"<\/code><\/div>\n<div><code>RHOST=192.168.0.1 <\/code><\/div>\n<div><code>RUSER=snapuser <\/code><\/div>\n<div><code>#========================== <\/code><\/div>\n<div><code>function<\/code> <code>check_result { <\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>last_comm_res=$? <\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>if<\/code> <code>[[ <\/code><code>\"${last_comm_res}\"<\/code> <code>-<\/code><code>ne<\/code> <code>0 ]] <\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>then<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>echo<\/code> <code>\"Script: an error occurred\"<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>cat<\/code> <code>\/var\/log\/tones_backup<\/code><code>.log|mailx -s <\/code><code>\"${HOSTNAME}:Pool backup error\"<\/code> <code>${mail_recipients} <\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>exit<\/code> <code>${last_comm_res} <\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>fi<\/code><\/div>\n<div><code>} <\/code><\/div>\n<div><code>if<\/code> <code>[ -f ${lockfile} ] <\/code><\/div>\n<div><code>then<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>echo<\/code> <code>\"Previous runjob does not complitted successfully\"<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>exit<\/code> <code>1 <\/code><\/div>\n<div><code>fi<\/code><\/div>\n<div><code>touch<\/code> <code>${lockfile} <\/code><\/div>\n<div><code>if<\/code> <code>[[ ! -z $(<\/code><code>ps<\/code> <code>-ef|<\/code><code>grep<\/code> <code>zfs|<\/code><code>grep<\/code> <code>send|<\/code><code>grep<\/code> <code>${zfs_pool}) ]] <\/code><\/div>\n<div><code>then<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>echo<\/code> <code>\"Sending data from pool ${zfs_pool} detected! Try again later!\"<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>exit<\/code> <code>1 <\/code><\/div>\n<div><code>fi<\/code><\/div>\n<div><code>rlast_snapshot=$(<\/code><code>ssh<\/code> <code>${RUSER}@${RHOST} <\/code><code>\"\/usr\/sbin\/zfs list -o name -r ${zfs_pool}\/${zfs_dataset}|tail -1\"<\/code><code>|<\/code><code>awk<\/code> <code>-F@ <\/code><code>'{print $2}'<\/code><code>) <\/code><\/div>\n<div><code>zfs list -o name ${zfs_pool}\/${zfs_dataset}@${rlast_snapshot} ; check_result <\/code><\/div>\n<div><code>zfs snapshot ${zfs_pool}\/${zfs_dataset}@${zsnapname} ; check_result <\/code><\/div>\n<div><code>zfs send -i ${zfs_pool}\/${zfs_dataset}@${rlast_snapshot} ${zfs_pool}\/${zfs_dataset}@${zsnapname} | <\/code><code>ssh<\/code> <code>${RUSER}@${RHOST} <\/code><code>\"\/usr\/sbin\/zfs recv -F ${zfs_pool}\/${zfs_dataset}\"<\/code><\/div>\n<div><code>check_result <\/code><\/div>\n<div><code>rm<\/code> <code>${lockfile}<\/code><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0427\u0430\u0441\u0442\u043e\u0442\u0443 \u0432\u044b\u0437\u043e\u0432\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0444\u0430\u043a\u0442\u043e\u0440\u043e\u0432:<\/p>\n<ul>\n<li>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u043e\u0441\u0442\u0430 \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u043e\u0432<\/li>\n<li>\u0428\u0438\u0440\u0438\u043d\u0430 \u043a\u0430\u043d\u0430\u043b\u0430 \u043c\u0435\u0436\u0434\u0443 \u0445\u043e\u0441\u0442\u0430\u043c\u0438<\/li>\n<li>\u041d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u0443\u043b\u0435<\/li>\n<\/ul>\n<p>\u041e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e: \u0434\u0432\u0443\u0445\u0433\u0438\u0433\u043e\u0431\u0430\u0439\u0442\u043d\u044b\u0439 \u0438\u043d\u043a\u0440\u0438\u043c\u0435\u043d\u0442<br \/>\n\u0443 \u043c\u0435\u043d\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0437\u0430 12 \u043c\u0438\u043d\u0443\u0442 \u043f\u043e \u0433\u0438\u0433\u0430\u0431\u0438\u0442\u043d\u043e\u043c\u0443 \u043a\u0430\u043d\u0430\u043b\u0443. \u041f\u0440\u0438\u0447\u0435\u043c \u0443\u0437\u043a\u0438\u043c \u043c\u0435\u0441\u0442\u043e\u043c<br \/>\n\u0431\u044b\u043b\u0430 \u043d\u0435 \u0441\u0435\u0442\u044c. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u043d\u043a\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0432 \u0441\u0430\u043c\u043e\u043c zfs,<br \/>\n\u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043d\u0435 \u043a\u043e\u043f\u0430\u043b.<br \/>\n\u0422\u0430\u043a \u0436\u0435 \u043d\u0430 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u0434\u0447\u0438\u0449\u044f\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u044b,<br \/>\n\u0447\u0442\u043e\u0431\u044b \u0438\u0445 \u0447\u0438\u0441\u043b\u043e \u043d\u0435 \u0440\u043e\u0441\u043b\u043e \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0447\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u0438\u0441\u0447\u0435\u0440\u043f\u0430\u043d\u0438\u044e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445<br \/>\n\u0431\u043b\u043e\u043a\u043e\u0432. \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u043d\u0438\u043c\u043e\u043a, \u0447\u0442\u043e\u0431\u044b<br \/>\n\u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043a\u0430\u0442\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u043a\u0440\u0438\u043c\u0435\u043d\u0442.<\/p>\n<div>\n<div><code>#!\/usr\/bin\/bash <\/code><\/div>\n<div><code>#=== Options ============== <\/code><\/div>\n<div><code>zfs_pool=zshare <\/code><\/div>\n<div><code>zfs_dataset=dataset\u00a0 <\/code><\/div>\n<div><code>#========================= <\/code><\/div>\n<div><code>nsnap=$(zfs list -o name -r ${zfs_pool}\/${zfs_dataset}|<\/code><code>egrep<\/code> <code>\"@auto_1[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\"<\/code><code>|<\/code><code>wc<\/code> <code>-l) <\/code><\/div>\n<div><code>if<\/code> <code>[[ ${nsnap} -gt 3 ]] <\/code><\/div>\n<div><code>then<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>let<\/code> <code>\"nsnap_destroy = $nsnap - 2\"<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>snap_destroy_list=$(zfs list -o name -r ${zfs_pool}\/${zfs_dataset}|<\/code><code>egrep<\/code> <code>\"@auto_[0-9]10\"<\/code><code>|<\/code><code>head<\/code> <code>-n ${nsnap_destroy}) <\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>for<\/code> <code>dsnap <\/code><code>in<\/code> <code>${snap_destroy_list} <\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>do<\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>zfs destroy ${dsnap} <\/code><\/div>\n<div><code>\u00a0\u00a0\u00a0\u00a0\u00a0 <\/code><code>done<\/code><\/div>\n<div><code>fi<\/code><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0441\u043d\u0438\u043c\u043a\u0430 ZFS \u043f\u043e \u0441\u0435\u0442\u0438. \u0412 \u0443\u0447\u0435\u0431\u043d\u044b\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u0445 \u0438 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u043e \u0441\u0435\u0442\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b send\\recv \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 ssh \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0439\u043f. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0436\u0435 \u044d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u043c \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u043e\u0432. \u041b\u0438\u0447\u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0443\u043f\u0435\u0440\u043b\u0430\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 [&hellip;]<\/p>\n","protected":false},"author":2543,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,899],"tags":[],"class_list":["post-869","post","type-post","status-publish","format-standard","hentry","category-shell","category-unix-solaris-zfs"],"_links":{"self":[{"href":"https:\/\/www.unixpin.com\/index.php?rest_route=\/wp\/v2\/posts\/869","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.unixpin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.unixpin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.unixpin.com\/index.php?rest_route=\/wp\/v2\/users\/2543"}],"replies":[{"embeddable":true,"href":"https:\/\/www.unixpin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=869"}],"version-history":[{"count":5,"href":"https:\/\/www.unixpin.com\/index.php?rest_route=\/wp\/v2\/posts\/869\/revisions"}],"predecessor-version":[{"id":874,"href":"https:\/\/www.unixpin.com\/index.php?rest_route=\/wp\/v2\/posts\/869\/revisions\/874"}],"wp:attachment":[{"href":"https:\/\/www.unixpin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.unixpin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.unixpin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}