Advertisements

Archive for February, 2013

Adding and removing ZFS zpool ZIL disk live by gptid

While this was primarily written for FreeNAS, it should still be applicable to any ZFS environment.

Note: You must be running FreeNAS 8.3.0 or later (specifically ZFS version 19 or later) for safe ZIL addition/removal, or you will lose the contents of your pool. See here for more information.

First, identify the drives in your zpool

zpool status

In my case, zpool name is tank, so

zpool status tank

output:

  pool: tank
 state: ONLINE
  scan: scrub repaired 0 in 2h26m with 0 errors on Sun Feb 24 18:20:41 2013
config:

        NAME                                            STATE     READ WRITE CKSUM
        tank                                            ONLINE       0     0     0
          raidz1-0                                      ONLINE       0     0     0
            gptid/7d6aebb4-7d35-11e2-a509-a0b3cce4f06c  ONLINE       0     0     0
            gptid/7e07dbb7-7d35-11e2-a509-a0b3cce4f06c  ONLINE       0     0     0
            gptid/7eaf492d-7d35-11e2-a509-a0b3cce4f06c  ONLINE       0     0     0
        logs
          gptid/7f31716a-7d35-11e2-a509-a0b3cce4f06c    ONLINE       0     0     0

errors: No known data errors

So now we have the gptid of the ZIL log: gptid/7f31716a-7d35-11e2-a509-a0b3cce4f06c

Now, remove the ZIL

zpool remove tank gptid/7f31716a-7d35-11e2-a509-a0b3cce4f06c

The log has been removed. Verify with

zpool status tank

Adding the ZIL back:

You can add the ZIL back using:

zpool add  log <disk_ID>

So, if you wanted to add the previous disk back:

zpool add tank log  gptid/7f31716a-7d35-11e2-a509-a0b3cce4f06c

But if you wanted to add a different disk as a log, you need the gptid

gptids are listed under /dev/gptid

so:

ls -l /dev/gptid/

total 0
crw-r—– 1 root operator 0, 96 Feb 28 07:20 7d6aebb4-7d35-11e2-a509-a0b3cce4f06c
crw-r—– 1 root operator 0, 107 Feb 28 07:20 7e07dbb7-7d35-11e2-a509-a0b3cce4f06c
crw-r—– 1 root operator 0, 109 Feb 28 07:20 7eaf492d-7d35-11e2-a509-a0b3cce4f06c
crw-r—– 1 root operator 0, 110 Feb 28 07:20 7f31716a-7d35-11e2-a509-a0b3cce4f06c
Compare those gptid’s to what’s already in your pool to determine the correct disk to add.

Questions or comments about the above? Please leave them in the comments section below. Thank you!

Advertisements

, , ,

Leave a comment

Disable FreeNAS 8 debugger mode on kernel panic and enable automatic restart

If FreeNAS 8 encounters an error (which is usually related to out-of-memory conditions) it will enter debugging mode, which is indicated by the following debugger prompt:

db>

To disable this, and enable automatic reboot on panic, add the following tunable in System > Tunables > Add Tunable:

Variable: debug.debugger_on_panic

Value: 0

Make sure enabled is checked and hit Ok.

Questions and comments are welcome in the comments section below. Thank you!

Leave a comment

Add yourself to the sudoers list on FreeNAS 8

FreeNAS 8 does not, by default, allow anyone to use the su command. One practice is to allow members of the wheel group access to su any command. This can be accomplished easily by editing the /usr/local/etc/sudoers file and adding the following line:

%wheel ALL=(ALL) ALL

However, this will be lost on reboot. You can write an sh script to update this file with the following two lines:

echo >> /usr/local/etc/sudoers
echo "%wheel ALL=(ALL) ALL" >> /usr/local/etc/sudoers

You can run this sh script from the web shell and it will update the sudoers file.

It can be cumbersome (and problematic) to lose this on every reboot. So here’s how you can edit the base sudoers file so it’s ready when the system reboots:

First, remount the root filesystem read-write:

mount -wu /

Note that if you’re running FreeNAS from a USB stick, filesystem commits can take several moments to commit while the system is mounted read-write. That’s normal, though annoying.

Next, edit the /conf/base/etc/local/sudoers file (you can use the two statements above) to add:

%wheel ALL=(ALL) ALL

lastly, remount the root filesystem read-only again:

mount -ru /

That’s it. However, if you upgrade FreeNAS in the future, this change will be lost. Re-edit the file again.

If you have questions or suggestion, please feel free to leave them in the comments below. Thank you!

Leave a comment

Mounting a USB FAT32 formatted disk in FreeNAS 8

If you want to mount a FAT32-formatted (or presumably FAT as well) USB drive in your FreeNAS server, here’s how you do it in FreeNAS 8.

First, view your console either using the servers display, or the web interface (Settings > Advanced > Show Console Message in the footer).

Plugging in your device should display messages similar to the following:

Feb 27 20:56:34 freenas kernel: ugen1.2: <JMicron> at usbus1
Feb 27 20:56:34 freenas kernel: umass1: <MSC Bulk-Only Transfer> on usbus1
Feb 27 20:56:34 freenas kernel: da1 at umass-sim1 bus 1 scbus7 target 0 lun 0
Feb 27 20:56:34 freenas kernel: da1: <Hitachi HTS547550A9E384 A50A> Fixed Direct Access SCSI-2 device
Feb 27 20:56:34 freenas kernel: da1: 40.000MB/s transfers
Feb 27 20:56:34 freenas kernel: da1: 476940MB (976773168 512 byte sectors: 255H 63S/T 60801C)

