Still alive!

I am still alive! Awesome!

Too much is happening to my life right now. Even have very little time to play games or watch movies that I like.

Doing a lot of learning on Amazon Web Services  (AWS) now. Trying to get myself certified. I believe AWS is the future. It has redefined the way services are delivered for the past few years. Right now, Artifical Intelligence is the topic of mass discussion. Soon, we will have services delivered to us via dictation. We will probably speak to a machine to order a cup of coffee!


Happy New Year 2017!!

I know this is belated. But I am so busy with work that I have no time to blog. For the past 3 years so much has changed. I have learned so many new stuffs such as Amazon Web Services and other cloud technology. I have so many other things that I would like to blog about but spliting my 24 hours per day between work, family, playing games, media consumption and so on is really hard. Sleeping 8 hours per day is now a luxury to me. I do get it during the weekends or more when I take naps in the afternoons and so on. It helps when your children are older.

Anyway….

HAPPY NEW YEAR 2017!!!


Free extra space for Linux EXT2/3/4 filesystem

Linux ext2/ext3/ext4 (ext from now on) file system will reserved 5% of partition space whenever you create the partition. This reserved space is said to be meant for system admins when space is maxed out and they could release it for emergency usage. The fact this, this space is seldom used and even not known by a lot of users. The 5% space is not much during the time when storage is like 250GB. However, when it comes with modern days with 4TB HDD, this becomes quite a large amount of unused storage waste.

On system partitions, you can leave 1% reserved and it haven’t cause me any problems for the past 5 years. This 5% is a lot when your HDD size is like 3TB. That’s a whopping 150GB of extra space per drive. When you have like 4 drives, it is 600GB!!! And in storage partition, you do not really need the reserved space. Setting it to 0% reserved is almost a no brainer.

So how do you free up the space? Will there be any data loss? Do I have to re-format my partition?

Well, the answer is EASY, NO and NO.

 

For partition already being used:

To free up the space, just run command below:
sudo tune2fs -m <new percentage> /dev/<partitionID>

* new percentage = how many % you want to reserve
** partitionID = how many

[cc lang=”bash” escaped=”true” width=”100%”]

