btrf raid - don't understand the concept about Loopback device

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
SprinterDriver
Level 4
Level 4
Posts: 260
Joined: Sun Jan 25, 2015 3:35 pm
Location: Norway

btrf raid - don't understand the concept about Loopback device

Post by SprinterDriver »

Hi.

For a test machine (the specs in my signature field) mostly for learning purposes, I have two smaller disks that I plan to make into a BTRFS raid (single disk because the disks will probably not be of same size), and after then I plan to have /var and /tmp mounted on that raid1 file system.

First problem:
From this article I'm reading (https://btrfs.wiki.kernel.org/index.php ... le_Devices) it says:
If you want to mount a multi-device filesystem using a loopback device, it's not sufficient to use mount -o loop. Instead, you'll have to set up the loopbacks manually:
# Create and mount a filesystem made of several disk images
mkfs.btrfs img0 img1 img2
losetup /dev/loop0 img0
losetup /dev/loop1 img1
losetup /dev/loop2 img2
mount /dev/loop0 /mnt/btrfs
This is wher I fall off. Can someone elaborate so I can understand this concept?


Second problem (this is for learning purposes, I'm aware that the setup is not the best idea)
What steps to take for make a change in location for /var and /tmp. The first step will not involve adding another drive, but I want to set up the file system in a way so that SDB2 can be expanded.
I also need to mount btrfs so that it cause as little file fragmentation as possible.

About the attachment
First off - I'm not sure if it is possible at all to have swap partition and a btrfs partition (for expanding purposes on same disk). If that is impossible I can always try to make swap on first drive.

I assume the growth of /home will work ok.

The problem I assume to face is when I try to make /var and /temp to the same partition in a folder - because I'm not very familiar to mouning partitions in Linux.
What must I do inorder to accomplish this?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
So I got this bright idea. But when I tried to grab the light bulb, I did not hurt my hands as expected from a warm bulb, because it turned out to be one of those LED bulbs.
Mute Ant

Re: btrf raid - don't understand the concept about Loopback device

Post by Mute Ant »

"Can someone elaborate"

If you have your BTRFS held in multiple files, it's not sufficient to mount just one of them and expect the kernel to magically find the others. Each file has to be attached as a loop-device, then you mount the first one and the others are connected too.

That's not the case when the pieces of BTRFS are partitions or whole drives. The kernel can find them all, even though you only mount one, so you don't need the loop devices.
mr_raider
Level 7
Level 7
Posts: 1897
Joined: Sun Jun 20, 2010 9:50 am
Location: Montreal, QC

Re: btrf raid - don't understand the concept about Loopback device

Post by mr_raider »

You don't need to mount it as a loopback device. Once the array is defined you can mount it by it's UUID or any component in ftsab. Here is a recent discussion

viewtopic.php?f=46&t=254046&hilit=btrfs
Image
User avatar
SprinterDriver
Level 4
Level 4
Posts: 260
Joined: Sun Jan 25, 2015 3:35 pm
Location: Norway

Re: btrf raid - don't understand the concept about Loopback device

Post by SprinterDriver »

Thank you for explanation.

Btw: I have another anchient computer that I tried to use PeppermintOS 8 Live-cd to make a Btrfs raid-0 for two old disks. What I learn from that experiment was that I found two drives in file manager, but I had not rights to create any files or folders within, even if file manager claims free space as expected.
I have not tried that using LM, so can't say if it will behave the same way.
So I got this bright idea. But when I tried to grab the light bulb, I did not hurt my hands as expected from a warm bulb, because it turned out to be one of those LED bulbs.
Mute Ant

Re: btrf raid - don't understand the concept about Loopback device

Post by Mute Ant »

"I had not rights to create any files" Completely normal, and yes, Mint will behave the same way. Root invokes mkfs.btrfs and root owns the whole file system. Only root can relax the permissions or change the owner.
Locked

Return to “Storage”