July 9th, 2014 | Tags: , ,

Today we are going to go through the process of splitting a zpool.  This is not something that you will do often, but when you do it, you must be very precise and do it properly.

Create Our Test Zpool

First we will create a ZFS to hold our disk images.

# zfs create rpool/testdisks

Next we will create the disk images.

# mkfile 1g /rpool/testdisks/disk0
# mkfile 1g /rpool/testdisks/disk1
# mkfile 1g /rpool/testdisks/disk2
# mkfile 1g /rpool/testdisks/disk3

Finally we will create our zpool, which in this case is tank.

# zpool create tank mirror /rpool/testdisks/disk0 /rpool/testdisks/disk1

Examine Our Zpool

Lets take a look at our zpool.

# zpool status

pool: tank
state: ONLINE
scan: none requested
config:

NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
/rpool/testdisks/disk0 ONLINE 0 0 0
/rpool/testdisks/disk1 ONLINE 0 0 0

Lets also check the guid, this is the identifier of the zpool, this must be unique on the system.

# zpool get guid tank
NAME PROPERTY VALUE SOURCE
tank guid 1170921204903719619 -

Expand Our Zpool

This step isn’t required, however I feel it is more illustrative of what we are doing if we have a larger pool.

# zpool add tank mirror /rpool/testdisks/disk2 /rpool/testdisks/disk3

Review the differences in the pool, since adding additional disks, notice we still have redundancy.

# zpool status tank
pool: tank
state: ONLINE
scan: none requested
config:

NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
/rpool/testdisks/disk0 ONLINE 0 0 0
/rpool/testdisks/disk1 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
/rpool/testdisks/disk2 ONLINE 0 0 0
/rpool/testdisks/disk3 ONLINE 0 0 0

errors: No known data errors

Split the Zpool

Now we will split the pool.

# zpool split tank tank2 /rpool/testdisks/disk1 /rpool/testdisks/disk3

Import the Second Zpool

Since we used the split command we are able to import the second pool as it now has a different guid.

# zpool import -d /rpool/testdisks/
pool: tank2
id: 2770700438906871327
state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:

tank2 ONLINE
/rpool/testdisks/disk1 ONLINE
/rpool/testdisks/disk3 ONLINE
# zpool import -d /rpool/testdisks/ tank2

Compare the Guids of the Zpools

Lets confirm that the GUIDs are in fact different.

# zpool get guid tank
NAME PROPERTY VALUE SOURCE
tank guid 1170921204903719619 -
# # zpool get guid tank2
NAME PROPERTY VALUE SOURCE
tank2 guid 2770700438906871327 -

There you go those are definitely different.

July 8th, 2014 | Tags: , ,

I ran into a painful issue on Fedora 20 with SQL Developer.  Basically every time it was launched via the shortcut it would go through loading, and then disappear.

Manual Invocation of SQL Developer

When launching it via the script itself it gives us a little more information.

$ /opt/sqldeveloper/sqldeveloper.sh

Oracle SQL Developer
Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.

 

LOAD TIME : 279#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00000038a1e64910, pid=12726, tid=140449865832192
#
# JRE version: Java(TM) SE Runtime Environment (7.0_40-b43) (build 1.7.0_40-b43)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.0-b56 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C 0x00000038a1e64910
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /opt/sqldeveloper/sqldeveloper/bin/hs_err_pid12726.log
[thread 140449881597696 also had an error]
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
#
/opt/sqldeveloper/sqldeveloper/bin/../../ide/bin/launcher.sh: line 611: 12726 Aborted (core dumped) ${JAVA} "${APP_VM_OPTS[@]}" ${APP_ENV_VARS} -classpath ${APP_CLASSPATH} ${APP_MAIN_CLASS} "${APP_APP_OPTS[@]}"

I also noticed, that while executing as root it worked.  However that clearly isn’t the “solution”

Fixing the Problem

Here we need to remove the GNOME_DESKTOP_SESSION_ID as part of the script.

$ cat /opt/sqldeveloper/sqldeveloper.sh
#!/bin/bash
unset -v GNOME_DESKTOP_SESSION_ID
cd "`dirname $0`"/sqldeveloper/bin && bash sqldeveloper $*

Once this was completed, SQL Developer launched clean for me.

July 7th, 2014 | Tags: , , ,

Today we are going to go through the process of installing MySQL Server Community Edition on Fedora 20.  You could of course simply use MariaDB, but this will focus on the Community Edition.

Install the MySQL Repository

We will need to install the MySQL Community Repository, the MySQL project hosts an RPM file with the repository.  First lets look at the repositories that I have already.

# yum repolist
Loaded plugins: langpacks, refresh-packagekit
repo id repo name status
adobe-flashplayer Adobe Flash Player - x86_64 2
fedora/20/x86_64 Fedora 20 - x86_64 38,597
google-chrome Google Chrome - x86_64 3
oracle-virtualbox/20/x86_64 Oracle VirtualBox - x86_64 10
rpmfusion-free/20/x86_64 RPM Fusion for Fedora 20 - Free 468
rpmfusion-free-updates/20/x86_64 RPM Fusion for Fedora 20 - Free - Updates 464
rpmfusion-nonfree/20/x86_64 RPM Fusion for Fedora 20 - Nonfree 203
rpmfusion-nonfree-updates/20/x86_64 RPM Fusion for Fedora 20 - Nonfree - Updates 299
updates/20/x86_64 Fedora 20 - x86_64 - Updates 17,616
repolist: 57,662

Now lets install the release file.  Keep in mind, you can do a separate wget or curl to download the file, or you can use the command as I have.  As of the time of this writing there are also repositories for Fedora 18 and 19 and Enterprise Linux 5, 6 and 7 (beta).  Though the only procedures I have validated are the Fedora 20, they should all work the same.