[root@web1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md2 267G 37G 217G 15% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/md0 1008M 59M 899M 7% /boot

[root@web1 ~]# tune2fs -m 1 /dev/md2
tune2fs 1.41.12 (17-May-2010)
Setting reserved blocks percentage to 1% (709314 blocks)

[root@web1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md2 267G 37G 228G 14% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/md0 1008M 59M 899M 7% /boot

[/cc]

Once done, you can continue to use your partition without any issue.

ps. You can see in the example, it works on an mdraid partition as well! 🙂

 

For partition during format:

While using mkfs command to format, you can set the reserved space parameter.

[cc lang=”bash” escaped=”true” width=”100%”]

mkfs.ext2 -m 0 /dev/sdc1

[/cc]

Above example set reserved space to 0%.

That’s it for reserved space. Easy and simple work that take less than 5 minutes. Totally useful in NAS environment when you have 4 x 4TB HDD. Whatever the space you save, try to always have redundancy for your storage like RAID1 or RAID5 or RAID6. Speaking of which, I have had a bit of study on this and revamp my storage redundancy strategy. This will be left on an entirely new post which I will do when I have the time.


Retro: Top 20 Apple II games

I started my journey into the computer world with Apple II+. I do not remember how it started but I bugged my mother to buy it for me when I was in primary school. During that time personal computers are totally new to this part of the world. It is also a very expensive electronics which my family could barely afford. Nobody actually knows anything about computers. Just that it is something that will shape the future to come. Eventually my mother bought me the computer with her own savings from which I am very grateful. From then on my journey into becoming a computer nerd is dominated by playing games. I had very fond memories with my Apple II+ and I still have this thing stored in my garage somewhere. I am sure it is not working anymore but somehow I did not get around to throwing it away. I guess I am a nostalgic person deep down.

Take note also that I am ranking the games and not bundle them up as series. Like some of those with sequels, I do not want to bundle them together. For each of them are different even though some may have very similar gameplay. I wish to evaluate the games as it is and the amount of entertainment it provided me whether it is a standalone game or sequel to another great game. I also felt that by bundling the games, it is sort of unfair for the one that is truly outstanding among it’s series. It is also a bit unfair for other games without sequels as I might be comparing 3 games to 1 game.

Apple II+

Anyway, here are the top 20 games that I really liked or had fond memories of. I did not get the chance to play all Apple II games therefore this list is by no means an exhaustive list of best Apple II/II+/IIc/IIe games. Also, I played them all in green monochrome screen.

Okay, let’s start the countdown from number 20 to 16.

Continue Reading


Experience: RAID5 is it over-rated?

RAID (redundant array of independent disks, originally redundant array of inexpensive disk)is a storage system developed in the 80’s. It was during the time when drives are expensive. But it is a viable solution for online redundancy to protect against hardware failure. Anyway, a lesson in RAID is not what I wanted to tell in this “Experience” post. I wanted to quote from one of my experience on using RAID5 and how I think RAID5 is not a viable solution anymore in this modern era where drive technology has advanced by leaps and bound since the days of tapes.

Years ago in the 2000’s, I was building server for the company I was working with. Naturally, RAID5 comes to mind as it was the “right” thing to do for storage redundancy. Well, RAID5 is a viable option since it allow 1 drive to fail anytime and we had RAID5 running with 3 drives. Everything went well and fast forward to more than 5 years later, the drives begin to show signs of aging. In one miserable day, one of the drive in the RAID5 went dead. So we are chugging along with the 2 remaining drives. With the inexperience that I am, we did not have any hotspares not coldspares. I proceeded with ordering a new drive. As with the nature of fast moving technology, it is hard to find a replacement drive. The replacement quoted by vendor is crazy expensive. So I had a trip around looking for replacement in second hand shops. A few days passed by and then something terrible happened.

One of the remaining 2 drives failed as well. I am screwed. Screwed for not having proper disaster recovery placed. So I attempted to take drives to recovery centers. The said they can try to recover the data but no guarantee. On top of that, the price they quote, well..let’s say we can buy a few new servers with it. Naturally management did not approve of that recovery. But I got a serious lecture and they had to rebuild some important data from various locations filed in local PC.

Years later, I build another RAID5 system in my home. It did not end well too.

Out of some of my experience using RAID5, I can say I will stay away from RAID5 given the choice. Below are some of the reasons:

  • hotspares are totally neccessary for RAID5. Else don’t use RAID5
  • RAID5 are dependent on the controller. If the controller died, that whole array might not work. Depending on whether it’s hardware RAID or software RAID.
  • RAID5 overrated. Better alternative would be RAID6 or RAID10.

For now, my choice of RAID would be RAID10. Cause anytime, I take one of the drives out, I can totally read all the files in it. I do not need to depend on other drives in order to recover few files in the array. For those who are still using RAID5, it is time to change to a better RAID system or at the very least have a good disaster recovery in place.


Putty: Import settings from old HDD or crashed system

I have had a few times my system crashed on me and I had to re-install Windows. One of the software that I use a lot is Putty. However, migration of configuration information is a PITA in Putty because the data is stored in Windows registry. The problem is worst when you are unable to boot up from your old windows to access the registry. There are a few alternative for this such as Putty manager and Putty mods that store the config in a file. However, I still find myself falling back to using original Putty due to me being accustomed to it. So here is a simple tutorial on how to extract your Putty configuration from an old Windows.

Pre-requisites:

  • your registry file must still be accessible (located in user profiles)

Steps on restoring putty configurations:

  1. On your new Windows run putty once. Then create a dummy configuration server. This is make Putty create a new configuration entry in registry.
  2. Close putty.
  3. Use windows run command (Windows Key + r) to run “regedit“.
  4. Once in registry editor, highlight “HKEY_LOCAL_MACHINE
  5. Then click File -> Load Hive…
  6. A dialog box will ask for the registry file to open. Explore to your old user profile folder. For eg, “C:\Windows.old\Users\myusername\NTUSER.DAT
  7. You will be prompted a name for this key name. Just put anything you like. In this example, we use “old-registry“.
  8. You can now expand HKEY_LOCAL_MACHINE and you will see the key file you just opened under the label  you put in step 7.
  9. Expand as such, HKEY_LOCAL_MACHINE\old-registry\Software\SimonTatham
  10. Now highlight SimonTatham on your left hand side of regedit and right-click then choose export.
  11. Export this registry entry to a file name and location of your choice. I put it in desktop and call it “putty-config“. This file will have the extension of .reg. But those who didn’t enable view extensions will not see it. That is fine.
  12. Now you can unload old-registry from your hive. Make sure “old-registry” is highlighted. Select File -> Unload Hive…
  13. Once you have unload the hive, close regedit.
  14. Use notepad to open up the registry file you just saved. For me, it’s “putty-config“.
  15. Use replace “HKEY_LOCAL_MACHINE\old-registry” with “HKEY_CURRENT_USER“. Click Replace All.
  16. Now save the file and close notepad.
  17. Right click on the “putty-config” file and select “Merge“. This will merge the registry into your new registry.
  18. Open up Putty and voila!!! Your old configurations are all back in Putty including all the session keys.

Battery issue in iPhone when connected to WiFi

apple logo

I have been using my iPhone 4 for more than a year already. However, only this 1 month ago, I notice my battery drops much quicker than it normally does. When I arrive in the office in the morning, my battery will be around 95%. However, by the end of the day around 6pm, it would dropped to below 40%. This is when I do not even use the phone much. Maybe one or two 1 minute calls. A little bit of SMS and some checking of the status. I normally already have a lot of the phone function turned off such as Bluetooth, 3G and Edge. It took me some time to find out that WiFi is the one causing this problem.

When I turned off WiFi, by the end of the day, I would still have around 80% of battery juice left. That is a whole lot of difference. And the thing is, this does not happen when I am at home during the weekends. I can leave my WiFi on the whole day and battery will not suck that much. Next, I leave my WiFi service running in my iPhone but do not let it connect to my office’s WiFi. Just go to settings and network then forget all the saved networks. After testing this for a few days, I notice my battery does not get sucked like before. It stays at around 80% by the end of the day. This can confirm that somehow my office’s wifi is causing the problem. My best guestimation is that some sort of malware or virus is running in my network scanning for connections and probing all ports. So when my phone is connected, it will reply with all the relevant “replies”. Thus draining the battery while doing so.

So next time when your iPhone battery juice is moving faster than it should, don’t put the blame on Apple first. Try checking to see if your WiFi network is causing it.


Stop SOPA with site blackout

I am joining the fight for SOPA even though I am not from US. I think SOPA will affect every site in the world as US is the biggest internet contributor in the world. Coming from a country where internet or as the matter of fact, transparency is a big issue, I will support any protest against internet censorship. Do not forget the internet got to what it is today due to it not having censorship. Best example is to look at China vs US in terms of the country’s economy and politics. China being a closed country for so long and after they open their door to foreigners, opportunities arises in the billions and they started to flourished. We do not want the same thing to happen to the rest of the world. Because once SOPA is successfully implemented, I am sure most other countries will follow suit using SOPA as their benchmark for internet censorship.

Hence, I am joining in for saying NO TO SOPA on the 18th Jan 2012.


Setup server to send email directly in Ubuntu without using SMTP gateway

There are a lot of usage for servers such as web hosting, filesharing, application hosting and so on. Most of these servers does no need to have a full fledged email service running in them. However, very often these servers still need to send out emails for example, in the form of alerts such as diskspace full and so on. There are basically 2 ways of doing this,

1) setup server or applications to send email using SMTP login to a proper email server

2) setup server to allow it send out email directly without going through SMTP

