ZFS how to virt-edit a image?

harmonyp

Member
Nov 26, 2020
196
4
23
46
When I want to edit a file inside a virtual machine image normally I would do

Code:
export EDITOR=nano
virt-edit -a /var/lib/vz/images/104/vm-104-disk-0.raw /etc/cloud/cloud.cfg

What is the equivalent of doing this on a ZFS pool? I am unable to located the ZFS files

zfs list
Code:
NAME                    USED  AVAIL     REFER  MOUNTPOINT
zfs                    78.8G  6.67T       96K  /zfs
zfs/base-7000-disk-0   15.6G  6.67T     15.6G  -
zfs/base-7001-disk-0   21.7G  6.67T     21.7G  -
zfs/base-7002-disk-0   16.0G  6.67T     16.0G  -
zfs/base-7003-disk-0   1.14G  6.67T     1.14G  -
zfs/base-7004-disk-0   1.50G  6.67T     1.50G  -
zfs/base-7005-disk-0   1.84G  6.67T     1.84G  -
zfs/base-7006-disk-0    651M  6.67T      651M  -
zfs/base-7007-disk-0   1018M  6.67T     1018M  -
zfs/base-7008-disk-0   1.02G  6.67T     1.02G  -
zfs/base-7009-disk-0    822M  6.67T      822M  -
zfs/base-7010-disk-0   1.16G  6.67T     1.16G  -
zfs/base-7011-disk-0   12.0G  6.67T     12.0G  -
zfs/vm-100-cloudinit     56K  6.67T       56K  -
zfs/vm-100-disk-0      1.14G  6.67T     1.14G  -
zfs/vm-101-cloudinit     56K  6.67T       56K  -
zfs/vm-101-disk-0      1.50G  6.67T     1.50G  -
zfs/vm-102-cloudinit     56K  6.67T       56K  -
zfs/vm-102-disk-0      1.84G  6.67T     1.84G  -
zfs/vm-7003-cloudinit    56K  6.67T       56K  -
zfs/vm-7004-cloudinit    56K  6.67T       56K  -
zfs/vm-7005-cloudinit    56K  6.67T       56K  -
zfs/vm-7006-cloudinit    56K  6.67T       56K  -
zfs/vm-7007-cloudinit    56K  6.67T       56K  -
zfs/vm-7008-cloudinit    56K  6.67T       56K  -
zfs/vm-7009-cloudinit    56K  6.67T       56K  -
zfs/vm-7010-cloudinit    56K  6.67T       56K  -
 
Shutdown the vm, mount the zfs vdev.

For a VM that uses ext4 internally:
Code:
mkdir -p /mnt/100
mount /dev/zvol/zfs/vm-100-disk-0-part2 /mnt/100
#edit file
nano /mnt/100/path/to/file
umount  /mnt/100
 
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!