LRAID cmds: Difference between revisions

From Lundman Wiki
mNo edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== MeLE A2000 ===
$ ssh lraid5
Last login: Sun Jul  3 09:14:04 2011 from totoro
Oracle Corporation      SunOS 5.11      snv_151a        November 2010
lundman@solaris:~$  sudo bash
Password:
root@solaris:/home/lundman# # uname -a
SunOS solaris 5.11 snv_151a i86pc i386 i86pc Solaris


=== Mele file storage ===
Drives attached to the system:


  http://www.lundman.net/ftp/mele/
  # cfgadm -al
Ap_Id                          Type        Receptacle  Occupant    Condition
sata1/0::dsk/c10t0d0          disk        connected    configured  ok
sata1/1::dsk/c10t1d0          disk        connected    configured  ok
sata1/2::dsk/c10t2d0          disk        connected    configured  ok
sata1/3::dsk/c10t3d0          disk        connected    configured  ok
sata1/4::dsk/c10t4d0          disk        connected    configured  ok
sata1/5                        sata-port    empty        unconfigured ok


(Ok, there should be a disk in sata1/5, but the kids probably popped it out)


=== v1.3BETA firmware ===


Mele_HTPC_0929_BETA_V1.3.rar
=== pools ===
Mele_HTPC_0929_BETA_V1.3.ddimg.bz2


Exactly the same issues as v1.2. I can not see anything new, nobody should run this.
There are two parts to ZFS. The "pool" of storage, and "file-systems". All pool commands are done with "zpool" and all filesystem commands are done with "zfs".


However, TMerle has taken this image and made it english, removed the annoying apps, and added Google Store. Huzzah!


If you want to replace the kernel, with the NIC patched kernel, do this:
List your pools, you will initially only have the boot pool:


  # wget http://lundman.net/ftp/mele/mele.v1.3.nandc-new
  # zpool list
  # dd if=/dev/nandc of=original_nandc.bin bs=65536           # Use /dev/block/nandc if on Android
NAME    SIZE  ALLOC  FREE    CAP  DEDUP  HEALTH  ALTROOT
  # dd if=mele.v1.3.nandc-new of=/dev/nandc bs=65536
rpool  29.8G  5.46G  24.3G    18%  1.00x  ONLINE  -
mypool 4.53T  1.39T  3.14T    30%  1.00x  DEGRADED  -
 
Default boot is called "rpool" in Solaris, you can change the name if you want.
 
 
Check out the status of your zpools:
 
  # zpool status
  pool: rpool
state: ONLINE
scan: none requested
config:
        NAME        STATE    READ WRITE CKSUM
        rpool        ONLINE      0    0    0
           c10t0d0s0  ONLINE      0    0    0
errors: No known data errors
  pool: mypool
state: DEGRADED
  status: One or more devices has been removed by the administrator.
        Sufficient replicas exist for the pool to continue functioning in a
        degraded state.
action: Online the device using 'zpool online' or replace the device with
        'zpool replace'.
scan: resilvered 27.5G in 0h21m with 0 errors on Thu Jun 30 16:19:20 2011
config:
   
   
Now, when I boot, the wemac NIC doesn't work any more (link stays down). But if I replace the script.bin it works again. I do not know which part of script.bin needs to be fixed. Someone with time could look into this. There are only about 20 lines when you diff them, but none in emac area.
        NAME                        STATE    READ WRITE CKSUM
        mypool                      DEGRADED    0    0    0
          raidz1-0                  DEGRADED    0    0    0
            c10t5d0                REMOVED      0    0    0
            c10t4d0                ONLINE      0    0    0
            c10t3d0                ONLINE      0    0    0
            c10t2d0                ONLINE      0    0    0
            c10t1d0                ONLINE      0    0    0
        logs
          /dev/zvol/dsk/rpool/slog  ONLINE      0    0    0
errors: No known data errors


# wget http://lundman.net/ftp/mele/mele-1.3-script-fixed.bin
# mount -t vfat /dev/nanda /mnt
# cp /mnt/script.bin /mnt/script-original.bin
# cp mele-1.3-script-fixed.bin /mnt/script/bin
# umount /mnt


For those of you who also wishes to make advantage of the ZFS in the kernel, you additionally need to get:
As you can see, "rpool" is the boot pool (root pool), on disk "c10t0d0". (controller 10, target 0, device 0, slice 0). Slice is "partition" in Solaris world. Device is no longer used, as it is a legacy thing from scsi days. "rpool" is a single disk pool.


  # wget http://lundman.net/ftp/mele/zpool_builtin-1.3
My main data pool, "mypool" is missing a disk, but otherwise fine lookin'. Finally the "slog" of "mypool" (transaction logs in ZFS) is stored on SSD, this is for speed. This is a "raidz1" (raid 5) setup. I can lose one disk without data loss. (20% used on parity). Use "raidz2" if you want to be able to lose 2 HDDs without loss. (40% used on parity), and so on. You can also "mirror" (raid1).
# wget http://lundman.net/ftp/mele/zfs_builtin-1.3
# mount -o remount,rw /system
# busybox cp zpool_builtin-1.3 /system/bin/zpool
# busybox cp zfs_builtin-1.3 /system/bin/zfs
# touch /etc/mtab
# zpool import -d /dev/block yourpoolname


Personally, I also recommend:


# cd /system/media/
=== File systems ===
# mv bootanimation.zip bootanimation.zip-orig


=== v1.2 firmware ===
ZFS has two kinds of filesystems. Regular ZFS file system, and a "Virtual-Volume". The latter creates a virtual block device (fake disk) which you can then use as a regular disk, ie, format it "ext3" if you really want to, mount it etc. In this case, we create a Volume for "swap", and for "slog". The size of both ZFS-fs, and Volumes, can be changed on the fly.


Mele_HTPC_120907_Ver1.2.rar


This does not include Google Market/Play Store. Has a strange launch screen that appears not trivial to replace. It is loaded with chinese apps and ad/malware.
Listing your filesystems:
I would not recommend anyone to run this.


=== Status ===
# zfs list
NAME                        USED  AVAIL  REFER  MOUNTPOINT
rpool                      8.04G  21.2G    93K  /rpool
rpool/ROOT                2.84G  21.2G    31K  legacy
rpool/ROOT/realtek        2.84G  21.2G  2.71G  /
rpool/ROOT/solaris        2.04M  21.2G  2.52G  /
rpool/dump                1019M  21.2G  1019M  -
rpool/export                141M  21.2G    32K  /export
rpool/export/home          141M  21.2G    32K  /export/home
rpool/export/home/lundman  141M  21.2G  141M  /export/home/lundman
rpool/slog                2.06G  21.9G  1.36G  -
rpool/swap                    2G  23.1G  123M  -
mypool                    1.11T  2.45T  55.9K  /mypool
mypool/backup              232G  2.45T  232G  /backup
mypool/data                1.42G  2.45T  1.42G  /data
mypool/secure              906G  2.45T  906G  /media
mypool/swap                  2G  2.45T  25.6K  -
mypool/test                54.3K  2.45T  54.3K  /mypool/test


Current status with the Mele A2000, Allwinner A10.


Official release: Android 4 ICS, 4.0.8.
Note that default Solaris creates lots of little filesystems, one for each boot (realtek & solaris), one for "dump", "swap", "export" "export/home" and "export/home/lundman". But then, filesystems are really cheap in ZFS, so, why not. Gives you lots of control. Traditionally filesystems were quite monolithic, where as in ZFS they are closer to "mkdir".
Kernel: 3.0.31+


