How to Install Oracle Linux 6.3 with a Btrfs Root File System

by Alvaro Miranda

This article is a step-by-step guide for installing Oracle Linux 6.3 with a Btrfs root file system on an Oracle VM guest.


Published February 2013

Download the Oracle Linux 6.3 ISO File
Share the Installation Media
Create a New Oracle VM Guest
Perform an Interactive Installation
Perform an Installation with a Kickstart File
Take an Automatic Snapshot with Btrfs
Appendix
See Also
About the Author
About UXC Red Rock Consulting

Want technical articles like this one delivered to your inbox?  Subscribe to the Systems Community Newsletter—only technical content for sysadmins and developers.

This article provides instructions for installing Oracle Linux 6.3 with a Btrfs root file system on an Oracle VM guest. The first install will be interactive. The second install will be unattended using a simple kickstart file.

Download the Oracle Linux 6.3 ISO File

Go to Software Delivery Cloud (requires login) and then do the following:

  • Download the Oracle Linux Release 6 Update 3 DVD image.
  • Download the Oracle Linux Release 6 Update 3 Unbreakable Enterprise Kernel boot ISO image.

In this guide, we will use x86_64 (64 bit) as the desired architecture, as shown in Figure 1.

Note: The Appendix contains more information about various ways you can download Oracle Linux ISO files.

Figure 1

Figure 1

Share the Installation Media

Create an install source by copying the contents of the Oracle Linux Release 6 Update 3 DVD image to a location that is accessible by HTTP.

To do this, you can execute the following commands as root:

# mkdir -p /var/www/html/path
# mount -o loop,ro /path_to_the_iso /media
# rsync -av /media/ /var/www/html/path
# umount /media

Now mount the Oracle Linux Release 6 Update 3 Unbreakable Enterprise Kernel boot ISO image, and replace the contents of the images directory.

# mount -o loop,ro /path_to_the_iso /media
# rm -fr /var/www/html/path/images
# rsync -av /media/images/ /var/www/html/path/images

Create a New Oracle VM Guest

Using Oracle VM, create a new virtual machine (VM), as shown in Figure 2, by right-clicking the server pool and selecting Create Virtual Machine.

Figure 2

Figure 2

Set the properties of the virtual guest, as shown in Figure 3. In this example, we have a repository for the virtual guest called repo00 with 768 MB of RAM, Oracle Linux 6 as the OS, and a domain type of Xen PVM (paravirtualized).

Figure 3

Figure 3

Set the disk for the virtual guest, as shown in Figure 4. In this example, we will use a physical disk called ssd4.

Figure 4

Figure 4

Select Network for the boot options for the install, as shown in Figure 5. In this example, because the virtual guest is PVM, we will perform the installation by HTTP.

For the Network Boot Path, specify the URL to the Oracle Linux Release 6 Update 3 DVD image that you shared in the "Share the Installation Media" section.

Figure 5

Figure 5

Perform an Interactive Installation

We will do the first installation interactively to have a look at the new options.

Start the virtual guest and take the control of the remote console. This can be done by right-clicking the virtual machine and selecting Launch Console, as shown in Figure 6.

Figure 6

Figure 6

Select the language for the installation, as shown in Figure 7. In this example, the language is English.

Figure 7

Figure 7

Select the keyboard type, as shown in Figure 8. In this example, the type is US.

Figure 8

Figure 8

Select the installation method, as shown in Figure 9. In this example, the installation method is URL.

Figure 9

Figure 9

Configure the TCP/IP options, as shown in Figure 10. In this example, we enable IPv4 with DHCP and leave IPv6 disabled.

Figure 10

Figure 10

Enter the URL for the Oracle Linux Release 6 Update 3 DVD image, as shown in Figure 11, and then click OK. In this example, the URL is http://zfs/stuff/ol63.

Figure 11

Figure 11

The installation starts, as shown in Figure 12. Click Next.

Figure 12

Figure 12

Select the type of storage devices, as shown in Figure 13. For this example, select Basic Storage Devices.

Figure 13

Figure 13

