What is in a Longhorn volume?

Normally if i create a volume for a container by using docker-compose, i can mount that volume or an existing one with the volumes that the container needed.
After creation i can access that volume on for instance my Synology NAS.

If i create an Persistent Volume with Longhorn i can’t access the volume.
Lets say i have a pod that have 3 volumes. 1 for config, 1 for tmp and 1 for output.
I want to look for a file in the output folder (volume). How can i access that folder in a Longhorn PVC situation?

Longhorn is block storage. All that exists on the underlying physical disk is a single file which represents the virtual disk’s blocks . You cannot (easily) access the contents of a filesystem which may be contained on that virtual disk.

Good to know. That mean that i will not use Longhorn in cases where i want access to the volume.

You can access the volume by:

  1. exec into the pod and ls the mount point of the volume
  2. Or if the pod is not running, the volume is detached. You can manually attach the volume to a node. This create a block device `/dev/longhorn/ on the node. Mount the block device somewhere on the node and access the data.

Thanks!

Option 2 sounds interesting. Can you explain a little bit more how to do that?
I have a storage node called long1
and i have 3 worker nodes called work-1, 2 and 3
Do you mean that i log in on let say work-1 and from their i type sudo mount -t … followed with the IP address of let say long1 followed by :/dev/longhorn/ then the persistent volume?

Assume that the volume is in the detached state (no workload pod is using the volume), you can:

  1. Go to Longhorn UI, attach the volume to node-1
  2. SSH into node-1. Run ls -l /dev/longhorn. You will see the block device with the name VOLUME-NAME
  3. Mount the block device to a directory on the node-1 by: sudo mount /dev/longhorn/<VOLUME-NAME> /mnt/
  4. Now you can access the data at /mnt. Try ls /mnt
1 Like

Thank you very much for your help.