[solved] change data partition to zfs while preserving ext4 setup of proxmox installation

Elleni

Active Member
Jul 6, 2020
188
11
38
51
I would like to change my data partition from cryptsetup_luks on a mirrored device to a zpool, and need some advice. The install shall stay on the mirrored ext4 filesystem. First I thought, easy - fail one partition of the mirror, create a pool, copy the data to the new dataset on the new pool, and finally add the second disk to the pool, done.

But I then realized that / is on that md0 raid1 too, containing sda2 and sdb2. As it is a hosted server and I must not reinstall it I'd like to know if it is possible to create a small raid1 for md0p1 so I get the empty space of md0p3 of both disks to create a zfs pool on it while system remains on the mirrored raid ext4 mirror without reinstallation.

Code:
Disk: /dev/md0
                     Size: 1.8 TiB, 1974435053568 bytes, 3856318464 sectors
                               Label: dos, identifier: 0x53da13f1

    Device         Boot         Start          End      Sectors    Size  Id Type
>>  /dev/md0p1                   2048     58593279     58591232     28G  83 Linux              
    /dev/md0p2               58595326    125595647     67000322     32G   5 Extended
    └─/dev/md0p5             58595328    125595647     67000320     32G  82 Linux swap / Solaris
    /dev/md0p3              125595648   3856318463   3730722816    1.8T  83 Linux
Code:
Disk: /dev/sda
                     Size: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
                               Label: dos, identifier: 0x48189c2b

    Device       Boot          Start          End      Sectors    Size  Id Type
>>  /dev/sda1    *              2048       194559       192512     94M  83 Linux                
    /dev/sda2                 194560   3856777215   3856582656    1.8T  fd Linux raid autodetect
    /dev/sda3             3856777216   3907028991     50251776     24G  82 Linux swap / Solaris

Is that possible without reinstalling somehow?
 
Last edited:
You could just use /dev/md0p3 as the backend of a zpool, but running ZFS on top of another raid will technically work, but you will not have all the features ZFS is known for (e.g. silent data corruption).
 
Yeah, I thought about that too, thus would like to free the space without re-installing to create a mirrored pool. Is that possible without reinstall? Is it possible to fail sda2 or sdb2 to create a zpool, copy over the vzdumps, and finally somehow delete md0p3 and shrink the raid1 or recreate it without dataloss to free the space for a zfs mirror and without the need to reinstall?
 
Last edited:
As one disk of the mdadm mirror was defective and re-assemble the raid resulted in data corruption,I re-installed and restored the vms from vzdumps, so the problem was solved by creating a small mirrored root pool (32 GB) and an additional mirrored datapool for data.