The ADATA S596 64GB SSD (500 series)

The controller on this SSD is the jmf612, along with the RAM chip (Cache) hynix H5PS1G63EFR (SDRAM) (64m X 16BIT) = 1Gbit which is 128MB (128 MBYTE).

This chip does not suffer from the latency problem in the JMF601A/602A chips, (jmf612 is 2009 while JMF601A is 2006).

The memory that comes with the drive is made by intel (29F32G08AAMDB), 4GB per chip, With 16 such chips, we have 64GB of flash on the board, the photos will follow once i get them off my camera and onto this blog.

The reason why i am keeping record here is that this drive is probably going to be used as a bcache cache device, and i am concerned about reliability, Granted that it is 90% read scenario, some websites are claiming that data corruption is a downside, but not providing any elaboration, http://alatest.co.uk/../corsair-reactor-r60-jmicron-jmf612-ssd/po3-116271270,383/ (The crosair reactor-r60 is identical to this drive)

The drive is claimed to have speeds of read 240 write 170, compression is not a factor in this as other drives use compression to gain speed, something that is only good for certain types of data

There is also a new firmware at the adata website that you should make sure is installed, ADATA S596 Firmware Update Tool V1.0

NOTES:
Drives with this controller include

  • Patriot Zephyr SSD
  • Corsair Reactor-r60
  • Active Media Predator-X7
  • Western Digital SiliconEdge Blue
  • Kingston V-series

Advanced Linux SSD caching for hard drives on Debian Jessie – bcache and enhanceIO

Please note, i am keeping this thread for myself as a reminder, so if sometimes you feel that it is getting too general, it is probably more of a reminder for me.

Also note that i am organizing this post as i go as i spend some time creating my new MySQL machine every day, so this is an ACTIVE work in progress

—————————————————
First note, the benefits of RAID 0 on the SSDs is more about wear than it is about speed.
Here is why and how

1- All modern disks use wear leveling to prolong the life of your disk, bcache does nothing in this regard, so using thumb drives is not very smart.
2- Your SSD has to be larger than the active data set, otherwise, bcache or any other will start kicking out data and writing in it’s place too often, wearing your disk, yet, if the data that is always accessed on your hard drive is about 500GBs of your 3TB disk, and your cache drive is more than 500GBs, odds are that your disk will probably send this data, then spin down because everything we need is already on the SSD reducing the wear to almost nothing. If you do not have a large enough SSD, odds are you will save their life with a RAID setup, either software or hardware, it makes no difference.
3- Larger disks have longer lives in general with or without raid for all purposes, the reason is arithmetically simple, the larger the disk, the linger it takes for a flash chip to get it’s turn for a write again because the others need to get their turn first, the larger the disk, the more the banks, hence, the longer the useful life.
4- Erase commands are expensive, And even with a workaround, trim support means nothing on a busy server
—————————————————
My own setup

1- My computer has 6 sata ports (ASUS P9X79).
2- I prefer to never group spinning hard drives in one metal case that does not have vibration isolation, so the mainboard SATA will host the 5 SSDs, and the main hard drive (2TB black).
3- I have 2 PCIe 2 port esata cards (silicon image supporting port multiplier)
4- 1 SATA port multiplier (Silicon image) that even though has raid function, is probably more reliable in JBOD mode, where the 5 spinning disks other than the main disk will need to live.

Most data on the 6 spinning disks is only stored and seldom accessed. furthermore, most of this data does not get cached because it is accessed sequentially.

The boot partition of the hard drive (Spinning) is not cached, the second partition is, this is safer as the system can boot anyways, then the raid array and the bcache initialized with no unforeseen effects, boot time is not so important as the PC is always on, we reboot it once a year

—————————————————
Note for self:
1- What are the possibilities of 2 cache layers, one with write-back, the other is only for read cache.
Possible Advantages:
You can use less reliable flash thumb drives with no wear leveling mechanism as an extra cache layer, where failure will not cause data corruption, but will leave more space for the SSDs
Overcache problem considerations ?
The SSD will initially get the same cache as the thumb drive, but when the hit rate on the thumb drive increases, the SSD will remove that data, so we will only have 1 copy
The SSD with write-back can make writing a hell lot faster for database data.
Bcache only allows one SSD per spinning partition. you can not combine, while the other methods could ! and since they are read only, you could even RAID the thumb drives
Caching software available
Device mapping
bcache (part of the new kernels)
dm-cache (part of the new kernels)
Flashcache (Facebook’s)
EnhanceIO (Fork of flashcache)

