You are not logged in.

#1 2013-07-12 11:34:44

smsware
Member
From: Szczecin, Poland
Registered: 2012-08-14
Posts: 149
Website

Pure-btrfs partitioning

There is nothing about it anywhere I was looking for, also in all-containing Wiki of Arch: the 3rd, next to MBR and GPT, option to partition your hard drive... I've just made that on my system and it works fine so I wanted to add it to the Wiki but the lack of it makes me think that it's somehow wrong thing to do; e.g. it will ruin my system within next two days or something... ;-)

Steps:
1. mkfs.btrfs on /dev/sda
2. creating subvolumes (__active/boot, __active/var...)
3. grub-install on /dev/sda

Simple as that. No boot flag needed anywhere, no need to correct grub-mkconfig's output (I was a little scared of rebooting but it's just that automatic)... and btrfs (as I read somewhere) gain some performance boost from occupying whole disk. Cons: no swap possible, no UEFI boot possible.

Offline

#2 2013-07-12 12:05:26

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 5,265

Re: Pure-btrfs partitioning

Not everything needs to be on the wiki. I haven't written an article/section about my setup either (btrfs RAID1 with 32k leaf size and UEFI booting over two SSDs), because it doesn't need to be there.

If you really think that your experience will help enhance the quality of the wiki, throw it up there. If people disagree, they'll remove it.

Last edited by WorMzy (2013-07-12 13:39:36)


Sakura:-
Mobo: ASUS P8Z77-V PRO // Processor: Intel Core i7-3770K 3.4GHz // GFX: nVidia GeForce GTX 970 Ti // RAM: 32GB (4x 8GB) Corsair DDR3 (@ 2133MHz) // Storage: 1x 3TB Seagate SATAII 5x 1TB Samsung SATAII, 2x 120GB Corsair SSD

Offline

#3 2013-07-12 12:23:18

smsware
Member
From: Szczecin, Poland
Registered: 2012-08-14
Posts: 149
Website

Re: Pure-btrfs partitioning

I mean just that there is section about GPT/MBR choice as GPT would be the one and only alternative to old'n'ugly MBR. Well, as you typed - I will add that and we will see if it'g going to be removed or not... :-)

Offline

#4 2013-07-12 18:54:22

donniezazen
Member
From: Salt Lake City
Registered: 2011-06-24
Posts: 671
Website

Re: Pure-btrfs partitioning

Wiki clearly says that no special instructions are needed to install a btrfs system. You do want to source your entries on why those subvolumes are required or suggested as subvolumes are like partitions and are personal choice.

Offline

#5 2013-07-13 12:40:50

smsware
Member
From: Szczecin, Poland
Registered: 2012-08-14
Posts: 149
Website

Re: Pure-btrfs partitioning

donniezazen wrote:

Wiki clearly says that no special instructions are needed to install a btrfs system. You do want to source your entries on why those subvolumes are required or suggested as subvolumes are like partitions and are personal choice.

Yes, I just went by wiki on this but I know that they are optional - I left names of my subvolumes as if I would want to use mkinitcpio-btrfs while I'm not using it but I feel like it's quite logical setup anyway. Still, the only thing I "discovered" and wanted to share is that one does not need additional partition scheme (MBR or GPT) as btrfs can act as partition scheme on it's own if you mkfs the whole disk, not e.g. single partition inside GPT and that there are no additional steps necessary (like Bios boot partition in case of MBR) for Grub to work out-of-the-box.

Offline

#6 2013-07-13 13:18:06

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 3,727

Re: Pure-btrfs partitioning

smsware wrote:

I mean just that there is section about GPT/MBR choice as GPT would be the one and only alternative to old'n'ugly MBR. Well, as you typed - I will add that and we will see if it'g going to be removed or not... :-)

GPT is not an alternative to MBR. MBR is (usualy)the first 512 bytes of the disk, and usually contains a bootloader (first 440/446 bytes) and a partition table. The most common format for the partition table is the "ms-dos" style. GPT is another format.

http://en.wikipedia.org/wiki/Master_boot_record
http://en.wikipedia.org/wiki/GUID_Partition_Table


Evil #archlinux@freenode channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#7 2013-07-13 15:01:09

