You are not logged in.

#1 2018-06-12 15:07:45

Svinto
Member
Registered: 2012-01-15
Posts: 15

[SOLVED] How to mount at boot: file -> loop device -> bcache > etx4

My workstation has 80GB SSD and 500GB HDD.

I need to work with virtual machines that needs a lot of disk space. But using my HHD as a storage media for my VM's feels a little slow.

To get as much performance as possible I decided to use bcache. But since I don't have any free partitions left I created two big files (one on each disk) with dd instead and connected them to /dev/loop{0,1}.
From there I could setup the HDD file as a bcache backing partition and the SSD file as a cache partition. I then formatted the /dev/bcache0 with ext4 and mounted it.

My question now is HOW do I mount this at boot? Can I use fstab for this?
Or, is this maybe a bad solution to my problem? In that case why?

Guides that I used:
- https://wiki.archlinux.org/index.php/Bc … che_device
- https://www.jamescoyle.net/how-to/2096- … ock-device

Last edited by Svinto (Yesterday 09:56:31)

Offline

#2 Yesterday 09:56:20

Svinto
Member
Registered: 2012-01-15
Posts: 15

Re: [SOLVED] How to mount at boot: file -> loop device -> bcache > etx4

I concluded that this wasn't possible to do with just fstab.

I took the lazy approach and used rc-local from AUR.

/etc/rc.local:

losetup /dev/loop0 "/path/to/file/on/hdd"
losetup /dev/loop1 "/path/to/file/on/ssd"
for i in {1..5}; do [ -b /dev/bcache0 ] && break; sleep 1; done  # Wait for udev to create the file /dev/bcache0
mount /dev/bcache0 /mnt/bcache

A better approach I think would be to use systemd, but I haven't looked in to it:
https://giorgos.sealabs.net/systemd-uni … e-lvm.html

Offline

Board footer

Powered by FluxBB