The proper way of doing this is using method 1. However it entails a lot of work and I personally prefer method 2. It is much easier to setup and does not rely on SMTP server to send out email. Here, I will show how to setup server to send out email using method 2 on Ubuntu using postfix MTA. It should work for most version of Ubuntu and Debian based system.

[cc lang=”bash” escaped=”true” width=”100%”]

apt-get update

apt-get install postfix mailx

[/cc]

During postfix installation, you will be brought to postfix setup screen. If you don’t get that screen, manually type dpkg-reconfigure postfix.

General type of mail configuration: Internet

Just press enter for the rest of the options.

Once this is done, a basic config file will be generated for postfix. You don’t really need to config file. You can just empty it and restart postfix.

[cc lang=”bash” escaped=”true” width=”100%”]

cat /dev/null > /etc/postfix/main.cf

/etc/init.d/postfix restart

[/cc]

Test sending out email:

[cc lang=”bash” escaped=”true” width=”100%”]

echo testing | mail -s subjecttesting [email protected]

[/cc]

Done


Windows 7 winsxs folder – what is it? why is it growing? how to reduce the size?

What is winsxs folder?

Microsoft made a lot of changes and enhancements in Windows Vista promising better security and usability. One of the thing previously not in prior Windows that they added is a folder called winsxs. It means windows side-by-side. Nothing much is known then about this folder but a lot of users are complaining that it keeps on growing bigger and bigger taking up to 15GB for some people. This winsxs system was then also ported into windows 7 which brings us to continue asking this question.

So what is this winsxs folder and what is so important about it that we cannot delete anything in it?

Well, I am going to give a simple nutshell explaination. If you want detailed explanation and analysis of this folder and what it does EXACTLY, then head for these links.

<links>

Basically winsxs folder contain a lot of hardlinks or junction points (as being called by microsoft) to a lot of system files. It keeps a lot of different versions of systems files which probably is used for when rolling back drivers and so on. So these files are actually just linkage to other files in your windows system. I think there are also some real physical files there but all these are managed by windows and never explained by microsoft on the structure of this winsxs folder.