donniezazen
Member
From: Salt Lake City
Registered: 2011-06-24
Posts: 671
Website

Re: Pure-btrfs partitioning

core.img for btrfs is bigger than 512 bytes hence it requires a 2MB unformatted partition at the beginning of the disks. GPT is kind of alternative to MBR for modern systems. MBR only supports four logical and one extended partition whereas GTP can have as many partitions as possible.

@smsware Here is how I setup my btrfs system.

fdisk /dev/sdx
Partition 1 2MB unformatted (for bigger boot.cfg)
Partition 2 4GB swap (btrfs doesn't support swap on subvolumes, loop is slow)
Partition 3 Rest of the disk

btrfs.mkfs /dev/sdx3
mount /dev/sdx3 /mnt && /mnt
btrfs subvolume create root
btrfs subvolume create root/home #(too many file changes which doesn't need to be snapshotted as long as one is taking backups)
btrfs subvolume create root/opt #(contains large softwares doesn't need to be snapshotted)
btrfs subvolume create root/var/cache/pacman/pkg #(can get quite big and there is always rollback machine)
umount /mnt
mount -o relatime,compress=lzo,subvol=root /dev/sdx3 /mnt

And then business as usual.

I think we should create a new page like alternative partitioning layouts for btrfs setup.

Edit:- Messed up. I am talking about core.img and not boot.cfg

Last edited by donniezazen (2013-07-13 19:44:04)

Offline

#8 2013-07-13 15:18:45

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 4,977

Re: Pure-btrfs partitioning

donniezazen wrote:

boot.cfg for btrfs is bigger than 512 bytes hence it requires a 2MB unformatted partition at the beginning of the disks. GPT is kind of alternative to MBR for modern systems. MBR only supports four logical and one extended partition whereas GTP can have as many partitions as possible.

You missed the point, he's quibbling over terminology. When people say "MBR", they're including the ms-dos style partition table, even though it may not technically be correct.

And what the hell is boot.cfg?

Offline

#9 2013-07-13 15:41:30

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: Pure-btrfs partitioning

Scimmia wrote:

And what the hell is boot.cfg?

Judging by the mention of a 2MB partition, I would venture to say that he meant to say boot.img in regard to grub...

As far as the topic of this thread is concerned, I feel like that particular btrfs page should be removed from the wiki.  It gives the false impression that using the mkinitcpio-btrfs AUR package is the right way to do things, when in reality it is just a suggested way.  Maybe if not removal, there should be some very drastic clean up and a change of the title to reflect that the page is in fact related to an unsupported AUR package.

I think that the main btrfs Arch Wiki page does indeed need some help though, so smsware, if you want to add some information about how btrfs can be used on a whole device (or span multiple devices), that would be the way to go I think.  Also for all the btrfs has to offer, some of the sections are a bit sparse.  For example, there is no mention of the use of the potential self healing properties with RAID, of anything about "btrfs scrub" at all.  No quotas, no send/receive, etc.

Basically, I think it would be great to give potential readers of the wiki some more insight into how to use btrfs more effectively.  But it would be nice to see a more generalized explanation rather than a specific set of copy/paste instructions to mirror your own setup.

Offline

#10 2013-07-13 19:42:45

donniezazen
Member
From: Salt Lake City
Registered: 2011-06-24
Posts: 671
Website

Re: Pure-btrfs partitioning

My bad I meant to say core.img.

Offline

#11 2013-07-13 19:44:44

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: Pure-btrfs partitioning

donniezazen wrote:

My bad I meant to say core.img.

Except, there is nothing by the name of "core.img" in the grub package...

Offline

#12 2013-07-13 20:08:27

donniezazen
Member
From: Salt Lake City
Registered: 2011-06-24
Posts: 671
Website

Re: Pure-btrfs partitioning

WonderWoofy wrote:
donniezazen wrote:

My bad I meant to say core.img.

Except, there is nothing by the name of "core.img" in the grub package...

Interesting. My experience is if you are planning btrfs installation with GRUB/MBR, Grub won't install without 2MB partition.

Offline

#13 2013-07-14 12:56:12

smsware
Member
From: Szczecin, Poland
Registered: 2012-08-14
Posts: 149
Website

Re: Pure-btrfs partitioning

Mr.Elendig wrote:
smsware wrote:

I mean just that there is section about GPT/MBR choice as GPT would be the one and only alternative to old'n'ugly MBR. Well, as you typed - I will add that and we will see if it'g going to be removed or not... :-)

GPT is not an alternative to MBR. MBR is (usualy)the first 512 bytes of the disk, and usually contains a bootloader (first 440/446 bytes) and a partition table. The most common format for the partition table is the "ms-dos" style. GPT is another format.

http://en.wikipedia.org/wiki/Master_boot_record
http://en.wikipedia.org/wiki/GUID_Partition_Table

The only thing I wanted to say is that btrfs can act as partition table for itself so you don't need GPT or "MS DOS-style partition table".
Btw. you may be technically right but

Arch Wiki wrote:

The Master Boot Record (MBR) is the first 512 bytes of a storage device. The MBR is not a partition; it is reserved for the operating system's bootloader and the storage device's partition table. An newer alternative to MBR is the GUID Partition Table, which is part of the Unified Extensible Firmware Interface specification.

That's because GPT removes (or can remove and it's done by default) the access to MBR and that's why you need "Bios boot partition" or "EFI system partition" while using GPT.