Select the nearest city in your time zone and review the selections for time zone and the system clock, as shown in Figure 14. In this example, Auckland, Pacific/Auckland, and UTC are selected.

Figure 14

Figure 14

Enter a password for the root user, as shown in Figure 15.

Figure 15

Figure 15

Select the desired partition layout schema, as shown in Figure 16. For this example, select Create Custom Layout.

Figure 16

Figure 16

The list of available devices is shown, as shown in Figure 17. In this example, select xvda, and click Create.

Figure 17

Figure 17

Select Standard Partition, as shown in Figure 18.

Figure 18

Figure 18

Create a boot partition to hold the kernel, as shown in Figure 19, by making the following selections:

  • Mount Point: /boot
  • File System Type: ext4
  • Size (MB): 200
Figure 19

Figure 19

Add a new partition for the operating system, as shown in Figure 20. In this example, we will define our Btrfs file system to hold the operating system, by making the following selections:

  • Mount Point: /
  • File System Type: btrfs
  • Size (MB): 6000
Figure 20

Figure 20

Add a new partition for the swap area, a special device that acts as a secondary memory in disk to free up memory from RAM, as shown in Figure 21. In this example, we set a minimal swap area by making the following selections:

  • File System Type: swap
  • Size (MB): Fill to maximum allowable size
Figure 21

Figure 21

The layout is shown for confirmation, as shown in Figure 22. Review the layout and then click Next.

Figure 22

Figure 22

A warning is shown to confirm proceeding with the creation of partitions and formatting, as shown in Figure 23. Click Write changes to disk.

Figure 23

Figure 23

A window is shown for the boot options, as shown in Figure 24. For this example, accept the default options, and click Next.

Figure 24

Figure 24

A new window is shown to allow you to select different software or add an additional software repository, as shown in Figure 25. For this example, accept the default options, and click Next.

Figure 25

Figure 25

The installation begins, as shown in Figure 26.

Figure 26

Figure 26

Once the installation is finished, a congratulation window is shown, as shown in Figure 27.

Figure 27

Figure 27

In this installation, because the virtual guest is configured to boot and install the OS using the Oracle VM Manager, we need to shut down the virtual guest and configure the boot option to boot from disk. To do this, go to Oracle VM Manager, right-click the virtual machine, and select Stop, as shown in Figure 28.

Figure 28

Figure 28

A confirmation window is shown. Click OK.

Figure 29

Figure 29

Right-click the virtual machine and select Edit.

Figure 30

Figure 30

The next change is required to allow the virtual guest to boot from the disk. Select the Boot Order tab. Then remove Network from the Boot Order panel and add Disk to the Boot Order panel.

Figure 31

Figure 31

Now, power on the virtual guest and review the root file system, as shown in Figure 32.

Figure 32

Figure 32

Perform an Installation with a Kickstart File

A kickstart file is a file that contains answers for the Oracle Linux installer. It allows you perform an unattended installation. On a newly installed Linux machine, the file /root/anaconda-ks.cfg is a kickstart file, and it contains the options that were used to install that machine.

Using the anaconda-ks.cfg file, or executing system-config-kickstart, is a simple starting point for creating complex and sophisticated kickstart files. Using any text editor, you can modify and personalize a kickstart file.

The installer allows you to pass the kickstart file from the installation media, a hard drive, remote HHTP, FTP, or NFS. Test what works best for you.

For this next installation, we will use the following options:

  • 20 GB LUN for the virtual machine
  • HTTP kickstart file that is parsed from a CGI script
  • A file system layout that has the following characteristics: a /boot mount point that is 200 MB and is of file system type ext4
  • A swap mount point that is 2000 MB
  • A root (/) mount point that is 200 MB and can grow to the maximum allowable size

To keep the install simple, we will use a kickstart CGI script that takes an argument from the URL that is the host name.

The installation performed by this kickstart file will leave the virtual guest machine in a shut-down state. Afterwards, you need to set the boot order to Disk. Otherwise, the machine will reboot and reinstall again.

See the Appendix for my kickstart CGI script; you can adapt it to take more arguments than just the hostname argument.

