TheArtiszan Posted December 30, 2018 Share Posted December 30, 2018 Hello All, I run a home lab currently that is based on Windows Server 2016. I have found lately that my storage spaces solution that is using tiered storage with an ssd and 3 hdds is really slow. I have tested using unraid so far at home with 2 cache ssds and 3 mechanicals and crystal mark shows much better reads and writes of 1200 vs 300 mbps. For space savings, while watching the 7 gamers 1 cpu video again, Linus (Linus Tech Tips) mentioned about using BTRFS to snapshot and boot off that with changes being kept in the dedicated drive for the machine to save space. I am having trouble finding information on how to do that. Does anyone know where I can find that information or what it is? Quote Link to comment
JorgeB Posted December 30, 2018 Share Posted December 30, 2018 You just snapshot the vdisk and point the VM to use the new snapshot as the vdisk, though if it's a one time thing you can just use cp --reflink, either can only be done using the CLI for now, more info here: https://forums.unraid.net/topic/51703-vm-faq/?do=findComment&comment=523800 Quote Link to comment
TheArtiszan Posted December 30, 2018 Author Share Posted December 30, 2018 14 hours ago, johnnie.black said: You just snapshot the vdisk and point the VM to use the new snapshot as the vdisk, though if it's a one time thing you can just use cp --reflink, either can only be done using the CLI for now, more info here: https://forums.unraid.net/topic/51703-vm-faq/?do=findComment&comment=523800 Thank you. That was helpful. Getting a little stumped on it and not sure if I am doing something wrong. So I created a new share to save VMs in and set it to be Auto for Cache-on-Write (don't have a yes option) which is set to prefer cache. My cache drives and array drives are all BTRFS. When I try those commands though it seems like I keep getting messages that it already exists but dosn't show in the list and I can't create it. Am I doing something wrong? Here is what I was running in CLI via the web terminal: root@Storinator:~# btrfs subvolume create /mnt/user/domains ERROR: target path already exists: /mnt/user/domains root@Storinator:~# btrfs subvolume snapshot /mnt/user/domains/1060 /mnt/user/domains/1060bak ERROR: Not a Btrfs filesystem: Invalid argument root@Storinator:~# btrfs subvolume snapshot /mnt/user/domains /mnt/user/domains_bak ERROR: Not a Btrfs filesystem: Invalid argument root@Storinator:~# btrfs subvolume snapshot /mnt/cache/domains/1060 /mnt/cache/domains/1060bak ERROR: Not a Btrfs subvolume: Invalid argument root@Storinator:~# btrfs subvolume create /mnt/cache/domains/1060 ERROR: target path already exists: /mnt/cache/domains/1060 root@Storinator:~# btrfs subvolume snapshot /mnt/cache/domains/1060 btrfs subvolume snapshot: too few arguments usage: btrfs subvolume snapshot [-r] [-i <qgroupid>] <source> <dest>|[<dest>/]<name> Create a snapshot of the subvolume Create a writable/readonly snapshot of the subvolume <source> with the name <name> in the <dest> directory. If only <dest> is given, the subvolume will be named the basename of <source>. -r create a readonly snapshot -i <qgroupid> add the newly created snapshot to a qgroup. This option can be given multiple times. root@Storinator:~# btrfs subvolume snapshot /mnt/cache/domains/1060 /mnt/cache/domains/1060bak ERROR: Not a Btrfs subvolume: Invalid argument root@Storinator:~# btrfs subvolume list /mnt/cache root@Storinator:~# btrfs subvolume create /mnt/user/VMs/1060 ERROR: target path already exists: /mnt/user/VMs/1060 root@Storinator:~# btrfs subvolume list /mnt/cache ERROR: cannot access '/mnt/cache': No such file or directory ERROR: can't access '/mnt/cache' root@Storinator:~# btrfs subvolume list /mnt/user/VMs ERROR: not a btrfs filesystem: /mnt/user/VMs ERROR: can't access '/mnt/user/VMs' root@Storinator:~# btrfs subvolume list /mnt/cache/VMs root@Storinator:~# btrfs subvolume create /mnt/cache/VMs ERROR: target path already exists: /mnt/cache/VMs root@Storinator:~# btrfs subvolume list /mnt/cache/VMs root@Storinator:~# btrfs subvolume snapshot /mnt/cache/VMs /mnt/cache/VMs_backup ERROR: Not a Btrfs subvolume: Invalid argument root@Storinator:~# Quote Link to comment
JorgeB Posted December 30, 2018 Share Posted December 30, 2018 17 minutes ago, TheArtiszan said: root@Storinator:~# btrfs subvolume create /mnt/user/domains ERROR: target path already exists: /mnt/user/domains The subvolume path must not exist already, i.e. you create one and that will be your share, also you need to use the disk share, not the user share, use for example: /mnt/cache/domains Quote Link to comment
TheArtiszan Posted December 30, 2018 Author Share Posted December 30, 2018 3 minutes ago, johnnie.black said: The subvolume path must not exist already, i.e. you create one and that will be your share, also you need to use the disk share, not the user share, use for example: /mnt/cache/domains Yeah. After playing with it some more I found that I was actually trying to create a btrfs subvolume to a directory that already existed. That looks like what my problem was there. Real head desk moment. Thanks for the help. Trying to copy into it now and see how things work. Then I just need to make copies of the snapshot for each VM to use then. Like from the backup to the new directory for the new VM? Quote Link to comment
JorgeB Posted December 30, 2018 Share Posted December 30, 2018 You can just make a copy using cp --reflink like explained in the link above, and you don't even need subvolumes or snapshots for that, or take a snapshot then have the new VM use it. Quote Link to comment
TheArtiszan Posted December 30, 2018 Author Share Posted December 30, 2018 19 minutes ago, johnnie.black said: You can just make a copy using cp --reflink like explained in the link above, and you don't even need subvolumes or snapshots for that, or take a snapshot then have the new VM use it. I think this is starting to make sense to me. So after the inital VM is setup and ready for the snapshot I run this command. btrfs subvolume snapshot /mnt/cache/VMbtrfs /mnt/cache/VMs_backup Does the reflink only work for refferences or can I use it for a new machine I make like the one below called 1070 instead of 1060 cp --reflink /mnt/cache/VMs_backup/1060/vdisk1.img /mnt/cache/VMs_backup/1070/vdisk1.img and then 1080 for a third machine cp --reflink /mnt/cache/VMs_backup/1060/vdisk1.img /mnt/cache/VMs_backup/1080/vdisk1.img if it is making refference links, won't one change the other? Or does that were this command comes in to get a second instance of it? btrfs send /mnt/cache/VMs_backup | btrfs receive /mnt/disk1 Quote Link to comment
JorgeB Posted December 30, 2018 Share Posted December 30, 2018 For what you're trying to do you don't need snapshots, just use cp --reflink, e.g. the original vdisk is: /mnt/cache/domains/VMName/vdisk1.img then just cp --reflink to create the other vdisks cp --reflink /mnt/cache/domains/VMName/vdisk1.img /mnt/cache/domains/VMName2/vdisk1.img cp --reflink /mnt/cache/domains/VMName/vdisk1.img /mnt/cache/domains/VMName3/vdisk1.img etc Quote Link to comment
TheArtiszan Posted December 30, 2018 Author Share Posted December 30, 2018 5 minutes ago, johnnie.black said: For what you're trying to do you don't need snapshots, just use cp --reflink, e.g. the original vdisk is: /mnt/cache/domains/VMName/vdisk1.img then just cp --reflink to create the other vdisks cp --reflink /mnt/cache/domains/VMName/vdisk1.img /mnt/cache/domains/VMName2/vdisk1.img cp --reflink /mnt/cache/domains/VMName/vdisk1.img /mnt/cache/domains/VMName3/vdisk1.img etc Ahh okay. So maybe I am just over complicating things. And then if I install something on VMName2 it won't change VMName1? Quote Link to comment
TheArtiszan Posted December 30, 2018 Author Share Posted December 30, 2018 15 minutes ago, johnnie.black said: For what you're trying to do you don't need snapshots, just use cp --reflink, e.g. the original vdisk is: /mnt/cache/domains/VMName/vdisk1.img then just cp --reflink to create the other vdisks cp --reflink /mnt/cache/domains/VMName/vdisk1.img /mnt/cache/domains/VMName2/vdisk1.img cp --reflink /mnt/cache/domains/VMName/vdisk1.img /mnt/cache/domains/VMName3/vdisk1.img etc So my current disk is at /mnt/cache/VMbtrfs/1060/vdisk.img Running the below command: cp --reflink /mnt/cache/VMbtrfs/1060/vdisk.img /mnt/user/VMbtrfs/650/vdisk1.img I am getting error: cp: failed to clone '/mnt/user/VMbtrfs/650/vdisk1.img' from '/mnt/cache/VMbtrfs/1060/vdisk.img': Invalid cross-device link Is that command right? When I check the target location, the folder exists but not the file. Even if I create the file it is still the same error. Quote Link to comment
TheArtiszan Posted December 30, 2018 Author Share Posted December 30, 2018 Oh der I think I found the problem. path is different mount point. Quote Link to comment
TheArtiszan Posted December 30, 2018 Author Share Posted December 30, 2018 21 minutes ago, johnnie.black said: For what you're trying to do you don't need snapshots, just use cp --reflink, e.g. the original vdisk is: /mnt/cache/domains/VMName/vdisk1.img then just cp --reflink to create the other vdisks cp --reflink /mnt/cache/domains/VMName/vdisk1.img /mnt/cache/domains/VMName2/vdisk1.img cp --reflink /mnt/cache/domains/VMName/vdisk1.img /mnt/cache/domains/VMName3/vdisk1.img etc cp --reflink /mnt/cache/VMbtrfs/1060/vdisk.img /mnt/cache/VMbtrfs/650/vdisk.img Yeah the first error was due to my pathing issue between user and cache instead. The above is now giving me this error I don't see where the problem is on that one though. cp: failed to clone '/mnt/cache/VMbtrfs/650/vdisk.img' from '/mnt/cache/VMbtrfs/1060/vdisk.img': Invalid argument Quote Link to comment
JorgeB Posted December 31, 2018 Share Posted December 31, 2018 Yeah, that should work, as long as the dest folder already exists, if you're copy/pasting try typing the command instead since the forum sometimes add extra characters on paste. 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.