How. TO: Btrfs Root Installation. How. TO: Btrfs Root Installation. Foreword. Btrfs is a new copy on write file system for Linux aimed at implementing advanced features while focusing on fault tolerance, repair and easy administration. Initially developed by Oracle, Btrfs is licensed under the GPL and open for contribution from anyone. Linux has a wealth of file systems to choose from, but we are facing a number of challenges with scaling to the large storage subsystems that are becoming common in today's data centers. File systems need to scale in their ability to address and manage large storage, and also in their ability to detect, repair and tolerate errors in the data stored on disk. Source: http: //btrfs. The steps and procedures in this guide have been tested on and work with Ubuntu 9. Karmic Koala, and Ubuntu 1. Lucid Lynx. Any other release is not guaranteed to work at all. Please bear in mind that Btrfs is a development file system, as such, you will experience crashes, glitches, and possible loss of data. Installing system with Btrfs, managing root snapshots. Hi, In the near future I would like to install Arch or. mounts the root filesystem? Also the 'btrfs.Do not use it for production use. OK, I think that has scared away most users. Now for those crazy people who remain. You Lucid users know who you are). Updates for Maverick users: Booting into a Btrfs system no longer requires patching of GRUB. So long as you have a separate partition to boot (recommended format ext. As of 2. 6. 3. 4, Btrfs has a new and enhanced utility tool to control and show statistics of the Btrfs partition. It's usage is not covered in this guide. Updates for Natty users: The Ubuntu installer seamlessly allows you to use Btrfs now, and GRUB has full support, meaning it is no longer necessary to have a separate /boot anymore. Part 1: Installation.
By and far, the most simplest method is to convert an already existing installation from Ext. Ext. 4 to Btrfs. Although an installation from scratch probably produces better behaviour and will give you the option for choosing between how the file system is setup - options you cannot change after creation - ie: raid level. . right now the wiki article on Installing on Btrfs root seems quite dated. boot into the arch-subvolume, mount the btrfs-root and delete all the old var, run. Setting up the Base Install. So, what we do is go through the installation process as normal, and when we reach the Partition stage, select the "Advanced" option to specify manually. Separate /boot. First, we create a /boot partition formatted as an ext. OS! 5. 00. MB in size should be sufficient enough. How you go about your business after that doesn't really matter, but you may end up with something like this afterwards. Ensure that you make a note of which file system will be mounted as /, as you will need that info when you convert it. Post Installation. The rest is everything as usual, and once the installation is complete, congratulations, the easy bit is done! Select "Continue Testing" so we can now traverse onto the hard bit. Firstly, edit the sources so that the universe is included in them. This can be done via "System - > Administration - > Software Sources"Reload the sources after closing, and next, open a terminal. Now we can begin on the dirty work. Converting Ext. 4 to Btrfs. The Physical Conversion. As my system was installed on /dev/sda. I'll be specifying in this guide. If yours is different, change the path as needed. In order to convert the file system, we require btrfs- tools to be installed. Code: sudo apt- get install btrfs- tools. The conversion, thankfully, is elementary. Code: sudo btrfs- convert /dev/sda. The not so elementary bit is reconfiguring the boot process to play nice with the file system. First though, we re- mount all file systems as you would expect them to be as if you were booted into it. Code: sudo mount /dev/sda. Now we chroot into the file system. From here on - until we reboot - we will run all commands inside the chroot. Update Fstab. The conversion process creates a new UUID for the partition, as such this requires updating. To obtain the new UUID, run: Make a note, then edit /etc/fstab. I've highlighted the areas of interest that require changing - don't forget to update the file system type too. Before: Code: # / was on /dev/sda. UUID=e. 03cb. 3cc- 8. After: Code: # / was on /dev/sda. UUID=4be. 84d. 08- 9. Hack GRUB2. At this current time of writing, Grub. Btrfs file system - see here why - so we need to make it so Grub. As it turns out Grub. I've written a nice little patch that backports the old grub detection method. All you need to do is install patch, download and setup the correct diversions - so they don't get overwritten if an upgrade were to occur. Code: apt- get install patch. Then open the patch for editing. Code: nano legacy_detection. Before: Code: +++ grub. After: Code: +++ /usr/sbin/grub- mkconfig 2. Once saved, you can apply the patch. Code: patch - p. 0 < legacy_detection. It may give some feedback to you on "Hunk Succeeded", that is all OK. If it were to say "Hunk Failed", then you'd know that the patch didn't apply as expected. Update Initramfs. Next, we hook btrfs into the boot process. It helps if btrfs- tools is installed first. Code: apt- get install btrfs- tools. Now we start creating our files. First, is the hook. Code: nano /usr/share/initramfs- tools/hooks/btrfs. Paste in the following contents and save. Code: #!/bin/sh - e. Second are the modules. Code: nano /usr/share/initramfs- tools/modules. Paste in the following contents and save. Code: # initramfs modules for btrfs. Last is the Premount script. Code: nano /usr/share/initramfs- tools/scripts/local- premount/btrfs. Paste in the following contents and save. Code: #!/bin/sh - e. Then make the following files executable. Code: chmod +x /usr/share/initramfs- tools/scripts/local- premount/btrfs. And to round up the entire process, rebuild the ramdisk and update grub. Code: update- initramfs - u - k all. Et Voila! We can now reboot our system. When you boot up, you can see proof of your new btrfs system as per below! Part 2: Usage. NOTE: If you are running on Karmic. To use some of the commands in this section, it's recommend that you acquire the latest release. And if that isn't enough of an excuse, it's recommended because of the bug fixes too - see here. I already have a repository setup for Karmic with the correct packages inside, feel free to add and install via the following method. Code: sudo add- apt- repository ppa: ibuclaw/ppa. Once rebooted, I recommend running: Before doing anything else. What this does, is a balance operation that reads in all of the FS data and metadata and rewrites it across the file system. As such, it may take some time. OK, with that done, time to try out some of the cool things you can do. Features List. Incremental backup and Writable snapshots. Snapshots are integrated into the file system with no extra work done. This means that you don't need to wait around for hours just for an image to be created, the snapshot acts more like a baseline, and changes to the Live System get written elsewhere on the disk whilst the Snapshot stays static. To create a snapshot of the root subvolume. Code: cd /. sudo btrfsctl - s snapshot. The first argument is the snapshot name, the second is the subvolume you wish to snapshot. The snapshot is created in the directory you are currently residing in. And as an exercise you can try deleting and recovering files on your Desktop. To recover, a simple 'cp - a' should do the trick, but rsync would be the better option. Code: sudo cp - a /snapshot. Desktop ~/Snapshots are writeable, meaning that you can instead change data in the snapshot without affecting the Live System also. This can be useful for example, when you want to have a chroot for compiling, or running certain applications in their own environment. Code: sudo chroot /snapshot. If this is not the behaviour you wish to have, then you can chmod the directory to prevent normal users from tampering it. Code: sudo chmod 7. Lastly, to delete snapshots: Code: sudo btrfsctl - D snapshot. The first argument is the snapshot name, the second is the path of the directory the snapshot resides in. Subvolumes (separate internal file system roots)Unlike snapshots, subvolumes are immutable, meaning that once you create one, it can't be removed unless you reformat the volume. The best use I've found for subvolumes is to apply finer grain snapshots throughout the file system, rather than one great one for /. One example can be the /home directory. In recovery mode, this can be implemented with the following: Code: cd /. S home /Then we set the correct permission for the subvolume (default is 7. Code: chmod 7. 55 /home. Then to create a snapshot: Code: btrfsctl - s snapshot. Compression and other Mount options. Wouldn't recommend trying it yet (although I'm pretty certain I saw a speed increase after enabling it), but feel free to add compress to the fstab file. Code: UUID=4be. 84d. And remount using: Code: sudo mount - o remount /NOTE: The compress option is a type of smart compression, as in it was compress highly compressible files, but back off and blacklist incompressible content. Also, please bare in mind the following caveats: If compression for a given set of pages fails to make them smaller, the file is flagged to avoid future compression attempts later. To get around this, there is 'compress_force' - which will force compression, even at horrendous cost to performance (thank- you jdong). The looking up of the actual size of the compressed file is currently unimplemented. With compression enabled, your system may deadlock all IO operations if under heavy read/write duty. See here for more supported options: http: //btrfs. Mount_Options. Integrated multiple device support. Another cool feature is the ability to have a file system that spans two, or more partitions or devices. If possible, try this nice exercise to see the before and after of the size of /Code: df - h /. And it should have increased! To balance the load between the devices: By default, meta data will be mirrored across two devices and file system data will be striped across all of the devices present. Removing devices uses the same logic. Code: sudo btrfs- vol - r /dev/sdb /. And notice that the size of / has now shrunk again.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
October 2016
Categories |