To use the kickstart file, do the following.

In this example, we will reuse the guest virtual machine. Select a new physical disk, as shown in Figure 33.

Figure 33

Figure 33

Set the boot order to Network, as shown in Figure 34, and pass an argument to the script by typing the following into the Network Boot Path field.

--args ks=http://zfs/cgi-bin/ks.sh?hostname=server1 http://zfs/stuff/ol63

Figure 34

Figure 34

Start the virtual machine. Take control of the remote console and watch what happens.

Note: If you want to see a video of what an unattended install looks like, use this link: http://youtu.be/wmzm9GU9E2c.

Once the installation is finished, the guest will shut down, as shown in Figure 35.

Figure 35

Figure 35

Edit the boot order to set the default to Disk, and then start the machine.

Figure 36

Figure 36

Now, you can check that the file system's size and the host name are as expected, as shown in Figure 37 and Figure 38.

Figure 37

Figure 37

Figure 38

Figure 38

Take an Automatic Snapshot with Btrfs

Now that our system has a root file system with Btrfs, we can benefit from features such as the snapshot capability.

Let's update the server using public-yum.orcle.com, as follows:

  1. Configure the server to use public-yum.oracle.com:

    cd /etc/yum.repos.d
    wget http://public-yum.oracle.com/public-yum-ol6.repo
    
  2. Install the yum snapshot plug-in:

    yum install yum-plugin-fs-snapshot
    
  3. Review existing subvolumes or snapshotting:

    btrfs subvolume list /
    
  4. Update the server:

    yum update
    

Note: The output shown in Listing 1 shows running yum -y update, which will answer yes to any question. The output has been truncated to focus on the automatic snapshot capability. The complete output can be found in the Appendix.

[root@server1 ~]# btrfs subvolume list /
ID 259 top level 5 path install

[root@server1 ~]# yum -y update
Loaded plugins: fs-snapshot, security
ol6_latest/primary       |  21 MB     04:06     
ol6_latest      17941/17941
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package bind-libs.x86_64 32:9.8.2-0.10.rc1.el6_3.3 will be updated
..
Upgrade  8 Package(s)

Total download size: 2.1 M
Downloading Packages:
(1/8): bind-libs-9.8.2-0.10.rc1.el6_3.4.x86_64.rpm     | 870 kB     00:00     
..
Running Transaction
fs-snapshot: snapshotting /: /yum_20121006234515
  Updating   : dracut-004-284.0.1.el6_3.1.noarch     1/16
  ...

Updated:
  bind-libs.x86_64 32:9.8.2-0.10.rc1.el6_3.4     bind-utils.x86_64 32:9.8.2-0.10.rc1.el6_3.4     
  dracut.noarch 0:004-284.0.1.el6_3.1  dracut-kernel.noarch 0:004-284.0.1.el6_3.1
  strace.x86_64 0:4.5.19-1.11.el6_3.2  systemtap-runtime.x86_64 0:1.7-5.0.1.el6_3.1    
  tzdata.noarch 0:2012f-1.el6     tzdata-java.noarch 0:2012f-1.el6

Complete!
[root@server1 ~]# btrfs subvolume list /
ID 259 top level 5 path install
ID 261 top level 5 path install/yum_20121006234515
[root@server1 ~]#

Listing 1

In case anything goes wrong, you have options. Figure 39 shows some information from the Btrfs wiki, which explains how to do rollbacks with Btrfs.

Figure 39

Figure 39

Appendix

Where You Can Download Oracle Linux ISO Images

Oracle Linux can be freely downloaded and distributed, as explained in the Oracle Linux wiki.

Oracle provides ISO images of the installation media as well as individual RPM packages (including errata and updates) via the Oracle Public Yum repository.

The primary and official resource for getting Oracle Linux (and Oracle VM Server) ISO images is the Oracle Software Delivery Cloud (formerly known as E-Delivery), which requires registration.

Oracle Linux is also listed on DistroWatch.com and Linux Questions.org.

Sample Kickstart CGI Script That Accepts Variables