donniezazen wrote:

@smsware Here is how I setup my btrfs system.

fdisk /dev/sdx
[...]

I think we should create a new page like alternative partitioning layouts for btrfs setup.

And how is that "alternative"? It's MBR, some subvolumes... there is no fdisk/gdisk usage in my example and about that idea I wanted to talk because I couldn't find anything about it in the Internet while it's working great on my PC right now...

Last edited by smsware (2013-07-14 12:57:27)

Offline

#14 2013-07-14 13:04:09

Earnestly
Member
Registered: 2011-08-18
Posts: 804

Re: Pure-btrfs partitioning

smsware wrote:

The only thing I wanted to say is that btrfs can act as partition table for
itself so you don't need GPT or "MS DOS-style partition table".

How?

smsware wrote:

That's because GPT removes (or can remove and it's done by default) the access
to MBR and that's why you need "Bios boot partition" or "EFI system partition"
while using GPT.

This is because GPT doesn't provide a "post MBR gap", not because it removes
access to the MBR (what?). You also cannot use UEFI (or an ESP) with a MBR so
that's irrelevant.

Last edited by Earnestly (2013-07-14 13:05:55)

Offline

#15 2013-07-14 13:24:24

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: Pure-btrfs partitioning

Indeed Kaustic is right.  GPT does not have any effect on the existence or functionality of the MBR.  It is still there and it still works just fine.  In fact part of the GPT spec is to use an ms-dos partition table with one partition spanning the whole disk. This is called the protective MBR, and is there to shield the disk against potentially being overwritten by programs that are only ms-dos partitioning aware.

The MBR takes the first 512 bytes.  As mentioned above, the first 440/446 bytes are the boot sector, and the rest is the partition table.  This is why you can only have 4 primary partitions.  The GPT spans from just after the MBR to where we now start the first partition, at sector 2048.  This allows GPT to have the default 128 "primary" partitions it is able to handle.  Though this can be changed at creation time to include more or less. 

Grub needs that stoopid 2MB partition because over the years they have shoehorned every new feature they could possibly imagine into it.  It got big and bloated and now it doesn't fit in that tiny 446 bytes at the beginning of the disk.  So they saw some "unused" space in the post-MBR gap and decided to use that.  But now that the GPT takes that space, they needed somewhere else to put the crapola.

As a side note, there is some debate about the wisdom of using the post-MBR gap for this extra stuffs anyway.  Since there really is no spec in how this should be used in a non-GPT system, there are some other badly designed programs out there that actually use this space for various things.  Many of them will simply write to this section of the disk regardless of what is currently there.  Unsurprisingly, all these types of programs are designed to work an operating system designed by this amazing company in Redmond, WA...

smsware wrote:

The only thing I wanted to say is that btrfs can act as partition table for itself so you don't need GPT or "MS DOS-style partition table".

