Crash course on zpool and zfs in Solaris

In this post we will have a look on how to use zpool and zfs in Solaris.

We will start after labeling a new disk c0t2d0.

Create zpool

  • Once we have labelled the disk let's add it in a zpool "cvpool" .
# zpool create cvpool c0t2d0
  • Let's see our new pool.
# zpool list
 NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
 cvpool 4.97G 95.5K 4.97G 0% ONLINE -
 #

Create new ZFS

  • So our pool is ready now let's create a ZFS filesystem in it.
# zfs create cvpool/cldvdsfs
  • Ok that was easy. Have a look at what ZFS we have created.
# zfs list
NAME                USED   AVAIL    REFER   MOUNTPOINT
cvpool              104K   4.89G     21K   /cvpool
cvpool/cldvdsfs     21K    4.89G     21K   /cvpool/cldvdsfs
#
  • Check if our filesystem is mounted.
# df -h | grep -i cldvdsfs
 cvpool/cldvdsfs 4.9G 21K 4.9G 1% /cvpool/cldvdsfs
 #

Restrict ZFS

  • Above we can see that the filesystem is having 4.9GB which is actually the complete zpool size.
  • We don't want to give the full pool to one filesystem so let's restrict it to 500MB .
# zfs set quota=500m cvpool/cldvdsfs
# zfs set reservation=500m cvpool/cldvdsfs
  • Now if we check again the filesystem we can see it's now has total size of 500MB only.
# df -h | grep -i cldvdsfs
 cvpool/cldvdsfs 500M 21K 500M 1% /cvpool/cldvdsfs
 #

Grow or extend ZFS

  • What if you want to grow or extend the filesystem. Well that's also easy. If you have free space available you can increase the FS by just changing quota and reservation. If you want to know how to add new disks in a pool refer this post .
# zfs set quota=700m cvpool/cldvdsfs
# zfs set reservation=700m cvpool/cldvdsfs
  • So above we have increased the FS size to 700MB. Let's see if it reflects in "df -h" command.
 # df -h | grep -i cldvdsfs
 cvpool/cldvdsfs 700M 21K 700M 1% /cvpool/cldvdsfs
 #

Yes it does!!

View ZFS properties

  • You can see the properties assigned to a ZFS filesystem by running a zfs get.
# zfs get all cvpool/cldvdsfs

Rename ZFS mountpoint

  • Now if you don't like the mountpoint name of the ZFS filesystem and want to rename it to say  /cldvdsfs_new. You can do it by modifying the mountpoint property.
# zfs set mountpoint=/cldvdsfs_new cvpool/cldvdsfs
  • If we look in df command output we can see the mountpoint name changed.
# df -h | grep -i cldvdsfs
 cvpool/cldvdsfs 700M 21K 700M 1% /cldvdsfs_new
 #

Mirror zpool and zfs

  • If you want to mirror your ZFS filesystem you can do it by mirroring the zpool.
# zpool attach cvpool c0t2d0 c0t3d0
  • If we check status of the zpool we can see the disks are mirrored.
# zpool status cvpool
 pool: cvpool
 state: ONLINE
 scrub: resilver completed after 0h0m with 0 errors on Thu Sep 21 07:42:35 2017
config:

NAME STATE READ WRITE CKSUM
 cvpool ONLINE 0 0 0
 mirror-0 ONLINE 0 0 0
 c0t2d0 ONLINE 0 0 0
 c0t3d0 ONLINE 0 0 0 117K resilvered

errors: No known data errors

Delete zpool and ZFS

  • If you want to delete a zfs file system you can do it with destroy command. It will automatically unmount the filesystem if it's not in use.
zfs destroy cvpool/cldvdsfs
  • Finally delete the zpool.
# zpool destroy cvpool

Hope this post is helpful to you. Do let me know if you have any query.

Solved: Error on labeling the disk

You may get below error when you are trying to label a new disk in Solaris.

format> la
 WARNING - This disk may be in use by an application that has
 modified the fdisk table. Ensure that this disk is
 not currently in use before proceeding to use fdisk.

Solution:-

Before you proceed for the solution ensure that this is the correct disk which you want to label.

  • Once you are sure about the correct disk, select the disk from the format menu.
  • Before you try labeling the disk execute "fdisk" while in format menu.
format> fdisk
 No fdisk table exists. The default partition for the disk is:

a 100% "SOLARIS System" partition

Type "y" to accept the default partition, otherwise type "n" to edit the
 partition table.
  • Once you press "y" it will accept the default disk layout.
  • Now you can also change the disk layout format as per your requirement and finally label the disk.

Solved: How to get out of Virtual box console window

You can easily get out of the virtual box machine console window by pressing the “ctrl” button on the right side of the keyboard. i.e. the “ctrl” button which is near the arrow keys.

Solved: How to stop data balance notifications from Idea mobile internet

If you are using Idea Mobile network you would have noticed that  whenever your data connection is stopped you get a notification of how much data balance is left now.
This can be useful to know your data balance. But these notifications gets very irritating specially since the network switches frequently between 2G, 3G and 4G.
In this post we will see how to turn off these notifications.
  • Dial *121# from your mobile.
  • Select the option “Self care” . Generally its option 4.
  • Select “Data Notification” . Option 5 .
  • Select “Stop notification” . Option 2
Finally you will get the message that your data notifications will stop soon. It generally stops in 5 minutes.
Hope this post helps you. Do let me know if you have any query.

Solved: ERROR: current transaction is aborted - Redshift

Problem:-
[Amazon](500310) Invalid operation: current transaction is aborted, commands ignored until end of transaction block;
Solution:-
If you are getting the above error while you are connected to Redshift, ensure that you have checked the “Autocommit” box below the “Password” box in SQL Workbench/J connection window. (refer image below)

Once you check the “Autocommit” box try connecting to the Redshift cluster again.