balrog Posted October 18, 2020 Share Posted October 18, 2020 (edited) I recently had the problem that I wanted to move all my Docker data (in the appdata folder) over the network to an external NAS. But since Plex and Jellyfin consists of a lot of small files depending on the size of the media library, copying took me two days despite 10 Gbit/s. I would like to show you here how I solved the problem by moving these files to a vDisk and thus the transfer is now much faster. Structure Create thin provisioned vDisk Adjust vDisk-Size Remove vDisk Show size Auto-Mount/-Unmount Backup vDisk Create thin provisioned vDisk 1. Create vDisk (.img) truncate -s 100G /path/vDisk.img (This creates a .img-File with the maximum size of 100 GiB) 2. Create file system mkfs.xfs /path/vDisk.img (possible options can be displayed by typing "mkfs" in the console and pressing Tab twice) 3. Create Mountpoint mkdir /mountpoint/ (in my case the mountpoint is /mnt/disks/vm/appdata/plex) 4. Mount vDisk mount -t auto -o loop /path/vDisk.img /mountpoint/ 5. Adjust permissions chown nobody:users /mountpoint/ (or wathever group or user you use) 6. Move files Now, you can move/copy your files to this mountpoint (vDisk) mv /plex_directory/* /mountpoint/ (keep in mind to change the permissions after moving the files) Adjust vDisk-Size 1. unmount vDisk umount /mountpoint/ (with the option -l you can force the unmount) 2. adjust vDisk size truncate -s 200G /path/vDisk.img (200G is the new size) e2fsck -f /path/vDisk.img && resizefs /path/vDisk.img (allocate the new size to the filesystem) Remove vDisk 1. unmount vDisk umount /mountpoint/ 2. delete vDisk rm /path/vDisk.img Show size Maximum size vDisk du -h --apparent-size /path/vDisk.img Effective disk space used du -h /path/vDisk.img Auto-Mount/-Unmount You can insert this commands into a Userscript for mounting with the start of the Array or unmount with stop of the Array (I use this config for my daily use. I haven't notice any serious performance drawbacks. Just make sure the vDisk is mountet before you start the Docker-Container!) Backup vDisk To backup a vDisk we just copy the .img fith the following command: dd if=srcFile.img of=dstFile.img iflag=direct oflag=direct bs=64K conv=sparse Edited November 24, 2020 by balrog added some infos Quote Link to comment
moonerick Posted August 5, 2023 Share Posted August 5, 2023 On 10/18/2020 at 4:43 PM, balrog said: You can insert this commands into a Userscript for mounting with the start of the Array or unmount with stop of the Array is this command: mount -t auto -o loop /path/vDisk.img /mountpoint/ Quote Link to comment
balrog Posted August 5, 2023 Author Share Posted August 5, 2023 7 hours ago, moonerick said: is this command: mount -t auto -o loop /path/vDisk.img /mountpoint/ This is one of them. Here is an example of a full script (mount and unmount): Mount (0_Mount-vDisks.sh) #!/bin/bash #name=0_Mount-vDisks #backgroundOnly=true # Plex mount -t auto -o loop /mnt/disks/VM/vdisks/PlexMediaServer.img /mnt/disks/VM/appdata/PlexMediaServer/ # VOD mount -t auto -o loop /mnt/disks/VM/vdisks/vod.img /mnt/disks/VM/appdata/vod/ # Media mount -t auto -o loop /mnt/disks/VM/vdisks/media.img /mnt/disks/VM/appdata/media/ Unmount (0_Unmount-vDisks.sh) #!/bin/bash #name=0_Unmount-vDisks #backgroundOnly=true # Plex umount -l /mnt/disks/VM/appdata/PlexMediaServer/ # VOD umount -l /mnt/disks/VM/appdata/vod/ # Media umount -l /mnt/disks/VM/appdata/media/ Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.