This is the kind of thing that I really think would serve the wiki very well.  It should be mentioned that btrfs has the ability to span an entire disk, as that is a really great feature of btrfs.  It can also be used on multiple block devices, so I have mine spanning a partition on one disk as well as another full disk. 

It should be noted though that this is not actually considered a "partition table" by any means.  So I don't know if you should include such phrases simply to avoid any confusion.  Though if you are using it in a metaphorical sense, then I think that is pretty acceptable.

Offline

#16 2013-07-14 14:37:55

Earnestly
Member
Registered: 2011-08-18
Posts: 804

Re: Pure-btrfs partitioning

WonderWoofy wrote:

GPT does not have any effect on the existence or functionality of the MBR.  It is still there and it still works just fine.  In fact part of the GPT spec is to use an ms-dos partition table with one partition spanning the whole disk. This is called the protective MBR, and is there to shield the disk against potentially being overwritten by programs that are only ms-dos partitioning aware.

What are you on about? You need to do some reading about where the Protective MBR is stored. Wikipedia is a good start.

This is entire thread just blows my mind at just how out of whack the posts are. I don't even know where to begin. You're all tripping up over the basics of the basics. Honestly, wikipedia is a good start then you might like to try rodsbooks.com, the man who created gpt-fdisk (gdisk) has a lot of useful information regarding GPT, MBR and how they work.

edit
If you're suggesting that you don't need GPT or MBR because BTRFS can effectively just use subvolumes as an alternative to partitions, than that's possible, but you'd still need a bootloader somewhere (such as a seperate boot disk) which can boot the btrfs disk directly (grub2 can iirc), but booting the subvols? I'm not aware that grub2 has such capabilities (yet).

There are probably other tricks I'm not aware of, so please do explain how it might work if you know.

Last edited by Earnestly (2013-07-14 14:53:38)

Offline

#17 2013-07-14 14:51:53

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: Pure-btrfs partitioning

Kaustic wrote:
WonderWoofy wrote:

GPT does not have any effect on the existence or functionality of the MBR.  It is still there and it still works just fine.  In fact part of the GPT spec is to use an ms-dos partition table with one partition spanning the whole disk. This is called the protective MBR, and is there to shield the disk against potentially being overwritten by programs that are only ms-dos partitioning aware.

What are you on about? You need to do some reading about where the Protective MBR is stored. Wikipedia is a good start.

This is entire thread just blows my mind at just how out of whack the posts are. I don't even know where to begin. You're all tripping up over the basics of the basics. Honestly, wikipedia is a good start.

What I mean is that in addition to the GPT partition table at the beginning and end of the disk, it also keeps a ms-dos partition table in the MBR.  It is the protective MBR and by definition it contains a single partition that spans the entire disk of gptfdisk type 0xEE.  I figured that by saying that it was ms-dos partitioning, it would be obvious that it would be held in the MBR... because that is where an ms-dos partition table goes...  I think I was just apparently not clear enough maybe.

Here is information from that wikipedia page you so highly recommend http://en.wikipedia.org/wiki/GUID_Parti … e#Features

I'm not entirely sure what you are on about.  If you thought the information was wrong, it might have been better to have tried to pass correct information to the tread instead of basically telling everyone in the thread they are idiots...

Last edited by WonderWoofy (2013-07-14 14:53:33)

Offline

#18 2013-07-14 14:58:29

Earnestly
Member
Registered: 2011-08-18
Posts: 804

Re: Pure-btrfs partitioning

WonderWoofy wrote:

I'm not entirely sure what you are on about.  If you thought the information was wrong, it might have been better to have tried to pass correct information to the tread instead of basically telling everyone in the thread they are idiots...

You've managed to link a wikipedia article which directly contradicts what you even said. I have no idea where to start. The Protective MBR doesn't span the entire disk, it sits in the header for the GPT (LBA 0):

The wikipedia article you linked, first paragraph wrote:

In a GPT, the first sector of the disk is reserved for a "protective MBR" such that booting a BIOS-based computer from a GPT disk is supported, but the boot loader and O/S must both be GPT aware.

Unless there is a severe misunderstanding somewhere.

Last edited by Earnestly (2013-07-14 15:00:12)

Offline