Table 1 shows an example of a Linux CGI script that accepts variables on the right and an equivalent script for Oracle Solaris on the left. The Linux version is a standard bash script and has been tested on Oracle Linux 5 and Oracle Linux 6.

Table 1
Oracle Solaris Script Linux Script
#!/usr/bin/bash
##
##
saveIFS=$IFS
IFS='=&'
parm=($QUERY_STRING)
IFS=$saveIFS

#the next part converts the arguments into 
#variables like var_hostname

for ((i=0; i<${#parm[@]}; i+=2))
do
    declare var_${parm[i]}=${parm[i+1]}
done

#check var_hostname, set an initial value to 
#variable var_hostname if empty

[ "$var_hostname" ] || var_hostname=localhost

echo Content-type: text/plain
echo ""

/usr/bin/cat << EOM
hostname $var_hostname
EOM
#!/bin/bash
##
##
saveIFS=$IFS
IFS='=&'
parm=($QUERY_STRING)
IFS=$saveIFS

#the next part converts the arguments into 
#variables like var_hostname

for ((i=0; i<${#parm[@]}; i+=2))
do
    declare var_${parm[i]}=${parm[i+1]}
done

#check var_hostname, set an initial value to 
#variable var_hostname if empty

[ "$var_hostname" ] || var_hostname=localhost

echo Content-type: text/plain
echo ""

/bin/cat << EOM
hostname $var_hostname
EOM

Sample Kickstart CGI Script That Accepts a Host Name from a URL

Listing 2 shows an example kickstart CGI script for Linux that will accept a host name from a URL. For Oracle Solaris, instead use #!/usr/bin/bash on the first line.

#!/bin/bash
##
saveIFS=$IFS
IFS='=&'
parm=($QUERY_STRING)
IFS=$saveIFS
for ((i=0; i<${#parm[@]}; i+=2))
do
    declare var_${parm[i]}=${parm[i+1]}
done

[ "$var_hostname" ] || var_hostname=localhost

echo Content-type: text/plain
echo ""

/bin/cat << EOM
# Kickstart file automatically generated by anaconda.

install
poweroff
url --url=http://zfs/stuff/ol63
lang en_US.UTF-8
keyboard us
#network --onboot yes --device eth0 --bootproto dhcp --noipv6
network --hostname=$var_hostname --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw  --iscrypted <crypted_password_goes_here>
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone --utc Pacific/Auckland
bootloader --location=mbr --driveorder=xvda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
#clearpart --none
zerombr
clearpart --all --drives=xvda

part /boot --fstype=ext4 --size=200
part / --fstype=btrfs --grow --size=200
part swap --size=2000

repo --name="UEK2 kernel repo"  --baseurl=http://zfs/stuff/ol63/UEK2/ --cost=1000
repo --name="ol6_latest"  --baseurl=http://zfs/stuff/ol6_latest --cost=1000

#we added 2 packages at the end of the %packages section
#oracle-rdbms-server-11gR2-preinstall
#all dependencies and parameters for Oracle databases
#yum-plugin-fs-snapshot
#to automatically take snapshots when we update or install new packages

%packages
@base
@client-mgmt-tools
@console-internet
@core
@debugging
@directory-client
@hardware-monitoring
@java-platform
@large-systems
@network-file-system-client
@performance
@perl-runtime
@server-platform
@server-policy
pax
python-dmidecode
oddjob
sgpio
certmonger
pam_krb5
krb5-workstation
perl-DBD-SQLite
btrfs-progs
oracle-rdbms-server-11gR2-preinstall
yum-plugin-fs-snapshot
%end

EOM

Listing 2

Figure 40 shows the output from running the script shown in Listing 2.

Figure 40

Figure 40

Full Output for yum Update with Automatic Snapshot

Listing 3 shows an example of the full output that is generated when doing an automatic snapshot.

[root@server1 ~]# btrfs subvolume list /
ID 259 top level 5 path install
[root@server1 ~]# yum -y update
Loaded plugins: fs-snapshot, security
ol6_latest/primary       |  21 MB     04:06     
ol6_latest      17941/17941
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package bind-libs.x86_64 32:9.8.2-0.10.rc1.el6_3.3 will be updated
---> Package bind-libs.x86_64 32:9.8.2-0.10.rc1.el6_3.4 will be an update
---> Package bind-utils.x86_64 32:9.8.2-0.10.rc1.el6_3.3 will be updated
---> Package bind-utils.x86_64 32:9.8.2-0.10.rc1.el6_3.4 will be an update
---> Package dracut.noarch 0:004-284.0.1.el6_3 will be updated
---> Package dracut.noarch 0:004-284.0.1.el6_3.1 will be an update
---> Package dracut-kernel.noarch 0:004-284.0.1.el6_3 will be updated
---> Package dracut-kernel.noarch 0:004-284.0.1.el6_3.1 will be an update
---> Package strace.x86_64 0:4.5.19-1.11.el6_2.1 will be updated
---> Package strace.x86_64 0:4.5.19-1.11.el6_3.2 will be an update
---> Package systemtap-runtime.x86_64 0:1.7-5.0.1.el6 will be updated
---> Package systemtap-runtime.x86_64 0:1.7-5.0.1.el6_3.1 will be an update
---> Package tzdata.noarch 0:2012c-3.el6 will be updated
---> Package tzdata.noarch 0:2012f-1.el6 will be an update
---> Package tzdata-java.noarch 0:2012c-3.el6 will be updated
---> Package tzdata-java.noarch 0:2012f-1.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================
 Package     Arch  Version Repository Size
==========================================================
Updating:
 bind-libs         x86_64   32:9.8.2-0.10.rc1.el6_3.4   ol6_latest  870 k
 bind-utils        x86_64   32:9.8.2-0.10.rc1.el6_3.4   ol6_latest  181 k
 dracut            noarch   004-284.0.1.el6_3.1         ol6_latest  112 k
 dracut-kernel     noarch   004-284.0.1.el6_3.1         ol6_latest  21 k
 strace            x86_64   4.5.19-1.11.el6_3.2         ol6_latest  171 k
 systemtap-runtime x86_64   1.7-5.0.1.el6_3.1           ol6_latest  166 k
 tzdata            noarch   2012f-1.el6                 ol6_latest  449 k
 tzdata-java       noarch   2012f-1.el6                 ol6_latest  154 k

Transaction Summary
==========================================================
Upgrade  8 Package(s)

Total download size: 2.1 M
Downloading Packages:
(1/8): bind-libs-9.8.2-0.10.rc1.el6_3.4.x86_64.rpm     | 870 kB     00:00     
(2/8): bind-utils-9.8.2-0.10.rc1.el6_3.4.x86_64.rpm    | 181 kB     00:00     
(3/8): dracut-004-284.0.1.el6_3.1.noarch.rpm           | 112 kB     00:00     
(4/8): dracut-kernel-004-284.0.1.el6_3.1.noarch.rpm    |  21 kB     00:00     
(5/8): strace-4.5.19-1.11.el6_3.2.x86_64.rpm           | 171 kB     00:00     
(6/8): systemtap-runtime-1.7-5.0.1.el6_3.1.x86_64.rpm  | 166 kB     00:00     
(7/8): tzdata-2012f-1.el6.noarch.rpm                   | 449 kB     00:00     
(8/8): tzdata-java-2012f-1.el6.noarch.rpm              | 154 kB     00:00     
---------------------------------------------------------------------------------
Total                      1.4 MB/s | 2.1 MB     00:01     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Retrieving key from http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
Importing GPG key 0xEC551F03:
 Userid: "Oracle OSS group (Open Source Software group) <build@oss.oracle.com>"
 From  : http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
fs-snapshot: snapshotting /: /yum_20121006234515
  Updating   : dracut-004-284.0.1.el6_3.1.noarch               1/16
  Updating   : 32:bind-libs-9.8.2-0.10.rc1.el6_3.4.x86_64      2/16
  Updating   : 32:bind-utils-9.8.2-0.10.rc1.el6_3.4.x86_64     3/16
  Updating   : dracut-kernel-004-284.0.1.el6_3.1.noarch        4/16
  Updating   : systemtap-runtime-1.7-5.0.1.el6_3.1.x86_64      5/16
  Updating   : tzdata-java-2012f-1.el6.noarch                  6/16
  Updating   : strace-4.5.19-1.11.el6_3.2.x86_64               7/16
  Updating   : tzdata-2012f-1.el6.noarch                       8/16
  Cleanup    : dracut-kernel-004-284.0.1.el6_3.noarch          9/16
  Cleanup    : dracut-004-284.0.1.el6_3.noarch                10/16
  Cleanup    : tzdata-java-2012c-3.el6.noarch                 11/16
  Cleanup    : tzdata-2012c-3.el6.noarch                      12/16
  Cleanup    : 32:bind-utils-9.8.2-0.10.rc1.el6_3.3.x86_64    13/16
  Cleanup    : 32:bind-libs-9.8.2-0.10.rc1.el6_3.3.x86_64     14/16
  Cleanup    : systemtap-runtime-1.7-5.0.1.el6.x86_64         15/16
  Cleanup    : strace-4.5.19-1.11.el6_2.1.x86_64              16/16
  Verifying  : tzdata-2012f-1.el6.noarch                       1/16
  Verifying  : dracut-kernel-004-284.0.1.el6_3.1.noarch        2/16
  Verifying  : 32:bind-libs-9.8.2-0.10.rc1.el6_3.4.x86_64      3/16
  Verifying  : strace-4.5.19-1.11.el6_3.2.x86_64               4/16
  Verifying  : 32:bind-utils-9.8.2-0.10.rc1.el6_3.4.x86_64     5/16
  Verifying  : dracut-004-284.0.1.el6_3.1.noarch               6/16
  Verifying  : tzdata-java-2012f-1.el6.noarch                  7/16
  Verifying  : systemtap-runtime-1.7-5.0.1.el6_3.1.x86_64      8/16
  Verifying  : strace-4.5.19-1.11.el6_2.1.x86_64               9/16
  Verifying  : 32:bind-libs-9.8.2-0.10.rc1.el6_3.3.x86_64     10/16
  Verifying  : dracut-004-284.0.1.el6_3.noarch                11/16
  Verifying  : 32:bind-utils-9.8.2-0.10.rc1.el6_3.3.x86_64    12/16
  Verifying  : dracut-kernel-004-284.0.1.el6_3.noarch         13/16
  Verifying  : systemtap-runtime-1.7-5.0.1.el6.x86_64         14/16
  Verifying  : tzdata-2012c-3.el6.noarch                      15/16
  Verifying  : tzdata-java-2012c-3.el6.noarch                 16/16

Updated:
  bind-libs.x86_64 32:9.8.2-0.10.rc1.el6_3.4  bind-utils.x86_64 32:9.8.2-0.10.rc1.el6_3.4     
  dracut.noarch 0:004-284.0.1.el6_3.1  dracut-kernel.noarch 0:004-284.0.1.el6_3.1
  strace.x86_64 0:4.5.19-1.11.el6_3.2  systemtap-runtime.x86_64 0:1.7-5.0.1.el6_3.1
  tzdata.noarch 0:2012f-1.el6     tzdata-java.noarch 0:2012f-1.el6

Complete!
[root@server1 ~]# btrfs subvolume list /
ID 259 top level 5 path install
ID 261 top level 5 path install/yum_20121006234515
[root@server1 ~]#

Listing 3

See Also

About the Author

Alvaro Miranda is a Senior Consultant DBA at UXC Red Rock Consulting New Zealand, specializing in Linux, Oracle VM, Oracle E-Business Suite, and engineering systems. Prior to Red Rock, he worked at Oracle Chile as a Support Engineer for Oracle E-Business Suite and at Experian Services as a UNIX consultant for the global single-instance Oracle E-Business Suite migration project.

About UXC Red Rock Consulting

UXC Red Rock Consulting is the largest independent provider of Oracle consulting and managed services in Australia and New Zealand. Established in 1998, it provides a complete service continuum around the Oracle stack.

Revision 1.0, 02/21/2013

facebook banner twitter banner