|
OpenSolaris HowTos -
Advance OpenSolaris HowTo's
|
|
Written by Allen Sanabria
|
|
Wednesday, 24 September 2008 08:58 |
|
Here is another HowTo, but this time its on ZFS. The ZFS file system is a revolutionary new file system that was developed by SUN. I have to say ZFS is awesome and very easy to administer, I've been pissed off lately with things that I can not do on OpenSolaris/SolarisExpress or things that take way to much time to do on Solaris. One thing that has been extremely easy to implement and administer has been ZFS.
Here I will explain the many benefits of ZFS below..
- ZFS is a transactional file system, which means that the file system state is always consistent on disk.
- All data and meta data is checksummed using a user-selectable algorithm.
- No silent data corruption ever: ZFS self healing features automatically repairs corrupt data
- ZFS supports storage pools with varying levels of data redundancy, including mirroring and a variation on RAID-5
- The ZFS file system itself is 128-bit, allowing for 256 quadrillion zettabytes of storage
- ZFS supports SnapShots
- ACL Support
- many more......
You will need Solaris Express nv80 or newer or OpenSolaris 2008.05
- df -h { See what devices are being used }
-bash-3.2# df -h
Filesystem size used avail capacity Mounted on /dev/dsk/c0d0s0 7.6G 5.4G 2.1G 72% / /devices 0K 0K 0K 0% /devices /dev 0K 0K 0K 0% /dev ctfs 0K 0K 0K 0% /system/contract proc 0K 0K 0K 0% /proc mnttab 0K 0K 0K 0% /etc/mnttab swap 1.0G 996K 1.0G 1% /etc/svc/volatile objfs 0K 0K 0K 0% /system/object sharefs 0K 0K 0K 0% /etc/dfs/sharetab /usr/lib/libc/libc_hwcap3.so.1 7.6G 5.4G 2.1G 72% /lib/libc.so. fd 0K 0K 0K 0% /dev/fd swap 1.0G 48K 1.0G 1% /tmp swap 1.0G 44K 1.0G 1% /var/run /dev/dsk/c0d0s7 7.6G 37M 7.5G 1% /export/home
- format ( See what disks are available to us }
-bash-3.2# format
Searching for disks...done AVAILABLE DISK SELECTIONS 0. c0d0 <DEFAULT cyl 2085 alt 2 hd 255 sec 63> /pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0 1. c0d1 <DEFAULT cyl 1021 alt 2 hd 128 sec 32> /pci@0,0/pci-ide@1,1/ide@0/cmdk@1,0 2. c1d1 <DEFAULT cyl 1021 alt 2 hd 128 sec 32> /pci@0,0/pci-ide@1,1/ide@1/cmdk@1,0 Specify disk (enter its number):
- As you can see we have 2 disks ( c0d1and c1d1 ) available to use. So now we can create our zpool.
zpool create linuxdynasty c0d1 c1d1
-bash-3.2# zpool create linuxdynasty c0d1 c1d2
- Lets check the status of our newly create pool.
zpool status
-bash-3.2# zpool status
pool: linuxdynasty state: ONLINE scrub: none requested config:
NAME STATE READ WRITE CKSUM linuxdynasty ONLINE 0 0 0 c0d1 ONLINE 0 0 0 c1d1 ONLINE 0 0 0
errors: No known data errors
- We know we only have one pool but if you wanted to see the status of all of your zpools this is how you do it.
zpool list
-bash-3.2# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT linuxdynasty 3.97G 220K 3.97G 0% ONLINE -
- zfs create linuxdynasty/opt { Here we created the /linuxdynasty/opt file system, as you will see ZFS will automatically mount it for you as well }
-bash-3.2# zfs create linuxdynasty/opt
- Now I want to make my /opt directory into a ZFS managed filesystem. In order to do this I will have to move the contents of /opt into /linuxdynasty/opt.
-bash-3.2# mv /opt /linuxdynasty/opt
- Remove the origianl /opt dir
-bash-3.2# rm -rf /opt
- Now we need to tell ZFS to change where the /linuxdynasty/opt points to in the file system.
-bash-3.2# zfs set mountpoint=/opt linuxdynasty/opt
- What if you do not want the /opt file system to grow out of control?? Well ZFS also can handle that by setting a quota on the file system as well
-bash-3.2# zfs set quota=1G linuxdynasty/opt
- Now you can run a df -h,and as you can see all the mounting is done for you.. Now when you reboot the box all of your ZFS mounts will mount up automatically with out you having to modify /etc/vfstab since ZFS takes care of this for you.
bash-3.2$ df -h
Filesystem size used avail capacity Mounted on /dev/dsk/c0d0s0 7.6G 4.9G 2.6G 66% / /devices 0K 0K 0K 0% /devices /dev 0K 0K 0K 0% /dev ctfs 0K 0K 0K 0% /system/contract proc 0K 0K 0K 0% /proc mnttab 0K 0K 0K 0% /etc/mnttab swap 986M 1.0M 985M 1% /etc/svc/volatile objfs 0K 0K 0K 0% /system/object sharefs 0K 0K 0K 0% /etc/dfs/sharetab /usr/lib/libc/libc_hwcap3.so.1 7.6G 4.9G 2.6G 66% /lib/libc.so.1 fd 0K 0K 0K 0% /dev/fd swap 985M 48K 985M 1% /tmp swap 985M 44K 985M 1% /var/run /dev/dsk/c0d0s7 7.6G 54M 7.5G 1% /export/home linuxdynasty 3.9G 20K 3.4G 1% /linuxdynasty linuxdynasty/opt 1.0G 543M 481M 53% /opt
Now there is alot more that ZFS can do so If you want to see more please let me know and I will be more then happy to create more tutorials based on ZFS.
|
|
Last Updated ( Wednesday, 24 September 2008 15:52 )
|