'''Positive:'''
Checking the attributes of the "rpool":
* Video playback 1080p
* MKV playback
* TS playback
* YouTube
* Android market and Games (Angry Birds etc)


'''Negative:'''
# zpool get all rpool
* <s>Network Streaming</s> Fixed. NIC has been patched to allow smooth 1080p steaming
NAME  PROPERTY      VALUE              SOURCE
* Audio. The settings; '''CODEC''' no sound, but probably on RCA. '''HDMI''' choppy sound, unusable. If made to work, only '''stereo''' on HDMI. '''SPDIF''' not working, does not turn on. (No red light)
rpool  size          29.8G              -
* Bitstreaming; Unconfirmed since SPDIF is not functional. But can the hardware bitstream TrueHD, and DTS-MA ?
rpool  capacity      18%                -
* 10bit video does not play (not supported by hardware, CPU too slow for software)
rpool  altroot        -                  default
* AVI/XviD does not play (not supported by hardware, CPU too slow for software)
rpool  health        ONLINE              -
rpool  guid          15126656221277650189  default
rpool  version        31                  default
rpool  bootfs        rpool/ROOT/realtek  local
rpool  delegation    on                 default
rpool  autoreplace    off                default
rpool  cachefile      -                  default
rpool  failmode      wait                default
rpool  listsnapshots  off                default
rpool  autoexpand    off                default
rpool  dedupditto    0                  default
rpool  dedupratio    1.00x              -
rpool  free          24.3G              -
rpool  allocated      5.46G              -
rpool  readonly      off                -


Currently, it is no good for mediaplayer. But if all you want is a toy to play youtube, some android games, and only stereo sound, it is definitely capable.
You won't change the pool attributes that often, but in this case, "failmode" defines what the system should do if the pool as a failure. In this case "wait" (ie, hang until it is fixed.) Which is not so useful. It is often better for it to "continue" in failure mode, so we can try to fix it.


# zpool set failmode=continue rpool


=== Android 4 ICS wired NIC patch ===
autoreplace controls if it should automatically replace dead HDD with new HDDs, if it detects you have replaced the hardware. Why not? Unless you want to manually try the commands of course.


I have been working on trying to improve the '''wemac''' NIC driver in the Mele A2000 Allwinner A10 hardware, which will stutter when playing 720p/1080p over network. The current patch makes it much better, such that I think it is usable now. There is a '''mynewerimage.img''' image in the storage area, that you can '''dd''' to the '''nandc''' device. I will work on submitting the patch upstream.
autoexpand controls if it should automatically make the pool larger, when all HDDs in the pool have been replaced with larger disks. You probably want this on too.


For example, if you boot miniand image:
But we are actually looking at "rpool", the SSD, so the last two options do not really make sense. You want to set the for your data pool though.


# modprobe nand    # nand.ko on my storage area too
Likewise, ZFS filesystems (and Volumes) also have attributes, these are more fun to play with.
# wget http://lundman.net/ftp/mele/mynewerimage.img
# dd if=/dev/nandc of=mele_nandc_backup.bin bs=65536
# dd if=mynewerimage.img of=/dev/nandc bs=65536
# sync
# reboot -f


And take out the SD card to boot Android again. If you do this using Android, the device node is /dev/block/nandc
# zfs get all rpool
rpool  type                            filesystem                      -
rpool  creation                        Fri Dec 24  2:38 2010          -
rpool  used                            8.04G                          -
rpool  available                      21.2G                          -
rpool  referenced                      93K                            -
rpool  compressratio                  1.00x                          -
rpool  mounted                        yes                            -
rpool  quota                          none                            default
rpool  reservation                    none                            default
rpool  recordsize                      128K                            default
rpool  mountpoint                      /rpool                          default
rpool  sharenfs                        off                            default
rpool  checksum                        on                              default
rpool  compression                    off                            default
rpool  atime                          on                              default
rpool  nbmand                          off                            default
rpool  sharesmb                        off                            default
rpool  dedup                          off                            default
rpool  encryption                      off                            -
(this list is considerably larger, I just picked out some of the juicier options).


=== Android 4 ICS official Mele image ===
Most are self-explanatory. But note that "quota" here means the "file-system size". If not set (normal) you can create files in there until the pool is full. If set (say 100G) you can only go to 100G of data.
"reservation" refers to how much space the fs should reserve in advance. If you set quota to 100G, that directory (user) can fill 100G, but it allocates no space. So if the pool runs out, the user can not actually reach 100G. If you want it to pre-allocate the promised 100G, you set reservation. You probably don't want to. But do note we set it for "swap" since you don't want swap to NOT have the space promised.


The official Mele Android ICS image is out, called '''Mele_HTPC_Android_4.0_V1.rar''' which you need to use PhoenixCard to "burn". Once installed, you can use '''audiopatch1.3.apk''' to enable some sound features. Otherwise it seems quite similar to A10 firmware.  
"sharenfs" and "sharesmb" controls if it should exported as NFS, or samba. atime is good to disable (speed). "compression" is often good to have on (lessens the disk read/write and expense of CPU - alas, does nothing for media like movies).