EnhanceIO can be attached to any block device on-the-fly even
when device is already mounted.
dm-cache is faster, but bcache is safer

If so…
we will probably be using bcache in FIFO mode, and enhanceio in most (least recently used (LRU)).

Also take a look at https://github.com/Feh/nocache
—————————————————
You probably noticed that there are not many tutorials and instructions on bcache for Debian online, the reason is that the user tools are not packaged for Debian, not even for Jessie, but that is a simple thing, the hard part has already been done at the kernel level so you dont need to recompile the kernel, but you need the instructions on how to setup bcache !

So here is a step by step, no theory and no explinations, just the procedure

bcache, the simple and safer way

So here is how i setup bcache on my linux server for MySQL usage.

1- create 2 partitions on my 2TB disk, one would be 200GB and the other 1800GB (With fdisk or parted you chose)

2- Delete the first 200GB partition leaving only the other

3- Run the debian installer and instructing it to use the continuous free space, which is now the small first partition

apt-get install git make gcc pkg-config uuid openssl util-linux uuid-dev libblkid-dev

git clone https://github.com/g2p/bcache-tools.git

cd bcache-tools

make

make install

-------------------------------------
install -m0755 make-bcache bcache-super-show /usr/sbin/
install -m0755 probe-bcache bcache-register /lib/udev/
install -m0644 69-bcache.rules /lib/udev/rules.d/
install -m0644 -- *.8 /usr/share/man/man8/
install -D -m0755 initramfs/hook /usr/share/initramfs-tools/hooks/bcache
install -D -m0755 initcpio/install /usr/lib/initcpio/install/bcache
install -D -m0755 dracut/module-setup.sh /lib/dracut/modules.d/90bcache/module-setup.sh

-----------------------------------------------------

Now, use wipefs to delete the filesystem on the big partition (/dev/sda2) so that we can format it as bcache rather than ext4

wipefs -a /dev/sda2

Take note of the UUIDs that come out of thie following 2 commands.

Why ? well, caching devices are the SSDs, backing devices are the normal sata disks, what happens when you run the following 2 commands is that you tell the kernell that one is a backing device, and the other is a caching device, you can have as many backing and caching devices as you want, but pay attention to this, you can not use 2 SSDs to cache one disk, although you can use 1 SSD to cache multiple disks, so for example, you can have 2 SSDs caching 5 disks, 1 SSD can cache 3 disks for example and the other can cache 2 disks.

Also, this is debian, so this step is done for you automatically, you will have /sys/fs/bcache/somediskuuid off the bat, that does not apply to all linux systems (some systems might requiere you to do the following to the backing deice ... echo "the bcache uuid" > /sys/fs/register)

First step, initialize my 1.8TB partition into a bcache block, -B means this is a backed device

make-bcache -B /dev/sda5

mkfs.ext4 /dev/bcache0

Then initialize the SSD (120GB intel SSD) into a bcache block, -C means caching device

make-bcache -C /dev/sdb1

--------------------

UUID: 4e9aed54-bf48-4d7a-b5b2-b041f2a811f8
Set UUID: 13544b4e-99de-42a0-905a-c6efbe669151
version: 0
nbuckets: 228944
block_size: 1
bucket_size: 1024
nr_in_set: 1
nr_this_dev: 0
first_bucket: 1

----------------------------

Now we have a backing and caching device, let's connect them together, this step is called "attaching"

first,

cd /sys/fs/bcache/

ls

the ls command will give you the caching devices UUID as a folder, which is actually a folder.

Now, Mount the bcache partition.

mount /dev/bcache0 /hds/cacheddisk (Check that you have bcache0 not bcache1 for example).



Macbook Pro and the battery problem

A friend of mine had a problem with a MacBook Pro, the problem was that it would not turn on, so i took a look at it and here is what i came up with

