View previous topic :: View next topic |
Author |
Message |
eusanpe Tux's lil' helper
Joined: 06 Sep 2002 Posts: 107
|
Posted: Wed Feb 03, 2010 5:03 am Post subject: Btrfs and Raid setup |
|
|
Hello All,
I have been using reiser4 for a couple of years now but I am tired of the fsync issues that hamper my system so I am going to
change. I just purchased two 500gb 7200 rpm hard drives for my laptop. I am going to try btrfs along with a raid0 setup. I have
some questions though.
1. For the partitions, should I use gdisk to create all primary partitions or fdisk along with LVM? This is going to be an all/only
Gentoo system. I will have partitions for /home /usr/portage/distfiles /usr along with some others
2. I am going to use Raid0 (striping) on my partitions, should /boot be set to Raid1 (mirroring)? What about swap?
3. How does btrfs raid setup compare to mdadm setup. I just want some experiences from some of the ones who have tried both.
4. Are there any special flags to use along side mkfs.btrfs besides raid setup to get maximum performance, ex..sectorsize, etc...
5. How is compress-force running in a raid0 setup?
Thank you for any advice.
Tony |
|
Back to top |
|
|
ToeiRei Veteran
Joined: 03 Jan 2005 Posts: 1191 Location: Austria
|
Posted: Wed Feb 03, 2010 7:53 am Post subject: Re: Btrfs and Raid setup |
|
|
eusanpe wrote: | 1. For the partitions, should I use gdisk to create all primary partitions or fdisk along with LVM? This is going to be an all/only
Gentoo system. I will have partitions for /home /usr/portage/distfiles /usr along with some others |
LVM is unneeded as btrfs does that for you. One btrfs partition containing multiple subvolumes does the trick as btrfs aims to get away from the idea of partitions. You just got 'storage' and that's it.
eusanpe wrote: | 2. I am going to use Raid0 (striping) on my partitions, should /boot be set to Raid1 (mirroring)? What about swap? |
As btrfs isn't supported by GRUB (there may be some patches out there, but I didn't get something working here) /boot should be a seperate partition. Swapping can be done into a file, but I'd recommend the good ol' swap partition.
eusanpe wrote: | 3. How does btrfs raid setup compare to mdadm setup. I just want some experiences from some of the ones who have tried both. |
it's completely different
eusanpe wrote: | 4. Are there any special flags to use along side mkfs.btrfs besides raid setup to get maximum performance, ex..sectorsize, etc... |
usually the defaults perform pretty well.
eusanpe wrote: | 5. How is compress-force running in a raid0 setup? |
this is something currently being worked on - so you should expect some weird behavior.
Just my 2 cents...
Rei _________________ Please stand by - The mailer daemon is busy burning your messages in hell... |
|
Back to top |
|
|
fangorn Veteran
Joined: 31 Jul 2004 Posts: 1886
|
Posted: Wed Feb 03, 2010 10:44 am Post subject: |
|
|
As a follow up:
GRUB also can't boot from RAID. But RAID1 for /boot is as if you didn't use RAID at all, so this will work.
There already is some kind of load balancing between multiple swap partitions, so RAID is not advisable.
concerning RAID in btrfs:
btrfs is still in heavy development and AFAIK not even the ondisk format is fix.
btrfs is fit for testing purposes IMHO, but if it hurts you to rebuild everything from scratch, then don't use the more advanced features. And if you do, keep good backups of each and every file on the disks.
That said, I'd recommend md RAID (and LVM if needed) solution at this point of time. _________________ Video Encoding scripts collection | Project page |
|
Back to top |
|
|
ToeiRei Veteran
Joined: 03 Jan 2005 Posts: 1191 Location: Austria
|
Posted: Wed Feb 03, 2010 10:56 am Post subject: |
|
|
I am running btrfs as my rootfs for quite a while now. As long as you don't do many funky things it should be quite stable and the experimental flag is about to be removed in the next kernel versions _________________ Please stand by - The mailer daemon is busy burning your messages in hell... |
|
Back to top |
|
|
fangorn Veteran
Joined: 31 Jul 2004 Posts: 1886
|
Posted: Wed Feb 03, 2010 11:25 am Post subject: |
|
|
Yeah, but I for my part see the subvolume and RAID part as "funky features".
I use them only at test disks where I don't put any data I don't have elsewhere. The system device is IMHO not suitable for testing them.
I am with you that btrfs is fit for being "just a filesystem" for a single partition, but that is not where it's strengths are. In these sectors there are plenty of filesystems that can compete. There I for my part tend to use well tested filesystems (ext3 for / and home, xfs for data storage). _________________ Video Encoding scripts collection | Project page |
|
Back to top |
|
|
EzInKy Veteran
Joined: 11 Oct 2002 Posts: 1742 Location: Kentucky
|
Posted: Wed Feb 03, 2010 11:52 am Post subject: |
|
|
fangorn wrote: | Yeah, but I for my part see the subvolume and RAID part as "funky features".
I use them only at test disks where I don't put any data I don't have elsewhere. The system device is IMHO not suitable for testing them.
I am with you that btrfs is fit for being "just a filesystem" for a single partition, but that is not where it's strengths are. In these sectors there are plenty of filesystems that can compete. There I for my part tend to use well tested filesystems (ext3 for / and home, xfs for data storage). |
RAID and LVM always seemed intimidating to me despite using Linux for over thirteen years now. It took btrfs to finally convince me that integrating multiple hard drives into a single file system was something that I could accomplish. A simple, single command was all it took to combine four 2TB drives into one logical partition, and sharing that partition using nfs was a piece of cake. Of course I have the data backed up on the ext3 partitions where they were originally stored. _________________ Time is what keeps everything from happening all at once. |
|
Back to top |
|
|
eusanpe Tux's lil' helper
Joined: 06 Sep 2002 Posts: 107
|
Posted: Wed Feb 03, 2010 2:14 pm Post subject: |
|
|
Thank ya for the advice. After eight years of using Gentoo/Funtoo and '~amd64', I backup my system nightly because you never know
what could happen.
So do I create the /boot and swap partitions on /dev/sda (/dev/sda1 and /dev/sda2) and then rootfs(/) on sda3 and then rootfs(/) on sdb1 and
join both rootfs partitions via raid0 and create subvolumes for /home and other directories that would previously be partitions?
I currently use LVM but btrfs seems so much easier since it is all integrated.
Thanks again,
Tony |
|
Back to top |
|
|
eusanpe Tux's lil' helper
Joined: 06 Sep 2002 Posts: 107
|
Posted: Fri Feb 05, 2010 6:31 pm Post subject: |
|
|
Is there a btrfs howto or can anyone let me know how to setup subvolumes for the root filesystem in Gentoo? For instance how to create a /var/tmp or /usr/portage/distfiles subvolume
during install. I am doing a brand new install using System Rescue CD. I have partitions setup as:
/dev/sda1 /boot ext2
/dev/sda2 /rescuecd ext2
/dev/sda3 swap
/dev/sda4 / btrfs
I have been looking at some links about this but they aren't Gentoo specific. Any advice would be appreciated.
Thanks. |
|
Back to top |
|
|
fangorn Veteran
Joined: 31 Jul 2004 Posts: 1886
|
Posted: Sun Feb 07, 2010 12:52 pm Post subject: |
|
|
No gentoo specific documentation should be needed.
emerge btrfs-progs
and use the documentation for creating and mounting subvolumes from anywhere you trust.
While installing you might want to choose a live-cd that already has btrfs-progs installed. _________________ Video Encoding scripts collection | Project page |
|
Back to top |
|
|
Veldrin Veteran
Joined: 27 Jul 2004 Posts: 1945 Location: Zurich, Switzerland
|
Posted: Thu Feb 11, 2010 7:54 pm Post subject: |
|
|
I only have experience with btrfs on a single drive, but I will provide my insights....
As good starting point is the btrfs wiki which tells you about how to configure it.
Live Systems
As live environment (also for any rescue and backup operations, i can anything goes wrong) I prefer SystemRescueCD
Creating a btrfs Volume
The basic steps are the following:
- create a btrfs volume (e.g mkfs.btrfs /dev/sda3 )
- mount the volume (e.g mount -t btrfs /dev/sda3 /mnt/btrfs )
- create subvolumes (e.g system and var: btrfsctl -S system /mnt/btrfs && btrfsctl -S var /mnt/btrfs )
Subvolumes are (simply put) just directories within the volume. And you should never mount the "root"volume unless you want to manipulate the subvolumes/snapshots.
- umount the volume (umount /mnt/btrfs )
not necessary, but helps to avoid confusion
- mount the subvolumes (e.g mount -t btrfs /dev/sda3 -o subvol=system/mnt/gentoo && mkdir /mnt/gentoo/var && mount -t btrfs -o subvol=var /dev/sda3 /mnt/gentoo/var )
- fix the root permissions ( e.g chmod 755 /mnt/gentoo )
otherwise only root is able to access the partition, as by default the permission is set to 700
Changes for multidevice setup
There is only one small difference in creating a multidevice setup: (linky)
only the volume creation step need some change. (e.g mkfs.btrfs /dev/sda3 /dev/sdb3 )
As mentioned above, I have not tried this, an I am not sure about its implications. From Reading the documentation, you can specify what kind of raid will be created (0, 1, 10 are currently supported), and how the metadata and journal are used.
There is no changes in how those partitions are mounted.
fstab and grub.conf
moving on with the above example, the would be the fstab entries and grub.conf (irrelevant parts are omitted.)
(var uses the built-in compression)
Code: | /dev/sda3 / btrfs defaults,subvol=gentoo 0 1
/dev/sda3 /var btrfs subvol=var,compression 0 2 |
sda1/hd0,0 is a standard ext2 partition
Code: | title 2.6.32-gentoo3-1g - Man-Eating Seals of Antiquity
kernel (hd0,0)/linux-2.6.32-gentoo3-1g root=/dev/sda3 rootflags=subvol=system |
Fragmentation Issues
I was worried about fragmentation issues, so ToeiRei advised me to run defrag cron job. I created a small script (if you even can call it a script), to to the job - it runs every 3 hours.
Code: | #!/bin/bash
DIRS="/ /var"
for i in $DIRS
do echo "Defragmenting $i"
ionice -n 4 nice btrfsctl -d $i
done;
echo "Defragmenting DONE"
|
cheers
V.
edit: fixed typos
Last edited by Veldrin on Thu Feb 11, 2010 8:03 pm; edited 1 time in total |
|
Back to top |
|
|
Veldrin Veteran
Joined: 27 Jul 2004 Posts: 1945 Location: Zurich, Switzerland
|
Posted: Thu Feb 11, 2010 8:02 pm Post subject: |
|
|
I kind of missed your core questions....
how to create and use subvolumes for /usr/portage/distfiles and /var/tmp
Assuming that your btrfs volume resides on /dev/sda3, and all of the above steps have been done (i.e creating subvols system and var)
Code: | # mount /dev/sda3 /mnt /btrfs
# btrfsctl -S distfiles /mnt/btrfs
# btrfsctl -S tmp /mnt/btrfs
# umount /dev/sda3
# mount /dev/sda3 -o subvol=system /mnt/gentoo
# mount /dev/sda3 -o subvol=var /mnt/gentoo/var
# mkdir /mnt/gentoo/var/tmp
# mount /dev/sda3 -o subvol=tmp /mnt/gentoo/var/tmp
# mkdir /mnt/gentoo/usr/portage/distfiles
# mount /dev/sda3 -o subvol=distfiles /mnt/gentoo/usr/portage/tmp |
cheers
V.
edit: fixed some ugly typo - see my next post!
Last edited by Veldrin on Wed Feb 17, 2010 10:55 pm; edited 1 time in total |
|
Back to top |
|
|
eusanpe Tux's lil' helper
Joined: 06 Sep 2002 Posts: 107
|
Posted: Wed Feb 17, 2010 9:44 pm Post subject: |
|
|
Code: | # mount /dev/sda3 /mnt /btrfs
# btrfsctl -S distfiles /mnt/btrfs
# btrfsctl -S tmp /mnt/btrfs
# umount /dev/sda3
# mount /dev/sda3 -o subvol=system /mnt/gentoo
# mount /dev/sda3 -o subvol=var /mnt/gentoo/var
# mkdir /mnt/gentoo/var/tmp
# mount /dev/sda3 -o subvol=tmp /mnt/gentoo
# mkdir /mnt/gentoo/usr/portage/distfiles
# mount /dev/sda3 -o subvol=distfiles /mnt/gentoo
|
Thank you for all of the advice. I have a question though. In the example that you posted, why would you mount the 'distfiles' subvolume to /mnt/gentoo
instead of /mnt/gentoo/usr/portage/distfiles ?? The same thing with 'tmp'. It is supposed to be mounted to /mnt/gentoo/var/tmp.
Thanks again. |
|
Back to top |
|
|
Veldrin Veteran
Joined: 27 Jul 2004 Posts: 1945 Location: Zurich, Switzerland
|
Posted: Wed Feb 17, 2010 10:53 pm Post subject: |
|
|
Sry - I did too much of copy/paste.
Of course you are right, and the subvol needs to be mouned in the correct place.
*shame on me*
V. |
|
Back to top |
|
|
eusanpe Tux's lil' helper
Joined: 06 Sep 2002 Posts: 107
|
Posted: Wed Feb 17, 2010 11:55 pm Post subject: |
|
|
No problem. This is a great starter. I am running btrfs on one 500 gb drive with one btrfs partition. It runs great so far compared to Reiser4. I have had
no fsync issues. I am going to try this on a new install and see.
Thank you again.
Tony |
|
Back to top |
|
|
eusanpe Tux's lil' helper
Joined: 06 Sep 2002 Posts: 107
|
Posted: Wed Feb 24, 2010 12:07 am Post subject: |
|
|
I set things up and everything installed perfectly except the boot process. I have a Raid0 array setup. When I boot I am getting a kernel panic. If I boot to my rescue disk and run manually
'btrfsctl -a', I can then mount. I have been reading the wiki regarding initramfs but I can't get the busybox init script named 'init'. I am not running genkernel. Can anyone tell me what my busybox
script should look like to boot this raid?
My raid0 partitions are /dev/sda4 and /dev/sdb1. I have the libraries for btrfsctl in a directory called /initramfs/lib, btrfsctl in /initramfs/sbin and busybox compiled with the USE flag 'static''
and the binary copied to /initramfs/bin. I added just 'btrfsctl -a' in the busybox script named 'init' and it runs it but then it panics again. The error is:
Kernel Panic - not syncing: attempted to kill init.
Thanks again,
Tony |
|
Back to top |
|
|
fangorn Veteran
Joined: 31 Jul 2004 Posts: 1886
|
Posted: Thu Feb 25, 2010 1:03 pm Post subject: |
|
|
Veldrin wrote: | Code: | title 2.6.32-gentoo3-1g - Man-Eating Seals of Antiquity
kernel (hd0,0)/linux-2.6.32-gentoo3-1g root=/dev/sda3 rootflags=subvol=system |
|
Have you put this into your grub config (/boot/grub/menu.lst)? If not the kernel will panic.
If you don't use genkernel (aka. build your own specific kernel) you don't need a initramfs at all. Just be sure to include everything that is needed to access the disks (mainly /) into the kernel and not as module. I am using btfs on my laptop and don't even know how to build an initrd _________________ Video Encoding scripts collection | Project page |
|
Back to top |
|
|
eusanpe Tux's lil' helper
Joined: 06 Sep 2002 Posts: 107
|
Posted: Fri Feb 26, 2010 12:46 am Post subject: |
|
|
Thank you for the reply.
I have the same thing in my grub config file. Everywhere I was reading specified that I needed an initrd to setup a raid0 root drive. I will keep on messing with it.
Do you have a raid setup on your laptop using btrfs?
Thanks,
Tony |
|
Back to top |
|
|
fangorn Veteran
Joined: 31 Jul 2004 Posts: 1886
|
|
Back to top |
|
|
aoeuaoue n00b
Joined: 26 Feb 2010 Posts: 31
|
Posted: Fri Feb 26, 2010 11:04 pm Post subject: so far so good |
|
|
just to share my experience
raid0 with three 1tB drives, pretty solid. Make sure that all your drives mach the same throughput or else your hardrives will be limited to the lowest one. I learned this the hard way.
for testing I mounted /usr/portage with compress option, now portage tree is only 167M. Now I wander where else should I try this. |
|
Back to top |
|
|
eusanpe Tux's lil' helper
Joined: 06 Sep 2002 Posts: 107
|
Posted: Sun Feb 28, 2010 7:17 am Post subject: |
|
|
Quote: | just to share my experience
raid0 with three 1tB drives, pretty solid. Make sure that all your drives mach the same throughput or else your hardrives will be limited to the lowest one. I learned this the hard way.
for testing I mounted /usr/portage with compress option, now portage tree is only 167M. Now I wander where else should I try this. |
Do you create an initrd manually or through genkernel? |
|
Back to top |
|
|
|