ZFS: howto add 'new' HDD & transfer data from old one

PeterZ

Active Member
Jul 18, 2019
38
1
28
54
Hi guys

Fairly new to Proxmox/basic linux knowledge, and a little time ago I've managed to create a zpool (raidz1 raidz0) with a HDD (testdisk, 1TB) to be fully used as storage for a container and to be shared on the network.
System, LXC's and VM's are on a SSD (rpool)
To get this working it took me quite some research but in the end, it was running fine.
Now I want to replace the HDD by a 3TB but also move the data.

At first, I connected the new HDD to sdb (port on which old HDD was connected) and apparently it was usable right away, even though it was still formatted in NTFS.
Then I connected the old HDD to sdc but to avoid doing something wrong, I disconnected it again.
'lsblk -fs' gives
Code:
sda1
└─sda
sda2   vfat                       91CE-F1AB
└─sda
sda3   zfs_member rpool           11758637867308030279
└─sda
sdb1   zfs_member myzpool         17852838782547185312
└─sdb
sdb9
└─sdb
zd0p1  ntfs       System Reserved 6A46F48B46F45971
└─zd0
zd0p2  ntfs       HardDisk        2ADAF838DAF7FDBF
└─zd0
zd16p1 vfat       EFISYS          BD41-11EE
└─zd16
zd16p2
└─zd16
zd16p3 ufs        OPNsense        5e7ff4ad9e3830b6
└─zd16

I'm a little puzzled on how to handle this, mainly because of the zpool.
Can anyone give me some pointers please?
New HDD, although currently has data and formatted in NTFS can be wiped, should replace the testdisk in the end and the data transferred to it.

Big thank you in advance!
Peter
 
Last edited:
Fist up, you can't create a raidz1 with only one disk - you need at least 3 disks for a raidz1 (eq. to a raid5) zpool. So what I am seeing is a single disk rpool and presumably you also had a single disk zpool for your container. Obviously, you don't care much about the safety of your data, but maybe you do have a proper backup schedule in place.

The easiest thing to do, would be to connect the new drive to the system and then have your pve host create a new zpool on the drive. Then you can go to Datacenter/Storage and add the new storage to the system and migrate you data using the GUI. Anything else, I'd considered error-prone and probably dangerous to your existing data, due to the lack of knowledge on your part about the innards of ZFS and Proxmox (no offense meant, but better to play it safe here).
 
Hi budy, thank you for picking this up and don't worry: no offense taken. ;-)

Of course I meant raidz0 instead of raidz1..
Yes, it is a single disk zpool shared with samba from a container.

As you can see from the lsblk -fs output, somehow even disconnected, the new drive seems to remain listed...
Is this because of wrongly adding the drive to the existing pool?
 
Fist up, you can't create a raidz1 with only one disk - you need at least 3 disks for a raidz1 (eq. to a raid5) zpool.

That would also have been my response, but actually you can:

Code:
root@host ~ > zpool create zpool raidz1 /dev/sda /dev/sdb
root@host ~ > zpool status zpool
  pool: zpool
 state: ONLINE
  scan: none requested
config:

    NAME        STATE     READ WRITE CKSUM
    zpool       ONLINE       0     0     0
      raidz1-0  ONLINE       0     0     0
        sda     ONLINE       0     0     0
        sdb     ONLINE       0     0     0

errors: No known data errors

root@host ~ > zpool list
NAME    SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
zpool  1,98T   222K  1,98T         -     0%     0%  1.00x  ONLINE  -

root@host ~ > zfs list zpool
NAME    USED  AVAIL  REFER  MOUNTPOINT
zpool  85,5K   984G    24K  /zpool

It does not make any sense, but you could do it.

Can anyone give me some pointers please?

Easiest way to do it would be to convert your one-disk-pool to a mirrored pool by attaching a disk to the vdev, resilver and detach the old and smaller disk. This is the fastest way to migrate your data to a new disk. It's easier said than done, the hard part is the boot partition, you have to mirror too. If it would only be a ZFS problem, it would be solved by then.
 
Hi budy, thank you for picking this up and don't worry: no offense taken. ;-)

Of course I meant raidz0 instead of raidz1..
Yes, it is a single disk zpool shared with samba from a container.

As you can see from the lsblk -fs output, somehow even disconnected, the new drive seems to remain listed...
Is this because of wrongly adding the drive to the existing pool?

Well… there's no thing like a raidz0 in ZFS. Hopefully, you don't mean a simple striped (aka raid0) zpool, which multiple disks and no redundancy at all.
Please issue a zpool status and paste it's output. You can, "upgrade" a non-redudant zpool to a mirrored zpool and then even upgrade it further to increase it's capacity. But man… a non-redundant zpool on a 24/7 gear, makes me shiver instantly.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!