The Btrfs Filesystem
Total Page:16
File Type:pdf, Size:1020Kb
The New Btrfs Filesystem for Linux: Features and Tools Lab Novell Training Services www.novell.com SUS18 ATT LIVE 2012 LAS VEGAS Novell, Inc. Copyright 2012-ATT LIVE-1-HARDCOPY PERMITTED. NO OTHER PRINTING, COPYING, OR DISTRIBUTION ALLOWED. Legal Notices Novell, Inc., makes no representations or warranties with respect to the contents or use of this documentation, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. Further, Novell, Inc., reserves the right to revise this publication and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. Further, Novell, Inc., makes no representations or warranties with respect to any software, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. Further, Novell, Inc., reserves the right to make changes to any and all parts of Novell software, at any time, without any obligation to notify any person or entity of such changes. Any products or technical information provided under this Agreement may be subject to U.S. export controls and the trade laws of other countries. You agree to comply with all export control regulations and to obtain any required licenses or classification to export, re-export or import deliverables. You agree not to export or re-export to entities on the current U.S. export exclusion lists or to any embargoed or terrorist countries as specified in the U.S. export laws. You agree to not use deliverables for prohibited nuclear, missile, or chemical biological weaponry end uses. See the Novell International Trade Services Web page (http://www.novell.com/info/exports/) for more information on exporting Novell software. Novell assumes no responsibility for your failure to obtain any necessary export approvals. Copyright © 2009 Novell, Inc. All rights reserved. No part of this publication may be reproduced, photocopied, stored on a retrieval system, or transmitted without the express written consent of the publisher. Novell, Inc., has intellectual property rights relating to technology embodied in the product that is described in this document. In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed on the Novell Legal Patents Web page (http://www.novell.com/company/legal/patents/) and one or more additional patents or pending patent applications in the U.S. and in other countries. Novell, Inc. 404 Wyman Street, Suite 500 Waltham, MA 02451 U.S.A. www.novell.com Online Documentation: To access the latest online documentation for this and other Novell products, see the Novell Documentation Web page (http:// www.novell.com/documentation). Novell Trademarks For Novell trademarks, see the Novell Trademark and Service Mark list (http://www.novell.com/company/legal/trademarks/tmlist.html). Third-Party Materials All third-party trademarks are the property of their respective owners. 2 Copying all or part of this manual, or distributing such copies, is strictly prohibited. Version 1 To report suspected copying, please call 1-800-PIRATES. Novell, Inc. Copyright 2012-ATT LIVE-1-HARDCOPY PERMITTED. NO OTHER PRINTING, COPYING, OR DISTRIBUTION ALLOWED. Contents Section 1 The Btrfs Filesystem.................................................................5 Exercise 1.1 LAB 5-1: Install and Configure Btrfs..........................................................................6 Task I: Install the BtrFS RPM Package.........................................................................................6 Task II: Format an Empty Virtual Disk with BtrFS.......................................................................7 Exercise 1.2 LAB 5-2: Create a New Btrfs Subvolume and a Snapshot Subvolume..................9 Task I: Create a Subvolume...........................................................................................................9 Task II: Snapshot the New Subvolume..........................................................................................9 Exercise 1.3 LAB 5-3: Convert an Existing Directory into a Subvolume...................................11 Task I: Convert a Directory into a Subvolume............................................................................11 Exercise 1.4 LAB 5-4: Perform an In-place Upgrade of an ext3 File System to Btrfs...............12 Task I: Convert the File System...................................................................................................12 Task II: Test the Converted File System......................................................................................12 Exercise 1.5 LAB 5-5: Configure Snapper to Manage a New Subvolume..................................14 Task I: Create a New Snapper Configuration File.......................................................................14 Task II: Create a Snapper Snapshot of /home..............................................................................14 Exercise 1.6 LAB 5-6: Use the Snapper YaST Module to Restore Files From a Snapshot......15 Task I: Restore a File From a Snapshot.......................................................................................15 Version 1 Copying all or part of this manual, or distributing such copies, is strictly 3 prohibited. To report suspected copying, please call 1-800-PIRATES Novell, Inc. Copyright 2012-ATT LIVE-1-HARDCOPY PERMITTED. NO OTHER PRINTING, COPYING, OR DISTRIBUTION ALLOWED. The Btrfs Filesystem List of Figures 4 Copying all or part of this manual, or distributing such copies, is strictly prohibited. Version 1 To report suspected copying, please call 1-800-PIRATES Novell, Inc. Copyright 2012-ATT LIVE-1-HARDCOPY PERMITTED. NO OTHER PRINTING, COPYING, OR DISTRIBUTION ALLOWED. The Btrfs Filesystem Section 1 The Btrfs Filesystem In this section you install, configure and work with Btrfs filesystem technologies and tools. Version 1 Copying all or part of this manual, or distributing such copies, is strictly 5 prohibited. To report suspected copying, please call 1-800-PIRATES Novell, Inc. Copyright 2012-ATT LIVE-1-HARDCOPY PERMITTED. NO OTHER PRINTING, COPYING, OR DISTRIBUTION ALLOWED. The Btrfs Filesystem 1.1 LAB 5-1: Install and Configure Btrfs In this exercise, you install btrfsprogs on your machine and format an empty virtual disk with BtrFS using YaST. Objectives: Task I: Install the BtrFS RPM Package Task II: Format an Empty Virtual Disk with BtrFS Task I: Install the BtrFS RPM Package In this task, you install the BtrFS RPM packages from a pre-connected zypper software source. NOTE: You may copy and paste complex commands from the electronic copy, if it is available on geeko's desktop. Ask the instructor to blast it out there if it's not already available. It only takes a second and he'd be happy to do it. 1. In VMware, if it is not already running, browse to the .vmx file of the btrfs_1 VM and start the VM. 2. Here is the path: /vms/brandon/btrfs_1/btrfs_1.vmx The instructor may have already started the VM for your convenience. 3. Log into btrfs1 (hostname of the btrfs_1 VM) as the geeko user, password novell. 4. Open a terminal prompt by right-clicking on the Desktop and selecting Open in Terminal in the pop-up menu. 5. To get root permission, enter su – and password novell. The virtual cdrom for this VM has been configured to point to the /tmp/sles_11_2_vmw.iso file to use as a virtual CD. 6. At the open command prompt, enter the following command to add the cd as an installation software repository: zypper ar cd:///?devices=/dev/sr0 sles11sp2 If it throws an error about already being entered, just ignore it. 7. Start the installation of the btrfsprogs package: zypper in btrfsprogs 8. Notice the following packages required by btrfsprogs: 6 Copying all or part of this manual, or distributing such copies, is strictly prohibited. Version 1 To report suspected copying, please call 1-800-PIRATES Novell, Inc. Copyright 2012-ATT LIVE-1-HARDCOPY PERMITTED. NO OTHER PRINTING, COPYING, OR DISTRIBUTION ALLOWED. The Btrfs Filesystem btrfsprogs libsnapper snapper snapper zypp-plugin-python 9. Complete the installation. Software installation requires you to be logged in as the root user. 10. Use this terminal window for later the next task. Task II: Format an Empty Virtual Disk with BtrFS In this task, you format an empty virtual disk with btrfs file system. 1. Bring up the terminal prompt from the previous task. 2. Launch yast disk partitioning: yast2 disk 3. In the warning dialog,, select Yes. 4. in the System View, expand the Hard Disks item 5. Select sdb in the System view and click Add to add a new partition. 6. Make sure Primary Partition is selected; then click Next. 7. To use the whole space that is available on the new hard disk for the new partition, select Maximum Size; then click Next. 8. Under Formatting Options, select BtrFS from the File System pull-down menu. 9. Activate Mount partition and enter /lab1 in the Mount Point text box; then click Finish. 10. In the Expert Partitioner dialog click Next. 11. In the Summary dialog click Finish. 12. Open the terminal window and enter mount as root to see whether the partition was created successfully. There should appear a line like the following in the output: /dev/sdb1 on /lab1 type btrfs (rw) In this exercise, you installed the btrfsprogs and associated packages (using the zypper command) needed for btrfs support and formatted an empty (virtual) hard disk with btrfs file