Why does winsxs folder keep on growing in size?

When you look at the properties of this folder, the file size listed is not really the physical space taken up due to them being links and not physical files.

Here is an example that someone did experiment on junction points. It explain well on how windows cannot report disk space usage as opposed to linux’s link system. This is the main reason which causes confusion about winsxs.

  • Assuming there is this test D: drive with 1000MB disk space left.
  • We create an empty folder called test123.
  • Copy a file that is 100MB in size into folder test123.
  • Check the space usage and we see 900MB space left. So far so good.

 

  • Next we create 3 junction points in folder test123 that points to the 100MB file.
  • So we have 4 files there with 1 is actually physical file of 100MB.
  • However, when we check the disk space properties for folder test123, it report 400MB being used by this folder.
  • Check free disk space and it is still around 900MB. For explanation sake, we ignore the small space used by each junction point for the pointer file.

So you see, when checking disk space used by junction point, windows port the file size of the physical file it is pointing to. This is essentially how junction point works in windows. Not very smart design by windows engineer.

Back to the winsxs folder. You now know why when you do drivers updates and windows updates, winsxs folder size keep growing and growing. But if you check you free diskspace, the growth doesn’t tally.

How to reduce winsxs size without screwing up my Windows?

Before starting on clearing up winsxs space. You can first run a Post Windows 7 SP1 cleanup. For those who have already applied Windows 7 SP1. This will clean up virtual space of around 5GB. Because remember, 5GB reported by windows on winsxs folder does not equal REAL 5GB. In actuality, around 500MB are saved. Looks at screenies below.

DISM /online /Cleanup-Image /SpSuperseded

[cc lang=”dos” escaped=”true” width=”100%” lines=”5″]
C:\>dir/w
Volume in drive C has no label.
Volume Serial Number is 1EB4-6A03

Directory of C:\

.rnd                        autoexec.bat
config.sys                  [HP Universal Print Driver]
HP2030.log                  [PerfLogs]
[Program Files]             [Users]
[Windows]
4 File(s)         40,638 bytes
5 Dir(s)  54,660,644,864 bytes free

C:\>DISM /online /Cleanup-Image /SpSuperseded

Deployment Image Servicing and Management tool
Version: 6.1.7600.16385

Image Version: 6.1.7601.17514

Removing backup files created during service pack installation.
[==========================100.0%==========================]
Service Pack Cleanup operation completed.
The operation completed successfully.

C:\>dir/w
Volume in drive C has no label.
Volume Serial Number is 1EB4-6A03

Directory of C:\

.rnd                        autoexec.bat
config.sys                  [HP Universal Print Driver]
HP2030.log                  [PerfLogs]
[Program Files]             [Users]
[Windows]
4 File(s)         40,638 bytes
5 Dir(s)  55,099,588,608 bytes free

C:\>
[/cc]

Now that you know the usage size reported on winsxs is not the correct exact storage used, do we still need to find a way to reduce the size? How do we find out exactly how much space is actually used by winsxs? My answer is yes and no.

Despite Windows over reporting the size of winsxs, it still in some way take up unnecessary space. That might be nothing when you have a 500GB HDD. However, when it comes to SSD, this is a different story. SSDs are still very expensive. Some people only have 20GB for SSD and every MB counts. So I would recommend trying to reduce unnecessary storage taken up to files that we hardly ever touch.

After some googling, the only tool that I found to be able to help clear up winsxs is winsxslite created by Christian Bering Boegh. This is basically a “bat” file running DOS commands. It depends on a few DOS command line tools which is listed in “Help” section when you run the software. I have to say this tool is amazingly complex. It take a lot of time when running it just to come up with the list of actual physical space taken up by winsxs. I tried it on a Windows 7 SP1 laptop and it took me around 5 hours to finish Stage 1 of this tool. There is another stage 2 which I did not bother to run at it is really time consuming. I did end up saving around 1GB by the end of stage 1. However, I do not recommend anyone running this as it is quite a hassle and normal user would find it difficult just to download the third party tools required to get this software running.

By now, you know what winsxs is about. Some might also be wondering why Microsoft engineers designed such an insufficient system. Something that waste resources. I don’t know if this is totally a lousy system because everyone also hated Windows Registry system when it was introduced in Windows 95. It’s not that bad once everyone got used to it by now. I guess same thing applies to winsxs. We will probably see more tools released by third party that can optimize it more efficiently. Until then I guess most of use will need to stick to it and leave it to it’s own devices. BTW, I still don’t really fancy registry and still think it sucks. LOL…


Pages:123