#19 2013-07-14 15:10:32

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: Pure-btrfs partitioning

What that means is that the partition table that holds the protective MBR does not cover sector 0.  This is because the first sector holds the MBR.  So it starts from sector 1 and goes to the end of the disk, giving the impression that the whole disk is in use to programs like fdisk before it became gpt aware.

If you take a look at the link you posted above to the diagram of how the GPT is laid out, you will see even there that the protective MBR is not in the GPT header.  It is before the GPT header, and sits where the MBR has always been (taking up sector 0).

So I guess technically you might be right that the protective MBR does not span the entire disk, as it intentioanlly does not cover the first sector.

Offline

#20 2013-07-14 19:20:40

smsware
Member
From: Szczecin, Poland
Registered: 2012-08-14
Posts: 149
Website

Re: Pure-btrfs partitioning

Kaustic,

I'm not aware that grub2 has such capabilities (yet).

As I've said in my first post, my system is set up that way. All I did was:

bb if=/dev/zero of=/dev/sda bs=4096
mkfs.btrfs /dev/sda
grub-install /dev/sda

and it's working. I guess that "btrfs spanning the whole disk" is smart enough to leave MBR for Grub and Grub is smart enough to know about btrfs' features. That's all. I never intended to be this wise guy who knows how and why it's working, I just found out it actually is working pretty well and wanted to share that discovery. Hopefully, you could figure it out and tell me how it's done but don't say it's impossible as I'm right now typing this post from my PC set up the described way. I have no idea how bootloaders or bioses work and that's why I wrote some inaccurate information trying to describe what I found out about but only because I felt not really understood in the first place (just look at first posts - these are about something completely different; WonderWoofy got exactly what I wanted to say).

Offline

#21 2013-07-14 19:32:47

progandy
Member
Registered: 2012-05-17
Posts: 2,151

Re: Pure-btrfs partitioning

AFAIK btrfs leaves the first 64 KiB empty. You can use that to install a boot loader with btrfs support.

Offline

#22 2013-07-14 21:36:34

donniezazen
Member
From: Salt Lake City
Registered: 2011-06-24
Posts: 671
Website

Re: Pure-btrfs partitioning

smsware wrote:

Kaustic,

bb if=/dev/zero of=/dev/sda bs=4096
mkfs.btrfs /dev/sda
grub-install /dev/sda

Interesting, thanks for sharing. I have to try that. I use swap to hibernate and btrfs's swapfile support is a little flaky at the moment so that might not be an ideal solution.

Offline

#23 2013-07-14 23:12:54

smsware
Member
From: Szczecin, Poland
Registered: 2012-08-14
Posts: 149
Website

Re: Pure-btrfs partitioning

https://wiki.archlinux.org/index.php/Pa … With_BTRFS

And yes, there can be no swap but I'm not using hibernation anyway so it's no pain for me. :-)

Last edited by smsware (2013-07-14 23:13:37)

Offline

#24 2013-07-14 23:19:52

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: Pure-btrfs partitioning

Hmmm... while I do think that this is good information for the wiki, I don't know if I fully agree with the spot you chose to put it in.  Partitioning is a very different thing than subvolumes of a btrfs pool.  If this were to go there, I think that then LVM2 should go there as well. 

Maybe a better way would be to go with a note on the Partitioning page that indicates that there is the alternative of using btrfs as a whole disk pool, then linking to the btrfs page where this information is held in full.  I just feel like it would be greatly beneficial to the wiki if all of the real "meat" of the btrfs info were all centralized.

But then, that is just my opinion.  Maybe someone else can weigh in here.

Offline

#25 2013-07-15 00:08:46

smsware
Member
From: Szczecin, Poland
Registered: 2012-08-14
Posts: 149
Website

Re: Pure-btrfs partitioning

Yeah, I had some trouble with a place to put it in... it's just this kind of information that it just a couple of lines of text long but covers different subjects (partitioning, creating file system, booting...) so yeah, your way is much better - somebody interested in using Btrfs, will find it now more easly:
https://wiki.archlinux.org/index.php/Pa … With_BTRFS
https://wiki.archlinux.org/index.php/Btrfs#Partitioning

Offline

Board footer

Powered by FluxBB