Create a ZFS Storage pool on a Pen drive / USB Stick in OpenSolaris

You can do some crazy stuff with OpenSolaris and ZFS! Here is my crazy deal. Lets create a ZFS storage pool such that we have 2 Pen drives of 2 GB each and lets use it to save on big file of 3.5 GB (read store a nice DVD quality movie on two 2GB pendrives :P )


You will need two things for this:


1. Install OpenSolaris


2. Get two or more 2 GB (or of whatever size) pen drives / USB sticks (I do not have  2 pen drives with me so I will use one pen drive and one file to act like a pen drive. Process remains the same)


Step 1: Find out the device ID of your pen drive:



root@opensolaris:~# format -e
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c7d0 <DEFAULT cyl 3271 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0
       1. c9t0d0 <Generic-Flash Disk-8.07-1.87GB>
          /pci@0,0/pci8086,265c@b/storage@1/disk@0,0
Specify disk (enter its number):



In this case, the disk 0 is my hard disk, and 1 with device ID c9t0d0 is the USB stick. If I had two pen drives I would have had one more entry. However, I am going to create a new file of 2 GB under the name disk1 and use it.


Step 2: Create a new zpool on these devices. If you are using many multiple pen drives then instead of /root/disk2 use the device ID of the devices.



root@opensolaris:~# zpool create randomZpool c9t0d0 /root/disk2
root@opensolaris:~# zpool status -v
  pool: randomZpool
 state: ONLINE
 scrub: none requested
config:

    NAME           STATE     READ WRITE CKSUM
    randomZpool    ONLINE       0     0     0
      c9t0d0       ONLINE       0     0     0
      /root/disk2  ONLINE       0     0     0

errors: No known data errors

  pool: rpool
 state: ONLINE
 scrub: none requested
config:

    NAME        STATE     READ WRITE CKSUM
    rpool       ONLINE       0     0     0
      c7d0s0    ONLINE       0     0     0

errors: No known data errors



 Step 3: Create a ZFS filesystem on the storage pool



root@opensolaris:~# zfs list | grep randomZpool
randomZpool               101K  3.77G    19K  /randomZpool
randomZpool/dummy          19K  3.77G    19K  /randomZpool/dummy



Now you can see, that I have a ZFS filesystem of 3.77GB under the name randomZpool/dummy. Now let us define a mount point for the same.


Step 4: Define a mountpoint for the ZFS Filesystem.


root@opensolaris:~# zfs set mountpoint=/export/movies randomZpool/dummy
root@opensolaris:~# df -h /export/movies
Filesystem            Size  Used Avail Use% Mounted on
randomZpool/dummy     3.8G   19K  3.8G   1% /export/movies

 Now you have the backup of your 3.5 GB movie file on two pen drives :)


How you can use this small arrangement to do much bigger (and crazier) stuff is limited only by your creativity ;)


Happy hacking to all!



Comments:

Post a Comment:
Comments are closed for this entry.
About

I am Abhishek and I work for Sun/Oracle! In this blog, I share my interest in systems, solaris, linux and other technologies :-)

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today