# yum localinstall http://dev.mysql.com/get/mysql-community-release-fc20-5.noarch.rpm

Now lets compare our new repositories to our old and we will see it has added 3 repositories, mysql56-community, mysql-tools-community and mysql-connectors-community

# yum repolist
Loaded plugins: langpacks, refresh-packagekit
repo id repo name status
adobe-flashplayer Adobe Flash Player - x86_64 2
fedora/20/x86_64 Fedora 20 - x86_64 38,597
google-chrome Google Chrome - x86_64 3
mysql-connectors-community/20/x86_64 MySQL Connectors Community 14
mysql-tools-community/20/x86_64 MySQL Tools Community 8
mysql56-community/20/x86_64 MySQL 5.6 Community Server 57
oracle-virtualbox/20/x86_64 Oracle VirtualBox - x86_64 10
rpmfusion-free/20/x86_64 RPM Fusion for Fedora 20 - Free 468
rpmfusion-free-updates/20/x86_64 RPM Fusion for Fedora 20 - Free - Updates 464
rpmfusion-nonfree/20/x86_64 RPM Fusion for Fedora 20 - Nonfree 203
rpmfusion-nonfree-updates/20/x86_64 RPM Fusion for Fedora 20 - Nonfree - Updates 299
updates/20/x86_64 Fedora 20 - x86_64 - Updates 17,616
repolist: 57,741

Install MySQL Server Community

Now that we have the repository we can use yum list to determine what version is available.

# yum list mysql-community-server
Loaded plugins: langpacks, refresh-packagekit
Available Packages
mysql-community-server.x86_64 5.6.19-1.fc20 mysql56-community

Then we can do a yum install to actually perform the install.

# yum install mysql-community-server

Enable the MySQL Server Software

Now we will set the mysqld service to start on reboot.

# systemctl enable mysqld
ln -s '/usr/lib/systemd/system/mysqld.service' '/etc/systemd/system/mysql.service'
ln -s '/usr/lib/systemd/system/mysqld.service' '/etc/systemd/system/multi-user.target.wants/mysqld.service'

Now manually start the mysqld service.  For a development environment, I also added bind-address=127.0.0.1 to /etc/my.cnf under the [mysqld] section.

# service mysqld start
Redirecting to /bin/systemctl start mysqld.service

Install MySQL Workbench Community

Now that we have the repository enabled we can also install additional software such as MySQL Workbench.

# yum install mysql-workbench
July 1st, 2014 | Tags: , ,

Recently I ran into an issue where I had a zpool that wasn’t imported in a system, and I was unable to import it due to zpool version incompatibilities.  This can happen if you are going to a older revision of Solaris or if you are crossing platforms between ZFS and OpenZFS.  This posed an interesting problem for me, as how do I destroy a pool that I haven’t imported?  There might be a quick command to handle this, but this actually presented another problem, as in my example I actually had a zpool name collision as well (this was the second mirror in an old rpool).

The first thing I tried was using dd to overwrite the first part of the disk (this is a common solution in Linux, however this didn’t work here, the zpool metadata was still available to the system.  I have no doubt that had I let dd overwrite the whole disk this would have no longer been a problem, however there had to be a better way.

Create Another Zpool on the Member Disk

To get around this problem we need to force create a new zpool on the underlying disk.  This is dangerous, we need to ensure we are using the correct disk device, since we are forcing it to create it will take an active disk the same as an inactive disk.

# zpool create -f tempzpool c9d0

It is worth mentioning that you need to use zpool status to ensure that you are not using an active disk device, you can then cross-reference those disks with format to look for the missing disk.

Destroy the New Zpool

Now that we have created the new zpool we can easily destroy it.

# zpool destroy tempzpool

Once the zpool was destroyed I was able to mirror the disks as expected.

 

June 30th, 2014 | Tags: , ,

Renaming a zpool is not as intuitive as I would expect, but it is still pretty simple.  We accomplish this through a three step process, export the zpool, import the zpool (using a new name), validate our mountpoints are how we want them (probably using the new zpool name).

Now why might I want to rename it?  That is simple, perhaps it is simply for organization or perhaps you already have a zpool by that name, or perhaps you use zpool mirrors as a method of backup (break the mirror rename one side, rebuild mirror with a new disk maintaining the previous copy offline).

Export the Zpool

The first step is to obviously export the pool, if the source system is not available any longer (perhaps) you just have drives, then this can be skipped but it is definitely recommended.

# zpool export tank

Import the Zpool

Here we can rename tank to newtank on the import as demonstrated below.

# zpool import tank newtank

If for some reason you did not cleanly export the pool prior to performing the input you will need to use the -f as demonstrated below.  Please use caution as you are literally overriding the warning that the pool is active.  If it really is active you can cause serious damage.

# zpool import -f tank newtank

If you are missing a log device you can pass the -m option to import it without the log.

# zpool import -m tank newtank

Validate Mountpoint Property

Now depending on how your zfs are setup you could end up not having the correct mountpoints after this change, you will want to review this and ensure that this is what you expect.

# zfs get mountpoint newtank/fs1
NAME PROPERTY VALUE SOURCE
newtank/fs1 mountpoint /tank/fs1 default

Now here we can see that the mountpoint is retaining the old property, this will only happen if you have broken inheritance, but if this is not the desired effect you will need to change it manually.

# zfs set mountpoint=/newtank/fs1 newtank/fs1

Also please remember that if you change the mountpoint you will need to update any NFS clients that utilize that mountpoint, so you will want to think about this step before you making changes.

Page 1 of 2712345...1020...Last »
TOP