For those not using Windows, I also made a '''dd''' image: '''Mele_HTPC_Android_4.0_V1.ddimg.bin.bz2''' [http://lundman.net/ftp/mele/Mele_HTPC_Android_4.0_V1.ddimg.bin.bz2] Just dd the whole thing to your raw device.
Checking swap:


=== Android 4 IceCreamSandwich ===
# zfs get all rpool/swap
rpool/swap  compression                    off
rpool/swap  volsize                        2G
rpool/swap  refreservation                  2G


'''Update: the non-beta release of ICS4 came out (for the A10, not Mele's release), which has settings/display, and lets you chose resolution '''
So, swap set to use 2G of space, pre-allocated. Note your ZFS Volumes can be compressed. So if you put a "ext3" filesystem on it, ZFS will compress the blocks under it, to take up less space. Very sexy.


For Unix and clones:
wget http://www.lundman.net/ftp/mele/homlet_4.0_v1.0_20120609_dd.img.lzma
7z x homlet_4.0_v1.0_20120609_dd.img.lzma
sudo dd if=homlet_4.0_v1.0_20120609_dd.img of=/dev/sdX bs=1M
sync


Where you need to replace X in /dev/sdX by the correct letter for your SD card reader.
Now insert the SD card in your Mele, and wait until the LED stops blinking, remove the SD card and restart the device. Et voila!
(Read more: [http://www.cnx-software.com/2012/06/18/mele-a1000a2000-android-4-0-image-released/#ixzz1ylfoeKQc]) See I kept the paste URL cos I'm nice! :)






There is also an audiopatch for the ICS4 image to get sound to work. Copy over '''audiopatch1.2.apk''' (adb, or physical media) to your ICS4, install and run.


Not convinced it makes any difference for me. Audio appears not to work still.
You use "format" command in Solaris to play with partitions. This is legacy crap you do no longer need to bother with (Since the boot is already done). Looks like this:


It appears the contents on audiopatch1.2 is pretty much just libswa.so. Not entirely sure what it thinks to do with it, but if I do a '''find''' from root, there is no such library, before and after running patch.
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
      0. c10t0d0 <ATA    -OCZ-AGILITY    -1.4  cyl 3889 alt 2 hd 255 sec 63>
          /pci@0,0/pci1043,8496@11/disk@0,0
      1. c10t1d0 <ATA-SAMSUNG HD103SI-1113-931.51GB>
          /pci@0,0/pci1043,8496@11/disk@1,0
      2. c10t2d0 <ATA-SAMSUNG HD103SI-1118-931.51GB>
          /pci@0,0/pci1043,8496@11/disk@2,0
      3. c10t3d0 <ATA-SAMSUNG HD103SI-1118-931.51GB>
          /pci@0,0/pci1043,8496@11/disk@3,0
      4. c10t4d0 <ATA-SAMSUNG HD103SI-1118-931.51GB>
          /pci@0,0/pci1043,8496@11/disk@4,0
Specify disk (enter its number):


I copied the file by hand:


busybox cp /data/data/com.android.audiopatch/files/libswa.so /system/lib/
Also note, these days disks over 1TB will generally have 4KB sectors, instead of 512 bytes. Since 512 can run with 4KB sized pool without side-effects, but 4KB HDD can not always handle 512 byte pools without degradation, it is recommended that you create pools for 4KB disks, even if you don't have any right now.  


and I get sound playing videos with some audio formats now. Like, TV MKV releases.
Create a pool from disks:


=== Mele A2000 ===
# zpool create -o async=12 mypool raidz c10t1d0 c10t2d0 c10t3d0 c10t4d0 c10t5d0


I purchased a MeLE A2000 from Tom over at [http://www.aliexpress.com/product-fm/546571245-Mele-A2000-TV-box-Allwinner-A10-hackable-device-wholesalers.html aliexpress], and been playing around with it as well. First I wanted to install ICS4, to do that I downloaded the '''android_4.0.img''' file from the 'net. Alas, there is a large volume of confusing information on what to do with this.
You can name it anything you want, don't need to use 'mypool'
# zpool status mypool


[http://www.lundman.net/ftp/mele/ http://www.lundman.net/ftp/mele/]
zpool don't have to be actual disks either, you can make it on fake files:
[https://www.wuala.com/zercosz/Mele%20A2000/Firmware/?key=ThisIsFC2012 https://www.wuala.com/zercosz/Mele%20A2000/Firmware/?key=ThisIsFC2012]


For the MeLE A2000, I also downloaded '''PhoenixCardV303(win7)''' and installed that in my VirtualBox Win7 system, forwarded the OSX USB drive and told it to install '''android_4.0.img'''.
# mkfile 1G /var/tmp/fakedisk1
# zpool create playpool /var/tmp/fakedisk1


[https://www.wuala.com/zercosz/Mele%20A2000/Utilidades%20Mele/?key=ThisIsFC2012 https://www.wuala.com/zercosz/Mele%20A2000/Utilidades%20Mele/?key=ThisIsFC2012]
[http://www.lundman.net/ftp/mele/ http://www.lundman.net/ftp/mele/]


After that, I inserted the SD card into Mele, and rebooted.
When you do it "for realz" you want slog on SSD. So create a volume for slog, usually the same size as memory.


The power LED will blink RED + BLUE for a while, then power LED will turn off.
# zfs create -V 2G rpool/slog
(-V creates a Volume instead of fs, creating volumes creates a dev node at /dev/zvol/dsk/$poolname/$volumename)


Take out SDcard, and reboot MeLE. It will now boot ICS, but only on HDMI@720p.
# zfs set refreservation=2G rpool/slog
(pre-allocate the disk space, so slog is guaranteed 2G)


I can confirm BubbleUPNP + 2160pPlayer will play 1080p MKVs over network. Nice!
# zfs add mypool log /dev/zvol/dsk/rpool/slog
(Attach the Volume slog from pool rpool,  to pool zpool)




=== Google Market/Play ===


I installed one of the Terminal programs, and told adb to use TCP (haven't bothered to open my mele yet). Using adb and the instructions found [http://www.slatedroid.com/topic/30855-scripts-allwinner-a10-tablets-google-play-script/ allwinner a10 scripts] I loaded Google Market/Play to the mele.
Create a file-system:


# zfs create mypool/roger
mypool/roger            2.5T  55K  2.5T  1% /mypool/roger


Don't like where it is mounted?


=== Changing resolution ===
# zfs set mountpoint=/roger mypool/roger
(Note the dataset name, ie pool+fs, starts with pool name 'mypool', no leading slash). ZFS remounts it for you.


This refers to the Beta ICS4. Probably is not useful any more, but I will leave it here for reference.
And remove it:
# zfs destroy mypool/roger


Changing resolution can be done by modifying the boot time scripts that the A10 uses. Usually done on a separate boot partition. For example, the Mele image has the files:
How you will probably create your media folder:


  mount /dev/mmcblk0p1 /mnt
  # zfs create -o mountpoint=/media -o atime=off -o compression=on -o encryption=on mypool/secure
  ls -l /mnt/
  Enter passphrase: $password
  evb.bin
  # zfs set sharenfs=rw=@192.168.11,root=@192.168.11 zpool/secure


git clone https://github.com/amery/sunxi-tools
Note I created "mypool/secure" (dataset name) but asked it to be mounted on "/media". Dataset name, vs mountpoint. Just as you can create "mypool/warez" and have it mounted as "/ftp"
cd sunxi-tools
make
./bin2fex /mnt/evb.bin > evb.fex   


Edit the file any odd way you want, changing '''screen0_output_type''' and '''screen0_output_mode'''. See modes here: [https://github.com/amery/linux-allwinner/blob/allwinner-v3.0-android-v2/include/linux/drv_display_sun4i.h#L132]
# zfs list mypool/secure
mypool/secure                906G  2.45T  906G  /media


./fex2bin evb.fex > /mnt/evb.bin
Confirm that the NFS sharing worked:


# showmount -e 127.0.0.1
export list for 127.0.0.1:
/media  @192.168.11


If you are running the Android 4 (ICS) Beta that was released, to change the resolution to HDMI 1080p, you can do this. Using either a terminal program on Android (ConnectionBot for example) or the USB Console (if connected).
CAVEAT: NFS will only work if it can look up hostnames. So your A100/PC needs to live in /etc/hosts on the NAS (and most likely NAS needs to be in hosts on those machines too). Or your router returns some name for those IPs when looked up.


On the mele root shell
When you set "sharenfs" Solaris will automatically share the volume, but you can control it manually as well.
setprop service.adb.tcp.port 5555
stop adbd
start adbd
netstat -na      # Check that it is listening on port 5555


On remote adb machine
  # zfs shareall
  adb connect 192.168.xxx.xxx    # Put in the Mele's IP
  # zfs unshare mypool/secure
  adb shell
adb> mount -t vfat /dev/block/nanda /mnt/obb
adb> exit
adb push script-HDMI-1080p60.bin /mnt/obb/
adb shell
adb> cd /mnt/obb
adb> busybox cp script-HDMI-1080p60.bin script.bin


If you don't want to edit the script file yourself, you can download my prepared one:
But you most likely will only need to "shareall" if you use "encryption" with your filesystem. If you do use encrypted, this is what you do after reboot:
[http://www.lundman.net/ftp/mele/script-HDMI-1080p60.bin script-HDMI-1080p60.bin]


=== U-boot ===
# zfs mount mypool/secure
Enter passphrase: $password
# zfs share mypool/secure
(Or # zfs shareall)


Since I added ZFS to u-boot for CuBox, and also patched in Samsungs EXT4 patches, I built hno's u-boot to test.
All ZFS attributes (or are they called properties?) can have user-defined values. As it happens, llink will read properties called "net.lundman:sharellink" and if set to "on" will add to ROOTs.


  https://github.com/lundman/uboot-allwinner/tree/zfs
  # zfs set net.lundman:sharellink=on mypool/secure


wget http://lundman.net/ftp/mele/sunxi-spl.bin
 
  dd if=sunxi-spl.bin of=/dev/sdc bs=1024 seek=8        # Obviously, '''sdc''' is my SDcard, change device to applicable.
=== Troubles ===
 
If you lose a HDD, pull the HDD out of the NAS. And insert a replacement drive.
 
First you need to tell the OS that a new disk is attached:
 
  # cfgadm -al
Ap_Id                                    Type        Receptacle  Occupant    Condition
sata1/5                                disk        connected    unconfigured  ok
 
# cfgadm -c configure sata1/5
 
If you have "autoreplace" set on the pool, you are done. But let's assume you have not.
 
# zpool status
            c10t5d0                FAILED      0    0    0
 
# zpool replace mypool c10t5d0 c10t5d0
 
# zpool status
action: Online the device using 'zpool online' or replace the device with
        'zpool replace'.
scan: resilvered 27.5G in 0h21m (27%) ETA 4 hours 12 minutes.
   
   
wget http://lundman.net/ftp/mele/u-boot.bin
        NAME                        STATE    READ WRITE CKSUM
dd if=u-boot.bin of=/dev/sdc bs=1024 seek=32          # Obviously, '''sdc''' is my SDcard, change device to applicable.
        mypool                      DEGRADED    0    0    0
            c10t5d0                FAILED      0    0    0
            c10t5d0/1              replacing    0    0    0
 
 
=== Snapshots ===
 


  U-Boot 2012.04.01-g39085db-dirty (May 29 2012 - 02:29:31) Allwinner Technology
Snapshots can be useful. If you are to try something new, or do some changes, upgrade OS, protect yourself from accidentally deleting all files.
 
# zfs list mypool/secure
  mypool/secure                906G  2.45T  906G  /media
# zfs snapshot mypool/secure@20110708
   
   
  CPU:  SUNXI Family
  # zfs list -t all
  Board: A10-EVB
  mypool/secure                            906G 2.45T  906G /media
  DRAM: 512 MiB
  mypool/secure@20110708                      0      -   906G  -
  MMC:   SUNXI SD/MMC: 0
 
  *** Warning - bad CRC, using default environment
To create a snapshot, just give the dataset name (mypool/secure) @ snapshot-name. It can be any name, but as convention, many people use the date. Note the snapshot is taking 0 bytes of space. It only records the differences. So, let's delete something:
 
  -rwxrwxrwx  1 501 501  250974208 2007-08-22 19:15 make_big_words.avi
# rm make_big_words.avi
   
   
  sun4i#zfsload
  mypool/secure                            906G  2.45T  905G  /media
  zfsload - load binary file from a ZFS filesystem
  mypool/secure@20110708                    238M      -   906G  -
 
Deleted 250M worth of data, so the snapshot now takes up 238M.
 
If you are happy with the changes, just destroy the snapshot to release the space back.
 
# zfs destroy mypool/secure@20110708
 
Am I the only one who is unhappy that the same command 'destroy' is used for both? Since "zfs destroy mypool/secure" and "zfs destroy mypool/secure@20110708" are ''vastly'' different.
Or even "mypool/secure @20110708". Oops, that space....
 
However, if you changed your mind, and want it back:


  sun4i#zfsload mmc 0:2 0x48000000 /boot/@/uImage
  # zfs rollback mypool/secure@20110708
Loading file "/boot/@/uImage" from mmc device 0:2 xxa2
  # zfs list -t all
  zfs fsname = '/boot/' snapname='<NULL>' filename = '/uImage'
4230340 bytes read
   
   
  sun4i#bootm 0x48000000
  mypool/secure                            906G 2.45T   906G  /media
  ## Booting kernel from Legacy Image at 48000000 ...
  mypool/secure@20110708                  1.60K      -  906G -
  Image Name:   Linux-3.0.8+
  Image Type:  ARM Linux Kernel Image (uncompressed)
  Data Size:    4230276 Bytes = 4 MiB
  Load Address: 40008000
  Entry Point: 40008000
  Verifying Checksum ... OK
  Loading Kernel Image ... OK
  OK
   
   
  Starting kernel ...
  # ls -l make_big_words.avi
-rwxrwxrwx 1 501 501 250974208 2007-08-22 19:15 make_big_words.avi
   
   
  DRAM: 512[    0.000000] Initializing cgroup subsys cpuset
  # zfs destroy mypool/secure@20110708
 


=== SMB ===


=== Android Kernel ===
How to share with SMB


I wanted to replace the ICS4 kernel with my own, for the nic fixes. These are the steps I took:
Enable the SMB servers
# svcadm enable -r smb/server


  git clone https://github.com/amery/linux-allwinner
Join a workgroup
  git branch lichee-3.0.8-sun4i
  # smbadm join -w ''workgroup-name''
  make sun4i_crane_defconfig
 
   
Make sure PAM is told to keep SMB passwords as well:
Check that .config has
 
  CONFIG_MODVERSIONS=y
# vi /etc/pam.conf
  # CONFIG_MODULE_SRCVERSION_ALL is not set
  other password required pam_smb_passwd.so.1 nowarn
at the end of the file.
 
Set your password again to save SMB password
# passwd ''username''
 
Turn on sharing for your dataset
  # zfs set sharesmb=on mypool/secure
  OR
For example, to specify a resource name of myfs for the ztank/myfs file system, type:
  # zfs set sharesmb=name=myfs ztank/myfs
 
Windows is case insensitive, so you most likely want to share your filesystems like this:
 
  # zfs create -o casesensitivity=mixed -o nbmand=on -o sharesmb=name=yourfs ztank/yourfs
 
Verify that it is being shared:


The wemac nic was panicing on boot everytime, until I changed this:
# sharemgr show -vp


drivers/net/sun4i/sun4i_wemac.c
=== SMB Solaris 11.1 ===
#define PHY_POWER 0  /* was 1 */


make uImage
Unfortunately, Oracle changed everything about sharesmb with Solaris 11.1


From android, I used ConnectBot to make a copy of the 'boot' partition, nandc.


adb shell
    pkg install /service/file-system/smb
adb> dd if=/dev/block/nandc of=/mnt/sdcard/nandc bs=65536
    svcadm enable -r smb/server
adb pull /mnt/sdcard/nandc
    echo "password required    pam_smb_passwd.so.1    nowarn" >> /etc/pam.d/other
    useradd public
    smbadm enable-user public
    zfs set share=name=fs1,path=/rpool/fs1,prot=smb rpool/fs1
    zfs set sharesmb=on rpool/fs1
    passwd -r files public


Then split it up into kernel and ramfs, you can find split_bootimg.pl my storage area (url above)
=== Solaris Admin ===


# ./split_bootimg.pl nandc
Page size: 2048 (0x00000800)
Kernel size: 8410564 (0x008055c4)
Ramdisk size: 975609 (0x000ee2f9)
Second size: 0 (0x00000000)
Board name:
Command line:
Writing nandc-kernel ... complete.
Writing nandc-ramdisk.gz ... complete.


The idea is to make a new kernel, that looks roughly the same as nandc-kernel, and re-use the nandc-ramdisk.gz
General Solaris crap:


Once the compile has finished, we make a new image. According to the nandc ANDROID! header, the base address for Mele is 0x40000000
The old SYSV style /etc/init.d and /etc/rc2.d/ still exists, but is no longer used. Some older, or legacy programs, may still put start/stop scripts in there. They will work.


  # mkbootimg --base 40000000 --kernel arch/arm/boot/Image --ramdisk ../nandc-ramdisk.gz -o ../mynewimage.img
The new system uses SMF. List all your services, and states:


Now I boot into Miniand image on SD card, use my nand.ko to load the device for /dev/nand*. You can find my Miniand kernel '''uImage''' and '''nand.ko''' in the storage area too. The default Miniand kernel did not come with nand driver.
# svcs -a
legacy_run    Jun_06  lrc:/etc/rc2_d/S72autoinstall
disabled      Jun_06  svc:/network/ipsec/ike:default
disabled      Jun_06  svc:/network/ftp:default
online        Jun_06  svc:/network/ssh:default
(Insert giant list here).


# modprobe nand.ko
You can see S72autoinstall ran with legacy stuff. You have ipsec/ike, but it is not to run. And you have ssh (daemon) and it is running just fine.
# dd if=mynewimage.img of=/dev/nandc bs=2048
# sync
# reboot


and remove the SD card to boot Android. If you want to undo, and go back to ICS4, put '''nandc''' file instead of '''mynewimage.img''' in the '''dd''' line above.
If something dies (say, sshd) the SMF system will automatically restart it. This is the main advantage with the new system


=== Mele's Wired Network Interface ===
To enable something to run:


The wired nic in the Mele is a '''wemac''' from Davidcom. It is unfortunately quite poor. You will get decent 100MB speeds from it, but it uses the CPU. If you do any transfers while trying to watch video (including watching video over network) it will stutter for 1080p. Interestingly if you use SD, or USB while watching, it has no problem.
# svcadm enable ftp
You could use "svcadm enable svc:/network/ftp:default" here, but that is a bit tedious, so as long as it is unique, you can shorten it.


The WIFI driver sits on the USB bus and is not affected by this.
# svcs ftp
STATE          STIME    FMRI
online        Jun_06  svc:/network/ftp:default


Using a USBEthernet dongle (I tried an Apple brand) also works without issues.
turn it off:


# svcadm disable ftp


=== ZFS on Android ===
Restarting:


I have already ported ZFS to ARM, so that should just work if you compile ZFS with your kernel. But I also wanted to see if I can get ZFS to work with Android. The modules do load ok, but execution does not work:
# svcadm restart llink


# cd /mnt/sdcard/
Although, since you know it is going to be restarted automatically, you can just "pkill llink". I mean, it's rude, but works :)
# insmod spl.ko && insmod zavl.ko&&insmod znvpair.ko&&insmod zunicode.ko&&insmod zcommon.ko&&insmod zfs.ko&&insmod zpios.ko&&cp zpool /mnt/obb/&&chmod 755 /mnt/obb/zpool
# cd /mnt/obb
# strace -f ./zpool create melepool /dev/block/sda1   
open("/dev/block/sda1", O_WRONLY|O_EXCL|O_LARGEFILE) = 6
write(6, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
fdatasync(6)                            = 0
close(6)                                = 0
open("/melepool", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|0x80000) = -1 ENOENT (No such file or directory)
ioctl(3, ITE_GPIO_IN


and it hangs.
If something dies too many times, they can go into "maintenance" state:


# svcs llink
STATE          STIME    FMRI
maintenance  Jun_06  svc:/network/llink:default


=== djmount for Android ===
Then you need to clear its state first.


So one option is to have a mediaplayer with UPNP ability, like that of BubbleUPNP or PlugPlayer. However, both of these do poorly with Mele's remote control. With Bubble you can not click on Directories to enter them, but have to Mouse-Mode in/out to do so.
# svcadm clear llink
# svcadm enable llink


So one option is to mount all UPNP devices as a directory. Since Mele's kernel already comes with FUSE, I compiled '''djmount''' for it (patched version with >2GB size fixed).
Note that SMF has dependency built in. So ssh it dependent on network/physical etc, and will only start when those run correctly:


  % adb push djmount /mnt/obb
  # svcs -l ssh
  % adb shell
dependency  require_all/none svc:/system/filesystem/local (online)
  # cd /mnt/obb
  dependency  optional_all/none svc:/system/filesystem/autofs (online)
  # chmod 755 djmount
  dependency  require_all/none svc:/network/loopback (online)
  # ./djmount -o allow_other /mnt/sdcard/Pictures                # No reason to pick "Pictures" I just wanted an existing directory
  dependency  require_all/none svc:/network/physical (multiple)
  # ls -l Pictures/                                
  dependency  require_all/none svc:/system/cryptosvc (online)
-r--r--r-- root    root          49 2000-01-01 20:00 devices
  dependency  require_all/none svc:/system/utmp (online)
  dr-xr-xr-x root    root              2000-01-01 20:00 llink-daemon UPNP Media Server (MediaServer) : 1
  dependency  optional_all/error svc:/network/ipfilter:default (disabled)
  dependency  require_all/restart file://localhost/etc/ssh/sshd_config (online)
   
   
# ls -l Pictures/llink-daemon\ UPNP\ Media\ Server\ \ \(MediaServer\)\ \:\ 1/
So if something is not starting, it may not be something wrong with that program, but rather that a dependent service is not running.
dr-xr-xr-x root    root              2000-01-01 20:00 DVD
dr-xr-xr-x root    root              2000-01-01 20:00 Game of Thrones
dr-xr-xr-x root    root              2000-01-01 20:00 Music
dr-xr-xr-x root    root              2000-01-01 20:00 Video
-r--r--r-- root    root    14010368 2000-01-01 20:00 movie.m4v


And indeed, if you use the File browser in ICS4, you can just enter that directory, and play any video. Note that '''djmount''' is pretty slow on listing directories, and I think we might want to look at speeding that up if we are to use it long term. Also, increase the cache timeout from 60s to something much higher, like 10 minutes.


There is a "hd" program that lists some bits, like your HDD temperatures:


# /data/hd
Device    Serial        Vendor  Model            Rev  Temperature
------    ------        ------  -----            ---- -----------
c10t0d0p0  43M324HP783S  ATA      OCZ-AGILITY      1.4  255 C (491 F)
c10t1d0p0  XHJDWS510824  ATA      SAMSUNG HD103SI  1113 31 C (87 F)
c10t2d0p0  XGJ90Z400082  ATA      SAMSUNG HD103SI  1118 35 C (95 F)
c10t3d0p0  XGJ90SB01390  ATA      SAMSUNG HD103SI  1118 34 C (93 F)
c10t4d0p0  XGJ90Z400080  ATA      SAMSUNG HD103SI  1118 34 C (93 F)


=== PS3EYE WebCam ===
I assure you that the SSD is not on fire.


I wanted to see if the PS3 Eye would work with Mele, and Skype.
Power management is in /etc/power.conf
 
# cat /etc/power.conf
Video:
device-dependency-property removable-media /dev/fb
autopm                  enable
autoS3                  default
cpupm                  enable
cpu-threshold          1s
# Auto-Shutdown        Idle(min)      Start/Finish(hh:mm)    Behavior
autoshutdown            30              9:00 9:00              noshutdown
device-thresholds  /pci@0,0/pci8086,244e@1e/pci11ab,11ab@0/disk@0,0    10m
device-thresholds  /pci@0,0/pci8086,244e@1e/pci11ab,11ab@0/disk@1,0    10m
device-thresholds  /pci@0,0/pci8086,244e@1e/pci11ab,11ab@0/disk@2,0    10m
device-thresholds  /pci@0,0/pci8086,244e@1e/pci11ab,11ab@0/disk@3,0    10m
device-thresholds  /pci@0,0/pci8086,244e@1e/pci11ab,11ab@0/disk@4,0    10m


# insmod gspca_main.ko                               
# insmod gspca_ov534.ko videomode=13     


That makes the camera work with Skype and '''Zoom Camera''' app. When I tried one of the 640x480 modes it just hangs, so currently it is 320x240@60.


Audio:


No idea. The device shows:
* The package manager is called "pkg".


  # cat /proc/asound/cards                             
  # pkg list
0 [sun4icodec    ]: sun4i-CODEC - sun4i-CODEC
                      sun4i-CODEC  Audio Codec
1 [sun4isndhdmi  ]:  - sun4i-sndhdmi
                      sun4i-sndhdmi
2 [CameraB409241  ]: USB-Audio - USB Camera-B4.09.24.1
                      OmniVision Technologies, Inc. USB Camera-B4.09.24.1 at usb-sw-ehci-1.3, high sp
3 [sun4isndspdif  ]:  - sun4i-sndspdif
                      sun4i-sndspdif


And we get the device nodes:
# pkg install gnu-emacs-no-x11


  # ls -l /dev/snd/
  # pkg search python
crw-rw---- system  audio    116,  0 2012-07-03 14:12 controlC0
crw-rw---- system  audio    116,  32 2012-07-03 14:12 controlC1
crw-rw---- system  audio    116,  64 2012-07-03 14:12 controlC2
crw-rw---- system  audio    116,  96 2012-07-03 14:12 controlC3
crwxrwxrwx system  system  116,  24 2012-07-03 14:12 pcmC0D0c
crwxrwxrwx system  system  116,  16 2012-07-03 14:12 pcmC0D0p
crw-rw---- system  audio    116,  48 2012-07-03 14:12 pcmC1D0p
crw-rw---- system  audio    116,  88 2012-07-03 14:12 pcmC2D0c
crw-rw---- system  audio    116, 112 2012-07-03 14:12 pcmC3D0p
crw-rw---- system  audio    116,  33 2012-07-03 14:12 timer


But no idea how to tell Android to use the USB device as the main microphone.


# setprop usb.audio.cap.device pcmC0D0c
# setprop media.audio.in.mode usb


Neither of those work.
*  llink lives in /usr/local/etc/llink/ with binaries in /usr/local/bin/

Latest revision as of 00:16, 24 April 2013

$ ssh lraid5
Last login: Sun Jul  3 09:14:04 2011 from totoro
Oracle Corporation      SunOS 5.11      snv_151a        November 2010
lundman@solaris:~$  sudo bash
Password:
root@solaris:/home/lundman# # uname -a
SunOS solaris 5.11 snv_151a i86pc i386 i86pc Solaris

Drives attached to the system:

# cfgadm -al
Ap_Id                          Type         Receptacle   Occupant     Condition
sata1/0::dsk/c10t0d0           disk         connected    configured   ok
sata1/1::dsk/c10t1d0           disk         connected    configured   ok
sata1/2::dsk/c10t2d0           disk         connected    configured   ok
sata1/3::dsk/c10t3d0           disk         connected    configured   ok
sata1/4::dsk/c10t4d0           disk         connected    configured   ok
sata1/5                        sata-port    empty        unconfigured ok

(Ok, there should be a disk in sata1/5, but the kids probably popped it out)


pools

There are two parts to ZFS. The "pool" of storage, and "file-systems". All pool commands are done with "zpool" and all filesystem commands are done with "zfs".


List your pools, you will initially only have the boot pool:

# zpool list
NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
rpool  29.8G  5.46G  24.3G    18%  1.00x  ONLINE  -
mypool 4.53T  1.39T  3.14T    30%  1.00x  DEGRADED  -

Default boot is called "rpool" in Solaris, you can change the name if you want.


Check out the status of your zpools:

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

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

errors: No known data errors

 pool: mypool
state: DEGRADED
status: One or more devices has been removed by the administrator.
       Sufficient replicas exist for the pool to continue functioning in a
       degraded state.
action: Online the device using 'zpool online' or replace the device with
       'zpool replace'.
scan: resilvered 27.5G in 0h21m with 0 errors on Thu Jun 30 16:19:20 2011
config:

       NAME                        STATE     READ WRITE CKSUM
       mypool                      DEGRADED     0     0     0
         raidz1-0                  DEGRADED     0     0     0
           c10t5d0                 REMOVED      0     0     0
           c10t4d0                 ONLINE       0     0     0
           c10t3d0                 ONLINE       0     0     0
           c10t2d0                 ONLINE       0     0     0
           c10t1d0                 ONLINE       0     0     0
       logs
         /dev/zvol/dsk/rpool/slog  ONLINE       0     0     0

errors: No known data errors


As you can see, "rpool" is the boot pool (root pool), on disk "c10t0d0". (controller 10, target 0, device 0, slice 0). Slice is "partition" in Solaris world. Device is no longer used, as it is a legacy thing from scsi days. "rpool" is a single disk pool.

My main data pool, "mypool" is missing a disk, but otherwise fine lookin'. Finally the "slog" of "mypool" (transaction logs in ZFS) is stored on SSD, this is for speed. This is a "raidz1" (raid 5) setup. I can lose one disk without data loss. (20% used on parity). Use "raidz2" if you want to be able to lose 2 HDDs without loss. (40% used on parity), and so on. You can also "mirror" (raid1).


File systems

ZFS has two kinds of filesystems. Regular ZFS file system, and a "Virtual-Volume". The latter creates a virtual block device (fake disk) which you can then use as a regular disk, ie, format it "ext3" if you really want to, mount it etc. In this case, we create a Volume for "swap", and for "slog". The size of both ZFS-fs, and Volumes, can be changed on the fly.


Listing your filesystems:

# zfs list
NAME                        USED  AVAIL  REFER  MOUNTPOINT
rpool                      8.04G  21.2G    93K  /rpool
rpool/ROOT                 2.84G  21.2G    31K  legacy
rpool/ROOT/realtek         2.84G  21.2G  2.71G  /
rpool/ROOT/solaris         2.04M  21.2G  2.52G  /
rpool/dump                 1019M  21.2G  1019M  -
rpool/export                141M  21.2G    32K  /export
rpool/export/home           141M  21.2G    32K  /export/home
rpool/export/home/lundman   141M  21.2G   141M  /export/home/lundman
rpool/slog                 2.06G  21.9G  1.36G  -
rpool/swap                    2G  23.1G   123M  -

mypool                     1.11T  2.45T  55.9K  /mypool
mypool/backup               232G  2.45T   232G  /backup
mypool/data                1.42G  2.45T  1.42G  /data
mypool/secure               906G  2.45T   906G  /media
mypool/swap                   2G  2.45T  25.6K  -
mypool/test                54.3K  2.45T  54.3K  /mypool/test


Note that default Solaris creates lots of little filesystems, one for each boot (realtek & solaris), one for "dump", "swap", "export" "export/home" and "export/home/lundman". But then, filesystems are really cheap in ZFS, so, why not. Gives you lots of control. Traditionally filesystems were quite monolithic, where as in ZFS they are closer to "mkdir".

Checking the attributes of the "rpool":

# zpool get all rpool
NAME   PROPERTY       VALUE               SOURCE
rpool  size           29.8G               -
rpool  capacity       18%                 -
rpool  altroot        -                   default
rpool  health         ONLINE              -
rpool  guid           15126656221277650189  default
rpool  version        31                  default
rpool  bootfs         rpool/ROOT/realtek  local
rpool  delegation     on                  default
rpool  autoreplace    off                 default
rpool  cachefile      -                   default
rpool  failmode       wait                default
rpool  listsnapshots  off                 default
rpool  autoexpand     off                 default
rpool  dedupditto     0                   default
rpool  dedupratio     1.00x               -
rpool  free           24.3G               -
rpool  allocated      5.46G               -
rpool  readonly       off                 -

You won't change the pool attributes that often, but in this case, "failmode" defines what the system should do if the pool as a failure. In this case "wait" (ie, hang until it is fixed.) Which is not so useful. It is often better for it to "continue" in failure mode, so we can try to fix it.

# zpool set failmode=continue rpool

autoreplace controls if it should automatically replace dead HDD with new HDDs, if it detects you have replaced the hardware. Why not? Unless you want to manually try the commands of course.

autoexpand controls if it should automatically make the pool larger, when all HDDs in the pool have been replaced with larger disks. You probably want this on too.

But we are actually looking at "rpool", the SSD, so the last two options do not really make sense. You want to set the for your data pool though.

Likewise, ZFS filesystems (and Volumes) also have attributes, these are more fun to play with.

# zfs get all rpool
rpool  type                            filesystem                      -
rpool  creation                        Fri Dec 24  2:38 2010           -
rpool  used                            8.04G                           -
rpool  available                       21.2G                           -
rpool  referenced                      93K                             -
rpool  compressratio                   1.00x                           -
rpool  mounted                         yes                             -
rpool  quota                           none                            default
rpool  reservation                     none                            default
rpool  recordsize                      128K                            default
rpool  mountpoint                      /rpool                          default
rpool  sharenfs                        off                             default
rpool  checksum                        on                              default
rpool  compression                     off                             default
rpool  atime                           on                              default
rpool  nbmand                          off                             default
rpool  sharesmb                        off                             default
rpool  dedup                           off                             default
rpool  encryption                      off                             -

(this list is considerably larger, I just picked out some of the juicier options).

Most are self-explanatory. But note that "quota" here means the "file-system size". If not set (normal) you can create files in there until the pool is full. If set (say 100G) you can only go to 100G of data. "reservation" refers to how much space the fs should reserve in advance. If you set quota to 100G, that directory (user) can fill 100G, but it allocates no space. So if the pool runs out, the user can not actually reach 100G. If you want it to pre-allocate the promised 100G, you set reservation. You probably don't want to. But do note we set it for "swap" since you don't want swap to NOT have the space promised.

"sharenfs" and "sharesmb" controls if it should exported as NFS, or samba. atime is good to disable (speed). "compression" is often good to have on (lessens the disk read/write and expense of CPU - alas, does nothing for media like movies).

Checking swap:

# zfs get all rpool/swap
rpool/swap  compression                     off
rpool/swap  volsize                         2G
rpool/swap  refreservation                  2G

So, swap set to use 2G of space, pre-allocated. Note your ZFS Volumes can be compressed. So if you put a "ext3" filesystem on it, ZFS will compress the blocks under it, to take up less space. Very sexy.




You use "format" command in Solaris to play with partitions. This is legacy crap you do no longer need to bother with (Since the boot is already done). Looks like this:

# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
      0. c10t0d0 <ATA    -OCZ-AGILITY    -1.4  cyl 3889 alt 2 hd 255 sec 63>
         /pci@0,0/pci1043,8496@11/disk@0,0
      1. c10t1d0 <ATA-SAMSUNG HD103SI-1113-931.51GB>
         /pci@0,0/pci1043,8496@11/disk@1,0
      2. c10t2d0 <ATA-SAMSUNG HD103SI-1118-931.51GB>
         /pci@0,0/pci1043,8496@11/disk@2,0
      3. c10t3d0 <ATA-SAMSUNG HD103SI-1118-931.51GB>
         /pci@0,0/pci1043,8496@11/disk@3,0
      4. c10t4d0 <ATA-SAMSUNG HD103SI-1118-931.51GB>
         /pci@0,0/pci1043,8496@11/disk@4,0
Specify disk (enter its number):


Also note, these days disks over 1TB will generally have 4KB sectors, instead of 512 bytes. Since 512 can run with 4KB sized pool without side-effects, but 4KB HDD can not always handle 512 byte pools without degradation, it is recommended that you create pools for 4KB disks, even if you don't have any right now.

Create a pool from disks:

# zpool create -o async=12 mypool raidz c10t1d0 c10t2d0 c10t3d0 c10t4d0 c10t5d0

You can name it anything you want, don't need to use 'mypool'

# zpool status mypool

zpool don't have to be actual disks either, you can make it on fake files:

# mkfile 1G /var/tmp/fakedisk1
# zpool create playpool /var/tmp/fakedisk1


When you do it "for realz" you want slog on SSD. So create a volume for slog, usually the same size as memory.

# zfs create -V 2G rpool/slog

(-V creates a Volume instead of fs, creating volumes creates a dev node at /dev/zvol/dsk/$poolname/$volumename)

# zfs set refreservation=2G rpool/slog

(pre-allocate the disk space, so slog is guaranteed 2G)

# zfs add mypool log /dev/zvol/dsk/rpool/slog

(Attach the Volume slog from pool rpool, to pool zpool)


Create a file-system:

# zfs create mypool/roger
mypool/roger            2.5T   55K  2.5T   1% /mypool/roger

Don't like where it is mounted?

# zfs set mountpoint=/roger mypool/roger

(Note the dataset name, ie pool+fs, starts with pool name 'mypool', no leading slash). ZFS remounts it for you.

And remove it:

# zfs destroy mypool/roger

How you will probably create your media folder:

# zfs create -o mountpoint=/media -o atime=off -o compression=on -o encryption=on mypool/secure
Enter passphrase: $password
# zfs set sharenfs=rw=@192.168.11,root=@192.168.11 zpool/secure

Note I created "mypool/secure" (dataset name) but asked it to be mounted on "/media". Dataset name, vs mountpoint. Just as you can create "mypool/warez" and have it mounted as "/ftp"

# zfs list mypool/secure
mypool/secure                906G  2.45T   906G  /media

Confirm that the NFS sharing worked:

# showmount -e 127.0.0.1
export list for 127.0.0.1:
/media  @192.168.11

CAVEAT: NFS will only work if it can look up hostnames. So your A100/PC needs to live in /etc/hosts on the NAS (and most likely NAS needs to be in hosts on those machines too). Or your router returns some name for those IPs when looked up.

When you set "sharenfs" Solaris will automatically share the volume, but you can control it manually as well.

# zfs shareall
# zfs unshare mypool/secure

But you most likely will only need to "shareall" if you use "encryption" with your filesystem. If you do use encrypted, this is what you do after reboot:

# zfs mount mypool/secure
Enter passphrase: $password
# zfs share mypool/secure
(Or # zfs shareall)

All ZFS attributes (or are they called properties?) can have user-defined values. As it happens, llink will read properties called "net.lundman:sharellink" and if set to "on" will add to ROOTs.

# zfs set net.lundman:sharellink=on mypool/secure


Troubles

If you lose a HDD, pull the HDD out of the NAS. And insert a replacement drive.

First you need to tell the OS that a new disk is attached:

# cfgadm -al
Ap_Id                                    Type         Receptacle   Occupant     Condition
sata1/5                                 disk         connected    unconfigured   ok
# cfgadm -c configure sata1/5

If you have "autoreplace" set on the pool, you are done. But let's assume you have not.

# zpool status
           c10t5d0                 FAILED      0     0     0
# zpool replace mypool c10t5d0 c10t5d0
# zpool status
action: Online the device using 'zpool online' or replace the device with
       'zpool replace'.
scan: resilvered 27.5G in 0h21m (27%) ETA 4 hours 12 minutes.

       NAME                        STATE     READ WRITE CKSUM
       mypool                      DEGRADED     0     0     0
           c10t5d0                 FAILED       0     0     0
           c10t5d0/1               replacing    0     0     0


Snapshots

Snapshots can be useful. If you are to try something new, or do some changes, upgrade OS, protect yourself from accidentally deleting all files.

# zfs list mypool/secure
mypool/secure                906G  2.45T   906G  /media
# zfs snapshot mypool/secure@20110708

# zfs list -t all
mypool/secure                             906G  2.45T   906G  /media
mypool/secure@20110708                       0      -   906G  -

To create a snapshot, just give the dataset name (mypool/secure) @ snapshot-name. It can be any name, but as convention, many people use the date. Note the snapshot is taking 0 bytes of space. It only records the differences. So, let's delete something:

-rwxrwxrwx  1 501 501  250974208 2007-08-22 19:15 make_big_words.avi
# rm make_big_words.avi

mypool/secure                             906G  2.45T   905G  /media
mypool/secure@20110708                    238M      -   906G  -

Deleted 250M worth of data, so the snapshot now takes up 238M.

If you are happy with the changes, just destroy the snapshot to release the space back.

# zfs destroy mypool/secure@20110708

Am I the only one who is unhappy that the same command 'destroy' is used for both? Since "zfs destroy mypool/secure" and "zfs destroy mypool/secure@20110708" are vastly different. Or even "mypool/secure @20110708". Oops, that space....

However, if you changed your mind, and want it back:

# zfs rollback mypool/secure@20110708
# zfs list -t all

mypool/secure                             906G  2.45T   906G  /media
mypool/secure@20110708                   1.60K      -   906G  -

# ls -l make_big_words.avi 
-rwxrwxrwx 1 501 501 250974208 2007-08-22 19:15 make_big_words.avi

# zfs destroy mypool/secure@20110708


SMB

How to share with SMB

Enable the SMB servers

# svcadm enable -r smb/server

Join a workgroup

# smbadm join -w workgroup-name

Make sure PAM is told to keep SMB passwords as well:

# vi /etc/pam.conf
other password required pam_smb_passwd.so.1 nowarn

at the end of the file.

Set your password again to save SMB password

# passwd username

Turn on sharing for your dataset

# zfs set sharesmb=on mypool/secure
OR 
For example, to specify a resource name of myfs for the ztank/myfs file system, type:
# zfs set sharesmb=name=myfs ztank/myfs

Windows is case insensitive, so you most likely want to share your filesystems like this:

# zfs create -o casesensitivity=mixed -o nbmand=on -o sharesmb=name=yourfs ztank/yourfs

Verify that it is being shared:

# sharemgr show -vp

SMB Solaris 11.1

Unfortunately, Oracle changed everything about sharesmb with Solaris 11.1


   pkg install /service/file-system/smb
   svcadm enable -r smb/server
   echo "password required    pam_smb_passwd.so.1    nowarn" >> /etc/pam.d/other
   useradd public
   smbadm enable-user public
   zfs set share=name=fs1,path=/rpool/fs1,prot=smb rpool/fs1
   zfs set sharesmb=on rpool/fs1
   passwd -r files public

Solaris Admin

General Solaris crap:

The old SYSV style /etc/init.d and /etc/rc2.d/ still exists, but is no longer used. Some older, or legacy programs, may still put start/stop scripts in there. They will work.

The new system uses SMF. List all your services, and states:

# svcs -a
legacy_run     Jun_06   lrc:/etc/rc2_d/S72autoinstall
disabled       Jun_06   svc:/network/ipsec/ike:default
disabled       Jun_06   svc:/network/ftp:default
online         Jun_06   svc:/network/ssh:default

(Insert giant list here).

You can see S72autoinstall ran with legacy stuff. You have ipsec/ike, but it is not to run. And you have ssh (daemon) and it is running just fine.

If something dies (say, sshd) the SMF system will automatically restart it. This is the main advantage with the new system

To enable something to run:

# svcadm enable ftp

You could use "svcadm enable svc:/network/ftp:default" here, but that is a bit tedious, so as long as it is unique, you can shorten it.

# svcs ftp
STATE          STIME    FMRI
online         Jun_06   svc:/network/ftp:default

turn it off:

# svcadm disable ftp

Restarting:

# svcadm restart llink

Although, since you know it is going to be restarted automatically, you can just "pkill llink". I mean, it's rude, but works :)

If something dies too many times, they can go into "maintenance" state:

# svcs llink
STATE          STIME    FMRI
maintenance   Jun_06   svc:/network/llink:default

Then you need to clear its state first.

# svcadm clear llink
# svcadm enable llink

Note that SMF has dependency built in. So ssh it dependent on network/physical etc, and will only start when those run correctly:

# svcs -l ssh
dependency   require_all/none svc:/system/filesystem/local (online)
dependency   optional_all/none svc:/system/filesystem/autofs (online)
dependency   require_all/none svc:/network/loopback (online)
dependency   require_all/none svc:/network/physical (multiple)
dependency   require_all/none svc:/system/cryptosvc (online)
dependency   require_all/none svc:/system/utmp (online)
dependency   optional_all/error svc:/network/ipfilter:default (disabled)
dependency   require_all/restart file://localhost/etc/ssh/sshd_config (online)

So if something is not starting, it may not be something wrong with that program, but rather that a dependent service is not running.


There is a "hd" program that lists some bits, like your HDD temperatures:

# /data/hd

Device    Serial        Vendor   Model             Rev  Temperature
------    ------        ------   -----             ---- -----------
c10t0d0p0  43M324HP783S  ATA      OCZ-AGILITY       1.4  255 C (491 F)
c10t1d0p0  XHJDWS510824  ATA      SAMSUNG HD103SI   1113 31 C (87 F)
c10t2d0p0  XGJ90Z400082  ATA      SAMSUNG HD103SI   1118 35 C (95 F)
c10t3d0p0  XGJ90SB01390  ATA      SAMSUNG HD103SI   1118 34 C (93 F)
c10t4d0p0  XGJ90Z400080  ATA      SAMSUNG HD103SI   1118 34 C (93 F)

I assure you that the SSD is not on fire.

Power management is in /etc/power.conf

# cat /etc/power.conf
device-dependency-property removable-media /dev/fb

autopm                  enable
autoS3                  default

cpupm                   enable
cpu-threshold           1s
# Auto-Shutdown         Idle(min)       Start/Finish(hh:mm)     Behavior
autoshutdown            30              9:00 9:00               noshutdown

device-thresholds  /pci@0,0/pci8086,244e@1e/pci11ab,11ab@0/disk@0,0    10m
device-thresholds  /pci@0,0/pci8086,244e@1e/pci11ab,11ab@0/disk@1,0    10m
device-thresholds  /pci@0,0/pci8086,244e@1e/pci11ab,11ab@0/disk@2,0    10m
device-thresholds  /pci@0,0/pci8086,244e@1e/pci11ab,11ab@0/disk@3,0    10m
device-thresholds  /pci@0,0/pci8086,244e@1e/pci11ab,11ab@0/disk@4,0    10m



  • The package manager is called "pkg".
# pkg list
# pkg install gnu-emacs-no-x11
# pkg search python


  • llink lives in /usr/local/etc/llink/ with binaries in /usr/local/bin/