The battery was completely dead, effectively disabling the SMC (System Management Controller).

Without the SMC, the system will refuse to boot unless you bypass the SMC.

To bypass the SMS and make the computer run, you do the following

1- Disconnect the power cable.

2- Hold down the power button for 10 seconds (or more), then while still holding the power button down, connect the power cable and keep the power button pressed down for another 10 seconds (or more), then once the 20 seconds are over (10 without cable and 10 with cable), release the button and press it again like you normally would to start the computer.

Your fans will run at full speed (resulting in a loud computer), it will be slow, and it might crash or restart itself, in short things will not be working fine, what you need is a new battery.

------------------------------------------------------------
Stuff that only applies to my friend, so skip this part
------------------------------------------------------------
Here are the specs of my friends laptop.

meera1

When you want to look for a battery online, you should be looking for

Macbook Pro A1286 Early 2011 battery (Does not apply to all readers).

I did a search, but knowing that you will be taking it to a service person to install it means that a bad choice on my end (even with a money back guarantee) could mean paying twice to the repair person, so it is not as simple as it seems for me (Since you won't be installing it yourself).

The original battery (OEM) costs $110 it seems, batteries from other providers seem to cost anywhere from $25 to $70, with the $25 batteries having super bad reviews, and the ones for $70 being ok it seems. still, the complications (having to take it to someone to install it) leave me confused. so a safe bet would be the OEM (Original apple battery) but then that's more than double the price
------------------------------------------------------------

Once you install the new battery, you will need to reset the SMC, the repair shop will probably do the reset for you, but just in case.

Shut down the computer.
Plug in the power adapter.
On the built-in keyboard, press the Shift, Control, and Option keys on the left side and the power button, all at the same time.
Release all three keys at the same time.
Turn on the computer.

You are done

huawei dongle on openwrt – the fast and easy way

NOTE: this is not about battery operated 4G modems (such as the huwawei E5577 for example), see here for instructions to connect 4G modems via USB to openwrt

This is a 4MB space tp-link router, here are the steps

opkg install kmod-usb-serial kmod-usb2 luci-proto-3g kmod-usb-serial-option usb-modeswitch kmod-usb2 kmod-usb-serial-wwan kmod-usb-serial ppp comgt 

A package required for older releases of openwrt

opkg install sdparm

And the optional package

opkg install usbutils 

Now, reboot the router, then go to the routers LUCI interfaces page, then add an interface

From the drop down, chose UMTS/GPRS

On the next page, you should see one of the devices names /dev/ttyUSB0, in my case there are 2 since the device provides a storage controller, the modem was on USB0 not USB1, your might be different (try both if you have 2)

Now i chose UMTS only so that the modem will always use 3G because edge is good for nothing

Then your APN and username/password as you would on a phone or anywhere else… then save and apply

OpenWRT router with huawei hilink – on a 4MB router

Since this router has around 600 to 700 KBs of free space, running the hi link USB dongle modem should be done with the bare minimum packages
Here are the ones i installed to get mine running

opkg install kmod-usb-net kmod-usb-net-rndis kmod-usb-net-cdc-ether udev usb-modeswitch kmod-usb-serial-option kmod-usb-net

Right after, i rebooted, then running the command,

ifconfig -a

I got a new eithernet device (USB0), on another older hi link dongle it was called eth2.

Then, from within LUCI, you can simply add a new interface using this hardware interface, and set that to DHCP and add it to the WAN segment, You are done, it should be connected now

Please be aware that once you have it running, you might want to get into the dongle’s interface settings, and instruct the dongle to only use 3G (Not GSM/EDGE), i do that by visiting 192.168.8.1 (Hard coded, can not be changed, but depending on the model yours might be different).

Moving files in linux with samba

Well, we all know FTP, HTTP and other protocols would do the trick, but they are not the fastest way. because of setup and other considerations, especially when we are planing to use both windows and linux in the transactions, a low overhead method would be samba, or windows network file sharing

In windows, it is simple, we all know how to share a folder, and we all know how to open a shared folder over the network, in linux it is just as simple.

The detailed explanation of how to setup the samba server and share a folder is already in a post, but from the client side, you can copy a file by simply mounting the shared drive onto the linux server and copy or move files like you would a normal file or folder.

To mount we can simply execute the following

1- Install the client tools to mount the folder
apt-get install cifs-utils

then
mkdir /hds
mkdir /hds/smbmount

mount -t cifs //192.168.15.116/sharedfolder /hds/smbmount -o username=techg,noexec

That’s it, now use CP and MV as you would normally

One problem i faced with this method before was that my WD My Book Live shares would not mount, it threw an error

mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

The logs did not provide much help either

CIFS VFS: cifs_mount failed w/return code = -22

Turns out that the WD MyBook Live has an older version of Debian, and samba on that device had a max-v of 2, so the solution is to connect while specifying which version of samba works

mount -t cifs //192.168.2.116/sharedfolder /hds/smbmount -o vers=2.0,username=techg,noexec

The values for Version can be 2.0 2.1 3.0

Mounting samba shares at boot time

My NAS server is always online, I switch my PC off while I am asleep, yes, being green may be a factor I claim, but the truth is, my personal machine has spinning hard drives, and my backups are not always up to date, so if a disk fails while I am asleep, and ticks it’s way to its own demise, I would then remember that I should have been more green, Anyway, let us get to the mounting

1- create the file /home/qworqs/.smbcredentials and fill it up with the contents below

username=qworqs 
password=qwarks
domain=

Now that we have our credentials stored somewhere, we can add the following line to our fstab file, yes, it makes no sense that I have a folder called /hds that I mount all my disks and network shares to, but I have been doing this since I was young

So, open the file /etc/fstab and add the following line

//192.168.1.100/sharename /hds/100share cifs credentials=/home/qworqs/.smbcredentials,rw,uid=qworqs,gid=qworqs,noauto,nofail,x-systemd.automount,_netdev      0       0

Google talk stopped working, make it work again

Google talk stopped working today, but i am so used to it, i don’t think i can live without it.

When i try to login, it says, username and password do not match, (You provided somename).

So here is the plan to make google talk work again.

PLEASE LEAVE A COMMENT IF YOU WOULD LIKE ME TO MAKE THIS SERVICE PUBLIC

The google talk installer is all over the internet, google talk uses XMPP as a protocol

I will be creating a server, and creating a file to make google talk connect to my server

Now i will tell all my friends to register their existing email address with this server and to run the file that changes the server for google talk, and we should be back online again

I will be monitoring my own instance of google talk for incoming and outgoing data so that i can modify the server so that it would become fully compatible since google talk is not 100% XMPP.

I will keep everyone posted on this. Hopefully i will have it working by the end of the day

lead acid batteries – all about

Because i use lead acid batteries on my UPS systems, i will be putting all the relevant information that i need on lead acid batteries here

1- What does 74ah (74 amp per hour mean)
In most cases, it means 3.7ah over 20 hours, so you can draw 3.7 amps for 20 hours before the voltage drops to 10.5V, the equation is not linear, so basically you will be able to draw less than 7.4ah in 10 hours (Less than double for half the time), the rating is usually 20 hours on most batteries, the Bosch car batteries (S3 S4 S5…) are measured for 20 hours for example.

The CCA are usually measured for a 10 second period until the voltage drops to 7.5V (Yes, minimum of 7.5V not 10.5)

Now, sometimes, i connect an inverter and a power supply and a battery together, so that the inverter draws from the power supply, while the battery is technically maintaining its charge, if you can’t control the current, and just want the charge to stay put, something between 12.6 and 12.7 is a good voltage, but to be on the safe side, fully charge your battery, then let it sit for 24 hours, then get a voltage reading, tune your power supply to that voltage, and connect them all together.

Firefox not caching

After spending the day trying to figure out why firefox was not caching images from my website even though chrome seems to honor the caching headers from the server correctly, it turned out that my browser settings were not correct

Somehow, caching was disabled in firefox, to enable it i did the following

visit about:config (fill it into your address bar), this will give you your browser settings

in the top box, type in browser.cache

Make sure both browser.cache.memory.enable and browser.cache.disk.enable are set to true, if they are not, you simply double click it to flip it.

Close this window and try (no need to restart firefox).