Saturday, November 27, 2010

Debunking UNIX file links myths

This may be a pretty newbie topic for some, but yes, I had only debunked this myth today. So what's the difference between a symbolic link and a hard link? I realized that hard links are well, hard. It's not lame, it's just how you'd describe hardware as "hardware". Hard links are very low level on the filesystem level. Every file that you see on an ls output are hard links. Hard links are just pointers to a particular location in the filesystem which... houses the data. Therefore, when you hard link to a hard link with a command like 'ln -T /usr/bin/firefox /usr/bin/firefox-browser', both firefox and firefox-browser will point to the same location on the filesystem, even though to an ls output, it looks as if they are two different files. Yes, they just point to the same inode on the filesystem. The nature of hard links is that well, we can save some inodes just in an extreme case we are running out of inodes(ie, we cannot create a new file even though there are unused space). However, I feel that hard links are kinda messy because, a file is only deleted when there are no pointers to its inode on the filesystem, and should only be used in certain cases. For example, we hard-link the firefox executable with 'ln -T /usr/bin/firefox /usr/bin/firefox-browser', because we want to maintain compatibility for an application which uses the firefox binary by calling firefox-browser instead of firefox. Then somehow, the firefox executable gets updated, say for example, by the operating system's package manager. Can you see what is wrong now? The firefox-browser hard-link would still be pointing to the old firefox executable inode! The program which depend on it may behave unexpectedly, because it is using an older version of the executable. Remember, the data is never deleted until all hardlinks to it is deleted. So in this particular scenario, using a soft-link aka symbolic link is a lot safer. It is because symbolic links on the other hand, is a file on its own, but it records the high level information about where the link should be pointing to(ie, for example, the location of the file in the filesystem hierachy). Therefore, if we create the same link of the symbolic type instead for the above scenario, the link would automatically update to be pointing to the new executable instead. Okay, I typed all these out of rashness for this discovery, so correct me if I am in anyway wrong.

Thursday, November 25, 2010

Wow! Love xf86-video-ati.

I always thought that opensource ati drivers are not perfect for running gnome-shell, but I was wrong after a clean installation of Arch Linux. Since Arch Linux is a rolling-release distribution, all of its packages are always up to date with the latest stable, and maybe that explains why. So I am running the latest xf86-video-ati drivers and everything in gnome-shell is flawless. The transitions are smooth and there are no hangups. Everything is perfect! I love gnome-shell and xf86-video-ati!

Sunday, November 14, 2010

Booting [Windows] on another drive from [Grub 2]

I faced tremendous problems getting Windows to boot. Almost all tips from the net referred to the second code snippet below which landed me in a BSoD. However I have finally found a way to make this works. Put the following in /etc/grub.d/40_custom
menuentry "Windows 7" {
 set root=(hd1)
 chainloader +1
If the above code doesn't work, then use
menuentry "Windows 7" {
 drivemap (hd1) (hd0)
 drivemap (hd0) (hd1)
 set root=(hd1)
 chainloader +1
Of course, replace the drive numbers respectively. (hd0) being the first hard disk and (hd1) being the second, ... and so on. How this works is that, if the OS(to be booted from Grub 2) recognizes booting from a second disk/changed hard disk, then use the first code snippet. The second code snippet is used for OSes which can't boot from the second disk, and the drivemap command actually maps hd0 to hd1(actually you can try with this line only) and cheats the OS into thinking that it is booting from the first hard disk instead. Something like that. However somehow you can't "cheat" Windows 7 so... it BSoDs. So probably the second code snippet is for Windows XP which is somehow stupider(I think?). I never have to booting Windows XP this way so, I don't really know.

Saturday, November 13, 2010

[Ubuntu][Fedora][Linux Mint] not "detecting" disks at installation wizard

This was quite a hard problem to solve, as there aren't many online sources to solve this. But in the end I still found the solution in Linux Mint Forums. If you can access disks from partition programs like GParted but not from the installer itself, it may be that your hard disk may still have embedded raid metadata, if you remembered that you did raid before on the hard disks. So, to remove that metadata, type in a command, in a live cd. sudo dmraid -r -E /dev/sda Where the disk used in this example is /dev/sda. This should make the installer detect the disk again. Alternately you can boot with the nodmraid option.

Facebook 'like' button on blogger

Since I was having fun on blogger for a while, I searched for a tip to add the facebook "like" to blogger posts. The point is to insert this html snippet under "design > edit html". Be sure to check the "Expand Widget Templates" checkbox, then search with ctrl+f in your browser to find the section of code responsible for "post-footer". Just type that in the search. Once you have decided where to put it within the post-footer <div> section, paste the following code snippet. It's been retrieved from WikiHow, but has been edited by me to make it work for the current blogger version.

Setting a disk to offline in order to make physical disk access work in [Windows 7] on [VMware]

I installed VMware workstation on my Windows 7 machine, then I tried to install a linux distribution to a physical disk. It turns out VMware errors stating it is unable to sync disk. So after a little research on the net I found out that Windows 7/Vista have new security policies which prevented physical disk access to programs if the disks are online. So to set a disk offline, use diskpart, and type the following commands in diskpart list disk select disk <your desired offline disk number> offline disk attribute disk clear readonly rescan

[Linux] Generic Partition Layout

This is the generic partition layout/size that I have found on the web and I find it quite reasonable. You should partition the smallest partition on the front of the disk first, adding gradually larger partitions as you go to the back of the disk. The example disk here used is /dev/sda
/dev/sda1   /boot   100Mb
/dev/sda5   /tmp    300Mb
/dev/sda6   /       1400Mb
/dev/sda7   /var    1400Mb
/dev/sda8   swap    3000Mb
/dev/sda9   /usr    12000Mb
/dev/sda10  /home   <rest of available space>
Of course, the swap partition should be at the respective position depending on its size, which in turns, depends on the amount of ram. (Normally <size of ram> * 1.5)

Saturday, November 6, 2010

hello. this is my first blog post HERE but certainly not the first time blogging. who knows, I may just use it to park this domain @_@.