{"id":237,"date":"2011-02-01T16:24:08","date_gmt":"2011-02-01T15:24:08","guid":{"rendered":""},"modified":"2011-02-01T16:24:08","modified_gmt":"2011-02-01T14:24:08","slug":"usuwanie-starych-i-tworzenie-nowych-snapshotow-zfs","status":"publish","type":"post","link":"https:\/\/drfugazi.eu.org\/en\/usuwanie-starych-i-tworzenie-nowych-snapshotow-zfs\/","title":{"rendered":"Usuwanie starych i tworzenie nowych snapshot\u00f3w ZFS"},"content":{"rendered":"<p>Niedawno pisa\u0142em o <a href=\"\/pl\/jednowierszowce\/masowe-snapshoty-zfs\">masowym tworzeniu snapshot\u00f3w ZFS<\/a>. Tam robi\u0142em to rekursywnie dla ca\u0142ej puli u\u017cywaj\u0105c <code>zpool list -H<\/code> i przekierowuj\u0105c wyj\u015bcie do <code>zfs snapshot -r<\/code>. Tym razem zrobimy to inaczej.<\/p>\n<p>Je\u015bli mamy stare snapshoty to mo\u017cemy je wy\u015bwietli\u0107 poleceniem:<\/p>\n<pre><code>\r\n# zfs list -t snapshot\r\nNAME                                   USED  AVAIL  REFER  MOUNTPOINT\r\ndappserv@20101130                         0      -  28.0K  -\r\ndappserv@20110107                         0      -  28.0K  -\r\ndappserv\/etc@20101130                 61.3K      -   382K  -\r\ndappserv\/etc@20110107                     0      -   382K  -\r\ndappserv\/var@20101130                  170M      -  2.03G  -\r\ndappserv\/var@20110107                 1.07M      -  2.15G  -\r\n...\r\n<\/code><\/pre>\n<p><!--break--><\/p>\n<p>Opcja <code>-t snapshot<\/code> powoduje wylistowanie samych snapshot\u00f3w, wi\u0119c w pewien spos\u00f3b zabezpiecza nas przed zrobieniem sobie krzywdy i usuni\u0119ciem \u017cywego systemu plik\u00f3w. Na pocz\u0105tek polecam usuwanie snapshot\u00f3w w\u0142a\u015bnie w ten spos\u00f3b. Usun\u0119 teraz snapshoty z 2010 wykorzystuj\u0105c grepa do przefiltrowania:<\/p>\n<pre><code>\r\n# for a in `zfs list -t snapshot -H -o name|grep 2010`; do zfs destroy $a; done\r\n<\/code><\/pre>\n<p>No ale to nam tylko zniszczy stare snapshoty, a nie utworzy nowych. Poza tym mia\u0142 by\u0107 przecie\u017c jednowierszowiec. Do tego lepiej by by\u0142o najpierw utworzy\u0107 nowe, a dopiero p\u00f3\u017aniej usun\u0105\u0107 stare. Ale nic straconego, je\u015bli snapshoty ko\u0144cz\u0105 si\u0119 tak samo, mo\u017cna zrobi\u0107 tak:<\/p>\n<pre><code>\r\nfor a in `zfs list -H -o name -t filesystem`; do\r\n    zfs snapshot $a@20110201 && zfs destroy $a@20110107; \r\ndone\r\n<\/code><\/pre>\n<p>Za\u0142atwione, mo\u017cna sprawdzi\u0107 co z tego wysz\u0142o:<\/p>\n<pre><code>\r\n# zfs list\r\nNAME                                   USED  AVAIL  REFER  MOUNTPOINT\r\ndappserv                              2.16G  95.5G  28.0K  none\r\ndappserv@20110201                         0      -  28.0K  -\r\ndappserv\/etc                           382K  95.5G   382K  \/data\/etc\/appserv\r\ndappserv\/etc@20110201                     0      -   382K  -\r\ndappserv\/var                          2.16G  95.5G  2.16G  \/data\/var\/appserv\r\ndappserv\/var@20110201                     0      -  2.16G  -\r\n<\/code><\/pre>\n<p>Przy okazji: je\u015bli Wasz system startuje z ZFS, to pewnie zwr\u00f3cicie uwag\u0119 na to, \u017ce nie zosta\u0142y utworzone snapshoty <code>zfsroot\/swap<\/code> i <code>zfsroot\/dump<\/code>, to dlatego, \u017ce wybrali\u015bmy tylko filesystemy (<code>-t filesystem<\/code>), a swap i dump to wolumeny (volume). Ale po co komu snapshot swapa?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Niedawno pisa\u0142em o <a href=\"\/pl\/jednowierszowce\/masowe-snapshoty-zfs\">masowym tworzeniu snapshot\u00f3w ZFS<\/a>. Tam robi\u0142em to rekursywnie dla ca\u0142ej puli u\u017cywaj\u0105c <code>zpool list -H<\/code> i przekierowuj\u0105c wyj\u015bcie do <code>zfs snapshot -r<\/code>. Tym razem zrobimy to inaczej.<\/p>\n<p>Je\u015bli mamy stare snapshoty to mo\u017cemy je wy\u015bwietli\u0107 poleceniem:<\/p>\n<pre><code>\r\n# zfs list -t snapshot\r\nNAME                                   USED  AVAIL  REFER  MOUNTPOINT\r\ndappserv@20101130                         0      -  28.0K  -\r\ndappserv@20110107                         0      -  28.0K  -\r\ndappserv\/etc@20101130                 61.3K      -   382K  -\r\ndappserv\/etc@20110107                     0      -   382K  -\r\ndappserv\/var@20101130                  170M      -  2.03G  -\r\ndappserv\/var@20110107                 1.07M      -  2.15G  -\r\n...\r\n<\/code><\/pre>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[],"tags":[9,32],"jetpack_publicize_connections":[],"acf":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7M9Tz-3P","jetpack-related-posts":[{"id":213,"url":"https:\/\/drfugazi.eu.org\/en\/jak-zamienic-w-kontenerze-dataset-na-lofs\/","url_meta":{"origin":237,"position":0},"title":"Jak zamieni\u0107 w kontenerze dataset na lofs","author":"drfugazi","date":"Tuesday August 17th, 2010","format":false,"excerpt":"Poniewa\u017c konfiguruj\u0119 system pocztowy, potrzebuj\u0119 wyeksportowa\u0107 filesystem ZFS przez NFS do innego noda, gdzie postfix poprzez delivera b\u0119dzie zapisywa\u0142 wiadomo\u015bci do skrzynek. Jak wida\u0107 w tym zapisie sesji, skonfigurowa\u0142em ca\u0142\u0105 zpoole \"studmail\" jako dataset ZFS dla kontenera st1. Niestety w prosty spos\u00f3b nie da si\u0119 wsp\u00f3\u0142dzieli\u0107 systemu plik\u00f3w ZFS przez\u2026","rel":"","context":"In \"Kontenery\"","block_context":{"text":"Kontenery","link":"https:\/\/drfugazi.eu.org\/en\/tag\/kontenery\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":212,"url":"https:\/\/drfugazi.eu.org\/en\/how-remove-dataset-solaris-zone-and-mount-it-lofs\/","url_meta":{"origin":237,"position":1},"title":"How to remove dataset from Solaris zone and mount it as lofs","author":"drfugazi","date":"Tuesday August 17th, 2010","format":false,"excerpt":"Because of building mail system I need to export ZFS filesystem via NFS to other node, where postfix with deliver will save messages to mail boxes. As you can see in this installation transcript I configured whole zpool \"studmail\" as ZFS dataset for zone st1. Unfortunatelly, you can not simply\u2026","rel":"","context":"In \"Solaris\"","block_context":{"text":"Solaris","link":"https:\/\/drfugazi.eu.org\/en\/tag\/solaris\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":200,"url":"https:\/\/drfugazi.eu.org\/en\/0401-instalacja-kontenera-st1\/","url_meta":{"origin":237,"position":2},"title":"04.01 Instalacja kontenera st1","author":"drfugazi","date":"Thursday August 12th, 2010","format":false,"excerpt":"Tworzenie kontenera o nazwie st1, bez kontroli zasob\u00f3w, z dziedziczonymi katalogami standardowymi i dodatkowo z dziedziczonym \/usr\/local (w trybie tylko do odczytu). Skonfigurowane dwie karty sieciowe: qfe4 i qfe5 w trybie wsp\u00f3\u0142dzielonym oraz dodana pula ZFS (zpool) o nazwie studmail.","rel":"","context":"In \"Kontenery\"","block_context":{"text":"Kontenery","link":"https:\/\/drfugazi.eu.org\/en\/tag\/kontenery\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":202,"url":"https:\/\/drfugazi.eu.org\/en\/0401-installation-container-st1\/","url_meta":{"origin":237,"position":3},"title":"04.01 Installation of container st1","author":"drfugazi","date":"Thursday August 12th, 2010","format":false,"excerpt":"Creation of container named st1, without resource control, with inherited standard directories and additionally inherited \/usr\/local dir (read only mode). Configured two network Quad Fast Ethernet cards: qfe4 and qfe5 in shared mode. Added ZFS pool (zpool) named studmail.","rel":"","context":"In \"Solaris\"","block_context":{"text":"Solaris","link":"https:\/\/drfugazi.eu.org\/en\/tag\/solaris\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":692,"url":"https:\/\/drfugazi.eu.org\/en\/solaris-ldap-autofs-client-configuration\/","url_meta":{"origin":237,"position":4},"title":"Solaris LDAP autofs client configuration","author":"drfugazi","date":"Thursday December 15th, 2016","format":false,"excerpt":"Last time I wrote about autofs configuration on LDAP server, now it is time to configure autofs client in Solaris. I assume that in DUAConfigProfile, objectClasses and attributes are already defined. You can check this with simply commands: If you have similar output, you can proceed with configuration in system\u2026","rel":"","context":"In &quot;LDAP&quot;","block_context":{"text":"LDAP","link":"https:\/\/drfugazi.eu.org\/en\/category\/ldap\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/drfugazi.eu.org\/wp-content\/uploads\/2016\/02\/Solaris_OS_logo.png?fit=800%2C393&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/drfugazi.eu.org\/wp-content\/uploads\/2016\/02\/Solaris_OS_logo.png?fit=800%2C393&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/drfugazi.eu.org\/wp-content\/uploads\/2016\/02\/Solaris_OS_logo.png?fit=800%2C393&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/drfugazi.eu.org\/wp-content\/uploads\/2016\/02\/Solaris_OS_logo.png?fit=800%2C393&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":217,"url":"https:\/\/drfugazi.eu.org\/en\/dovecot-20-sieve-020\/","url_meta":{"origin":237,"position":5},"title":"dovecot-2.0-sieve-0.2.0","author":"drfugazi","date":"Wednesday September 22nd, 2010","format":false,"excerpt":"Interpreter Pigeonhole Sieve Projekt Pigeonhole dostarcza Sieve jako plugina dla Dovecotowego agenta dostarczania poczty (LDA) jak r\u00f3wnie\u017c us\u0142ugi LMTP. Plugin implementuje interpreter j\u0119zyka Sieve, kt\u00f3ry pozwala na filtrowanie przychodz\u0105cych wiadomo\u015bci u\u017cywaj\u0105c skrypt\u00f3w zgodnych ze specyfikacj\u0105 j\u0119zyka Sieve (RFC 5228). Skrypty Sieve mog\u0105 by\u0107 modyfikowane przez u\u017cytkownik\u00f3w i dzi\u0119ki temu u\u017cytkownik\u2026","rel":"","context":"In \"Dovecot\"","block_context":{"text":"Dovecot","link":"https:\/\/drfugazi.eu.org\/en\/tag\/dovecot\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/posts\/237"}],"collection":[{"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/comments?post=237"}],"version-history":[{"count":0,"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/posts\/237\/revisions"}],"wp:attachment":[{"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/media?parent=237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/categories?post=237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/drfugazi.eu.org\/en\/wp-json\/wp\/v2\/tags?post=237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}