From this, we know the device is /dev/da1.
Next, either open the web console or SSH, so we can see what the partitions are and mount it
Now, we’ll see what the partition listings are

ls -l /dev/da1*

crw-r—– 1 root operator 0, 133 Feb 27 20:56 /dev/da1
crw-r—– 1 root operator 0, 134 Feb 27 20:56 /dev/da1s1
Now you know the disk is /dev/da1, and the partition is /dev/da1s1.

Now, lets mount it.
You only need sudo if you’re not already root (you may need to edit the /etc/sudoers file)

cd /mnt
sudo su
mkdir usb
mount_msdosfs /dev/da1s1 usb1

If you receive this message:

mount_msdosfs: /dev/da1s1: Disk too big, try '-o large' mount option: Invalid argument

Then listen, and do instead:

mount_msdosfs -o large /dev/da1s1 usb1

Now, verify that it has mounted correctly:

mount

You should see a line in the output which lists /dev/da1s1:

/dev/da1s1 on /mnt/usb1 (msdosfs, local)

And you’re all set. Don’t forget to umount when you’re done!

, ,

Leave a comment

My new home NAS: HP ProLiant MicroServer N40L running FreeNAS 8

I recently bought an HP ProLiant MicroServer for my new home NAS. My previous NAS was a Synology DS211j, and it performed very well, up until recently. My two biggest reasons for replacing it were:

1) It would randomly drop off the network. The LAN led would flash rapidly, but there was no activity on the switch port. It was also unpingable. This means the NIC was probably failing, and the unit would need to be replaced.

2) Synology had the idea to force MyDS registration in DSM 4.2 BETA. This meant I wasn’t getting another Synology if I could help it.

After some searching, I happened on the HP ProLiant MicroServer for the physical unit, and after a couple days of thought and planning, FreeNAS 8 BETA 3 for the OS.

Now, as my luck would have it, the first time I removed the motherboard from the chassis, I knocked a jumper cap off the board, which resulted in the unit not POSTing. A little intuition helped me find the right spot to replace it to. Here’s photos of the jumper locations in case anyone else shares my bad luck:

I installed a 4GB USB stick in the motherboard’s USB header with FreeNAS installed on it, and am using 2TB drives in slots 1-3 in RAID-Z1, and a 250GB 7200RPM drive in slot 4 for ZIL. In case you want to argue why I should be using an SSD instead of a conventional hard drive, you’re welcome to buy me one, but you might want to read this post first.

So that’s that. I’m sure you’ll be seeing more posts on FreeNAS and my NAS setup in general in the future.

Have any questions or comments about the above? Please share them in the comments section below. Thank you!

, , , ,

Leave a comment

How to share a Hotmail calendar using iCal

To share a Hotmail calendar using iCal, log in to your Hotmail calendar and locate the calendar that you wish to share in your list of calendars. Here, I’m going to share my ‘Work’ calendar. Start by clicking it’s name:

hm_share_1

On the next screen, locate and click the ‘Edit Sharing’ link that appears:

hm_share_2

On the next screen, check the ‘Send people a view-only link to your calendar’ box and then you can copy and paste the iCal link that you wish to share, based on the details you wish to provide.

hm_share_3

There are also links to reset the private URLs if you wish to revoke access to your calendar at any point in the future.

 

,

Leave a comment

How to subscribe to an iCal calendar in Hotmail Calendar

To subscribe to an iCal published calendar in Hotmail, first log in to your Hotmail calendar and find the ‘Subscribe’ link near the top:

hm_subscribe_1

Clicking that takes you to the next screen, which asks for the iCal URL and a name to give your calendar:

hm_subscribe_2

Simply paste your iCal URL into the Calendar URL box, and give it a name. Select the color or charm to your liking, and hit ‘Subscribe to calendar’. Your calendar will appear.

,

Leave a comment

How to subscribe to an iCal calendar in Google Calendar

If you want to subscribe to an iCal calendar using Google calendar, here’s how you do it.

First, go to your calendars so that you see ‘Other Calendars’ appear at the bottom of the screen. Click the down arrow next to it:

gcal_subscribe_1

From the menu that appears, click ‘Add by URL’

gcal_subscribe_2

The following dialog box will open, asking for the URL of your iCal feed.

gcal_subscribe_3

Note that Google does not handle URLs that begin with webcal:// or webcals:// at all. If you have an iCal URL that begins with one of these, change it as follows:

Change webcal:// to http://

Change webcals:// to https://

Paste your iCal URL inot the box and hit ‘Add Calendar’. The calendar will then appear in your calendar screen.

, ,

Leave a comment

How to share a Google Calendar using iCal

Sharing Google calendars between Google users is easy, but what if you want to create and share a Google calendar with someone who doesn’t use Google?

It’s actually not very difficult at all, and I’ll explain how to do it using your calendar’s private link. This will enable your viewer to see all event details, but due to the technical limitation of using iCal, they won’t be able to make any edits. This may be a good thing or a bad thing, depending on your specific situation.

So here’s how it works.

First, go to your Google calendar and locate the calendar you wish to share on the left side. In this case, I want to share my ‘work’ calendar. Hover over the calendar name and click the down arrow that appears next to it:

gcal_share_1

On the menu that appears, click ‘Calendar Settings’:

gcal_share_2

Scroll down to the bottom to where it says ‘Private Address’

gcal_share_3

In this case we want the iCal address link. You can either right-click the green iCal button and say ‘Copy Link Location’ (depending on your browser), or click it for a pop-up that gives you the link you can copy and paste, like so:

gcal_share_4

Now, if you want to ever revoke access to that calendar’s private link at a later date, just use the ‘Reset private URLs’ link which appears next to the private links.

, ,

Leave a comment