Mount ZVOL to host/CT

Kiyo

Member
Jul 28, 2020
14
1
8
23
Hiya,

I'm attempting to migrate one of my VMs to an LXC container,

The VM has a ~8TB ZVOL disk attached to it, and I want to move all the data on there into the LXC container

I'd like to avoid using SMB/NFS/iSCSI to do it, instead I'd like to mount the ZVOL to the host or the LXC and copy the data directly across.

I've tried using `zfs mount`, I've also tried setting the mountpoint variable, but both return that it's not supported.
Code:
root@Ritsu:~# zfs mount RAID1/encrypted/vm-100-disk-0 
cannot open 'RAID1/encrypted/vm-100-disk-0': operation not applicable to datasets of this type
root@Ritsu:~# zfs set mountpoint=/mnt RAID1/encrypted/vm-100-disk-0
cannot set property for 'RAID1/encrypted/vm-100-disk-0': 'mountpoint' does not apply to datasets of this type


Using the built in `mount` command, I get this output
Code:
mount /dev/zvol/RAID1/encrypted/vm-100-disk-0 /mnt -t ext4
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/zd64, missing codepage or helper program, or other error.
 
first - /mnt is probably a bad target , you should use a new, empty directory created for that purpose
second - maybe you have partitions on the zvol and need to mount one of them instead of the zvol itself?
third - a simple solution might be to just use rsync via SSH to copy it across - no complicated setup necessary, just network access between the VM and the CT, and it would even allow incremental transfers ;)
 
Yeah I probs should, /mnt is just my default,

It's just the one partition on there, but you could be right. I'm mounting the disk container rather than the partition maybe,

Any idea how I'd select the partition?


Main reason I want to avoid going via network is both storages are capable of way over Gb transfers :p
 
if it has partitions, they should be visible as block devices as well unless you set volmode to dev on the zvol.
 
Ah that's it! /dev/zvol/RAID1/encrypted/vm-100-disk-0 is a symlink to /dev/zd64, and I can just mount /dev/zd64p1 like a normal disk partition,

You learn somethin new everyday!

Vielen dank für eure Hilfe!
 
  • Like
Reactions: fabian
Ah that's it! /dev/zvol/RAID1/encrypted/vm-100-disk-0 is a symlink to /dev/zd64, and I can just mount /dev/zd64p1 like a normal disk partition,

You learn somethin new everyday!

Vielen dank für eure Hilfe!
In my case, my zvol links to /dev/zd0, but how do I know what partition to use? There are none visible to me
 
You can expose them to your system by running kpartx -a <device> and then you can mount what you want.
Thanks, but doing a
Code:
kpartx -a
on both /dev/zvol/pool/vm-100-disk-0 and on /dev/zd0 outputs nothing. What <device> are you referring to?
 
maybe there are no partitions?
 
Check if there are partitions with:

Code:
fdisk -l /dev/zvol/pool/vm-100-disk-0

The kpartx stuff will show up in /dev/mapper, check also there.
 
Check if there are partitions with:

Code:
fdisk -l /dev/zvol/pool/vm-100-disk-0

The kpartx stuff will show up in /dev/mapper, check also there.
Output of fdisk command:
Disk /dev/zvol/backup/vm-100-disk-0: 3.32 TiB, 3650722201600 bytes, 7130316800 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 8192 bytes I/O size (minimum/optimal): 8192 bytes / 8192 bytes
So there doesnt seem to be any partitions. Which is weird, because I assumed there to be partitions since it's a backup of a VM in a ZFS-pool.
I also checked inside /dev/mapper, and there was one file "control" which was empty.
 
Output of fdisk command:
Disk /dev/zvol/backup/vm-100-disk-0: 3.32 TiB, 3650722201600 bytes, 7130316800 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 8192 bytes I/O size (minimum/optimal): 8192 bytes / 8192 bytes
So there doesnt seem to be any partitions. Which is weird, because I assumed there to be partitions since it's a backup of a VM in a ZFS-pool.
I also checked inside /dev/mapper, and there was one file "control" which was empty.
Just try to mount the file:

Code:
mkdir /mnt/vm-100
mount /dev/zvol/backup/vm-100-disk-0 /mnt/vm-100
 
Just try to mount the file:

Code:
mkdir /mnt/vm-100
mount /dev/zvol/backup/vm-100-disk-0 /mnt/vm-100
I did try this, but get the error:
mount: /mnt/vm-new-test: wrong fs type, bad option, bad superblock on /dev/zd0

I'm a bit confused because I thought vm-100-... was the partition?
 
No, it's the virtual disk. Can you provide the first sector or your disk?

Code:
dd if=/dev/zvol/backup/vm-100-disk-0 bs=512 count=1 | hexdump -C
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 1+0 records in 1+0 records out 512 bytes copied, 0.000225204 s, 2.3 MB/s 00000200
 
This seems very empty. Are you sure you're working with the correct disk?
Good question. Here is a view of my disk tree:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sdb 8:16 0 3.6T 0 disk ├─sdb1 8:17 0 3.6T 0 part └─sdb9 8:25 0 8M 0 part zd0 230:0 0 3.3T 0 disk zram0 254:0 0 3.4G 0 disk [SWAP] nvme0n1 259:0 0 476.9G 0 disk ├─nvme0n1p1 259:1 0 100M 0 part ├─nvme0n1p2 259:2 0 16M 0 part ├─nvme0n1p3 259:3 0 264.7G 0 part ├─nvme0n1p4 259:4 0 195.3G 0 part / ├─nvme0n1p5 259:5 0 476.8M 0 part /boot └─nvme0n1p6 259:6 0 625M 0 part

Ignore the nvme disk btw
I tried running the same dd comand on sdb1 and zd0 but it gave the same sectors as previously provided.
 
Last edited:

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!