{"id":4292,"date":"2022-10-31T14:35:30","date_gmt":"2022-10-31T13:35:30","guid":{"rendered":"https:\/\/rephlex.de\/blog\/?p=4292"},"modified":"2023-10-02T16:07:10","modified_gmt":"2023-10-02T14:07:10","slug":"proxmox-replace-zfs-root-disk","status":"publish","type":"post","link":"https:\/\/rephlex.de\/blog\/2022\/10\/31\/proxmox-replace-zfs-root-disk\/","title":{"rendered":"Proxmox: replace zfs root disk"},"content":{"rendered":"\n<p><div>Depending on how Proxmox VE was installed it is either using systemd-boot or grub through proxmox-boot-tool or plain grub as bootloader. You can check by running:<\/div><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">proxmox-boot-tool status<\/pre>\n\n\n\n<p>The first steps of copying the partition table, randomizing the GUIDs on the new disk, and replacing the ZFS partition are the same.<\/p>\n\n\n\n<p>To make the system bootable from the new disk, different steps are needed which depend on the bootloader in use.<\/p>\n\n\n\n<p>First, I like to offline the failed disk<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">zpool status\nzpool offline rpool \/dev\/source # (=failed disk)\n## shutdown install the new disk or replace the disks<\/pre>\n\n\n\n<p>Now, I pick one of the old disks (&#8222;source&#8220;) and clone its whole disklabel to the new disk (&#8222;target&#8220;):<\/p>\n\n\n\n<pre id=\"block-02ca05e8-6fdc-4c9c-871a-a2ea09a5c3d0\" class=\"wp-block-preformatted\">sgdisk \/dev\/disk\/by-id\/source -R \/dev\/disk\/by-id\/target\nsgdisk --randomize-guids \/dev\/disk\/by-id\/target<\/pre>\n\n\n\n<p>Now, we can insert the new disk into the zfs bunch:<\/p>\n\n\n\n<pre id=\"block-77d26c87-0663-4f77-a94c-5182db95da12\" class=\"wp-block-preformatted\">zpool replace rpool \/dev\/disk\/by-id\/source-part3 \/dev\/disk\/by-id\/target-part3\nzpool status  # =&gt; resilvering is working<\/pre>\n\n\n\n<p>Note Use the zpool status -v command to monitor how far the resilvering process of the new disk has progressed.<\/p>\n\n\n\n<p>Finally, we need to tell proxmox-boot-tool to always keep the bootloader on the new disk updated.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>proxmox-boot-tool format \/dev\/disk\/by-id\/target-part2\nproxmox-boot-tool init \/dev\/disk\/by-id\/target-part2<\/code><\/pre>\n\n\n\n<p>NB: EFI System Partition is setup as partition #2 on bootable disks setup by the Proxmox VE installer since version 5.4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Depending on how Proxmox VE was installed it is either using systemd-boot or grub through proxmox-boot-tool or plain grub as bootloader. You can check by running: proxmox-boot-tool status The first steps of copying the partition table, randomizing the GUIDs on the new disk, and replacing the ZFS partition are the same. To make the system [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4292","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"https:\/\/rephlex.de\/blog\/wp-json\/wp\/v2\/posts\/4292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rephlex.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rephlex.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rephlex.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/rephlex.de\/blog\/wp-json\/wp\/v2\/comments?post=4292"}],"version-history":[{"count":4,"href":"https:\/\/rephlex.de\/blog\/wp-json\/wp\/v2\/posts\/4292\/revisions"}],"predecessor-version":[{"id":4421,"href":"https:\/\/rephlex.de\/blog\/wp-json\/wp\/v2\/posts\/4292\/revisions\/4421"}],"wp:attachment":[{"href":"https:\/\/rephlex.de\/blog\/wp-json\/wp\/v2\/media?parent=4292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rephlex.de\/blog\/wp-json\/wp\/v2\/categories?post=4292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rephlex.de\/blog\/wp-json\/wp\/v2\/tags?post=4292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}