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

Forum rules
Before you post please read this
SprinterDriver
Level 3
Level 3
Posts: 142
Joined: Sun Jan 25, 2015 3:35 pm
Location: Norway

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

Postby SprinterDriver » Sun Oct 08, 2017 11:12 am

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?
Linux Mint 18.1 Mate 32 bit.
Runs fine on AMD2000+ / 1GB ram / NV40 [GeForce 6800] / MSI MS-6380E (Hardware not too much to brags about)

Mute Ant
Level 12
Level 12
Posts: 4210
Joined: Tue Sep 03, 2013 7:45 pm

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

Postby Mute Ant » Sun Oct 08, 2017 11:45 am

"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.
Strange women lying in ponds distributing swords is no basis for a system of government.

mr_raider
Level 6
Level 6
Posts: 1281
Joined: Sun Jun 20, 2010 9:50 am
Location: Montreal, QC

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

Postby mr_raider » Sun Oct 08, 2017 12:11 pm

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

SprinterDriver
Level 3
Level 3
Posts: 142
Joined: Sun Jan 25, 2015 3:35 pm
Location: Norway

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

Postby SprinterDriver » Sun Oct 22, 2017 7:50 pm

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.
Linux Mint 18.1 Mate 32 bit.
Runs fine on AMD2000+ / 1GB ram / NV40 [GeForce 6800] / MSI MS-6380E (Hardware not too much to brags about)

Mute Ant
Level 12
Level 12
Posts: 4210
Joined: Tue Sep 03, 2013 7:45 pm

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

Postby Mute Ant » Sun Oct 22, 2017 8:15 pm

"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.
Strange women lying in ponds distributing swords is no basis for a system of government.


Return to “Mounting Partitions”