Sunday, February 24, 2008

Youtube not reachable, temporarily

Youtube stopped opening around 23:19, February 24th.

At first I thought QualityNet has blocked Youtube, but they have no reason to. Further investigation showed that we got affected due to Pakistan blocking Youtube, and since we go through Pakistan, we got blocked as well.

Here's a traceroute of whole thing from QualityNet:
mj@mj-evil-station:~$ traceroute youtube.com
traceroute: Warning: youtube.com has multiple addresses; using 208.65.153.238
traceroute to youtube.com (208.65.153.238), 30 hops max, 40 byte packets
1 dsldevice.lan (192.168.1.254) 81.140 ms 89.402 ms 100.769 ms
2 62.150.109.1 (62.150.109.1) 199.651 ms 206.459 ms 261.711 ms
3 rb02-internet.qualitynet.net (62.150.93.233) 371.742 ms 317.482 ms 353.407 ms
4 jun-skb.qualitynet.net (62.150.200.5) 320.456 ms 225.162 ms 248.510 ms
5 195.229.27.29 (195.229.27.29) 188.310 ms 298.991 ms 432.766 ms
6 auh-emix-rb.emix.net.ae (195.229.31.3) 469.257 ms 299.604 ms 362.735 ms
7 dxb-r2-ether-1-0-0.emix.net.ae (195.229.0.98) 406.317 ms 195.229.0.126 (195.229.0.126) 196.553 ms dxb-r2-ether-1-0-0.emix.net.ae (195.229.0.98) 269.163 ms
8 195.229.0.181 (195.229.0.181) 355.469 ms 225.016 ms 226.647 ms
9 pos2-0.ar01.hkg04.pccwbtn.net (63.218.61.137) 582.209 ms 514.871 ms pos2-1
.ar01.hkg04.pccwbtn.net (63.218.61.141) 550.151 ms
10 pos1-0.cr02.hkg04.pccwbtn.net (63.218.114.66) 392.507 ms 417.320 ms 373.513 ms
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 youtube.com.hk (208.65.153.238) 520.823 ms 418.294 ms 431.483 ms

mj@mj-evil-station:~$ traceroute 208.65.153.238
traceroute to 208.65.153.238 (208.65.153.238), 30 hops max, 40 byte packets
1 dsldevice.lan (192.168.1.254) 45.403 ms 95.449 ms 99.379 ms
2 62.150.109.1 (62.150.109.1) 179.348 ms 368.496 ms 342.110 ms
3 rb02-internet.qualitynet.net (62.150.93.233) 369.112 ms 348.417 ms 253.605 ms
4 jun-skb.qualitynet.net (62.150.200.5) 163.947 ms 367.323 ms 245.216 ms
5 if-8-4.bb1.RSD-Riyad.teleglobe.net (66.198.126.45) 155.793 ms 41.123 ms 42.489 ms
6 if-6-0.bb1.JSD-Jeddah.teleglobe.net (195.219.153.25) 48.791 ms 50.982 ms 103.248 ms
7 if-11-0.mcore3.NJY-Newark.teleglobe.net (216.6.57.49) 430.598 ms 528.746 ms 583.103 ms
8 if-2-0.core1.NTO-NewYork.teleglobe.net (216.6.57.66) 448.712 ms 545.164 ms 423.040 ms
9 14.icore1.NTO-NewYork.teleglobe.net (216.6.82.2) 377.902 ms 403.390 ms 472.671 ms
10 209.58.26.30 (209.58.26.30) 575.457 ms 331.368 ms 379.346 ms
11 YOUTUBE-LLC.po1.401.ar2.SJC2.gblx.net (64.212.108.162) 645.748 ms 437.855 ms 420.526 ms
12 youtube.com.hk (208.65.153.238) 697.133 ms 447.682 ms 590.483 ms


From the above, you can see that the first attempt had a lot of unreachable hops, but they passed through the second time. This happened because I was attempting traceroute the first time while the routes to youtube were being cut/changed. The time between the 2 attempts was less than 10 minutes.

While writing this post, youtube seemed to work again. Some say it's not loading fully or some functions are not working.

Just checked from a FastTelco user, who was unable to view youtube at all. Here's a traceroute:
Tracing route to youtube.com [208.65.153.251]
over a maximum of 30 hops:

1 1 ms 1 ms 1 ms 192.168.1.1
2 724 ms 724 ms 716 ms 89.203.7.254
3 670 ms 682 ms 786 ms tec-core-so32.fasttelco.net [62.215.0.94]
4 696 ms 752 ms 971 ms 62.215.0.57
5 997 ms 748 ms 422 ms 78.159.161.9
6 463 ms 192 ms 125 ms 195.229.29.133
7 143 ms 73 ms 132 ms dxb-emix-ra.ge1302.emix.ae [195.229.31.67]
8 117 ms 100 ms 77 ms 195.229.0.181
9 245 ms 246 ms 386 ms t2a6-p5-3.uk-lon2.eu.bt.net [166.49.160.161]
10 281 ms 267 ms 250 ms t2c1-ge7-0.uk-lon2.eu.bt.net [166.49.176.43]
11 374 ms 321 ms 249 ms t2c1-p3-0.uk-glo.eu.bt.net [166.49.208.98]
12 250 ms 250 ms 244 ms t2c1-p9-1.uk-eal.eu.bt.net [166.49.208.125]
13 275 ms 271 ms 265 ms t2c1-p5-0-0.us-ash.eu.bt.net [166.49.164.65]
14 * * * Request timed out.
15 * 292 ms 260 ms 10.33.112.70
16 300 ms 272 ms 317 ms 10.33.254.141
17 379 ms 399 ms 378 ms 10.33.254.117
18 503 ms 388 ms 510 ms 10.33.176.114
19 383 ms 337 ms 330 ms youtube.com.hk [208.65.153.251]


More details on the ban from ZDNet.

Wednesday, February 20, 2008

High File Compression

I've been toying with 7-zip yesterday to see how far I could compress a file.

From the tests I did, 7-zip is capable of doing 7088:1 compression ratio. Here's the run:
mj@mj-evil-station:~/share$ dd bs=1073741824 count=10 if=/dev/zero | 7z a -mx9 -si haha.zip

7-Zip 4.43 beta Copyright (c) 1999-2006 Igor Pavlov 2006-09-15
p7zip Version 4.43 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,1 CPU)

Updating archive haha.zip

Compressing [Content] 0%
10+0 records in
10+0 records out
10737418240 bytes (11 GB) copied, 2465.64 seconds, 4.4 MB/s

mj@mj-evil-station:~/share$ ls -l
-rw-r--r-- 1 mj mj 1514800 2008-02-19 13:03 haha.zip

As you can see, I stuffed 10GB (not 11, notice the block size parameter) into a 1.4MB file. This was on a laptop. At home, my dual-core box stuffed 100GB into 14.4MB in 3 hours, 39 minutes & 30 seconds. (while watching a video file, consuming some CPU cycles)

I could probably optimize it more, by tweaking parameters of 7-zip, unfortunately it requires a lot of RAM, which I don't have (limited to 2GB only).

The tests done were simply stuffing zeroes in a text file, and then compressing the file. This is an ideal case, since all characters are the same, hence producing the highest rate of compression (provided you tweak your program to the max).

I have a couple of machines at work that are quad-core with 6GB of RAM, unfortunately they have Windows installed, so I don't have a device to pump zeroes into 7-zip directly, instead, I have to create a file of the size I need, then have 7-zip compress it; quite inconvenient.

Sunday, February 17, 2008

Making Bootable USB Drives Recognizable on Windows, Again

A couple of weeks back, I "borrowed" my sister's 256MB USB flash memory and put Slax on it.

Now, my sister wants her "USB" back, which I tried to explain that if I give her just the USB part it won't work as intended. As funny as I was, she didn't think so, and she wanted the WHOLE thing back. And working.

Windows didn't recognize the whole device and couldn't even see it as a removable disk, so formatting was not an option, yet.

Using a Windows XP bootable CD and trying to use fixmbr failed, because the recovery console failed to see the USB drive.

I fixed it on Linux, by using "dd" to write zeros on the disk (/dev/sdf in my case), then used fdisk (not cfdisk) to write a DOS partition table, then created a new primary partition with type "Windows 95 FAT" (b).

root@adrenalin:~# dd if=/dev/zero of=/dev/sdf
dd: writing to `/dev/sdf': No space left on device
517121+0 records in
517120+0 records out
264765440 bytes (265 MB) copied, 110.158 s, 2.4 MB/s


root@adrenalin:~# fdisk /dev/sdf
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF
disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by
w(rite)

Command (m for help): p

Disk /dev/sdf: 264 MB, 264765440 bytes
9 heads, 57 sectors/track, 1008 cylinders
Units = cylinders of 513 * 512 = 262656 bytes

Device Boot Start End Blocks Id System

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by
w(rite)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1008, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1008, default 1008):
Using default value 1008

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): b
Changed system type of partition 1 to b (W95 FAT32)

Command (m for help): p

Disk /dev/sdf: 264 MB, 264765440 bytes
9 heads, 57 sectors/track, 1008 cylinders
Units = cylinders of 513 * 512 = 262656 bytes

Device Boot Start End Blocks Id System
/dev/sdf1 1 1008 258523+ b W95 FAT32

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.


The disk is fixed, but doesn't have a filesystem. You can either make one in Linux, or slap it on a Windows machine & format it.

To make a FAT32 filesystem on Linux, run:
mkfs.vfat -F 32 /dev/sdf1

Saturday, February 16, 2008

GMail Acting Up

A couple of friends have told me that when they sign in to their gmail account, they get other people's inbox! Hitting refresh, shows yet another inbox.

The good news is that whenever clicking on an email message, or a label, or a directory, the session expires and you get logged off.

The bad news is that people can see emails in your inbox and can see the emails of those who sent you the emails.

I searched around and so far, no one has reported this!

K.The Kuwaiti had reported this issue here.

The problem seems to be facing those using FastTelco ISP connection, both home & businesses. Seems like they're using transparent proxies & caching data.
I confirmed it with those who told me about these symptoms, and they were using FT connections.

As for the post at 248AM blog, I don't agree with the suggestions in that post and have posted a correction.

Here's my my take at the issue:

"Tor was abused and embassy information was stolen through it. The same goes for proxies. They're simply someone else's machine.

By the way, even when an ISP is using a cache or a transparent proxy, it should NOT cache SSL (encrypted) pages. It can't. Simply because the session exists between the user (you) and the server (gmail, for example) and the cache server has nothing to see.

Try accessing GMail using this link: https://mail.google.com instead of using gmail.com -- This will work because gmail.com will only use SSL to authenticate then redirect you to your inbox using HTTP, where if you use https://mail.google.com, it will keep the SSL session and log you to your inbox with an encrypted channel.

The same applies for banking sites using SSL."

Update: Tuesday, Feb 19th: According to those who were facing the problems, they have stopped now.

Saturday, February 2, 2008

RAID Expansion and The Beauty of XFS

Existing Hardware Setup

My workstation has 4 SATA2 hard disk drives installed: 3x 320GB & 1x 80GB. The first 3 are on RAID arrays, while the last is a standalone partition with Windows to play games once in a while. The RAID arrays is managed by the Linux kernel, which is known as software RAID.

Existing Storage Capacity

The total storage capacity of the array was 592GB, of which 50GB was free. As I haven't finished my work on the NAS box, I had no place to store my future stuff, so I needed storage urgently, and had to add another disk into the existing array. As I hope to get my NAS box soon, I bought only one 320GB HDD.

Stage 0: HDD Installation & Partitioning

Since I had no RAID controllers, adding the hard disk while the PC was running was out of the question. So, after turning off the box, I added the new hard disk, and booted the box. Then, I partitioned the new hard disk into 2 partitions: boot & data, where boot occupied 100MB only.
This is different from the previous 3 HDDs, since they had a swap partition of 2GB per disk. I didn't add a swap partition in the new one. (And yes, there's 2GB of unused space).
This is how the new disk looked after being partitioned:
   Device Boot      Start         End      Blocks   Id  System
/dev/sde1 * 1 12 96358+ fd Linux raid autodetect
/dev/sde2 13 38913 312472282+ fd Linux raid autodetect
Another way to look at it would be:
Name    Flags    Part Type   FS Type                     Size (MB)
------------------------------------------------------------------
sde1 Boot Primary Linux raid autodetect 98.71
sde2 Primary Linux raid autodetect 319971.62
* The first print was produced using fdisk, the second using cfdisk.

Stage 0.5: Remove Shadowed Mounts

My /boot is a RAID1 array that is mounted over the existing /boot, and it's mounted as read-only. So, sense I'll be expanding the root filesystem (/) I thought of removing all un-needed filesystems, just in case!

Stage 1: Closer Than Veins

Now it's time to add partitions to their RAID arrays. If you don't wish to suffer like I did, change the minimum speed limit as follows:
echo '150000' > /proc/sys/dev/raid/speed_limit_min

Then, I added the boot partition to the array:
mdadm /dev/md0 -a /dev/sde1
mdadm --grow /dev/md0 --raid-disks=4

The first line will add the disk as a spare one only, and not an active part of the array. The second line makes it part of the array and mirrors the data to the new member of the RAID1 array.

Then, I added the data partiton to the RAID5 array, in a similar matter to the previous partition:
mdadm /dev/md1 -a /dev/sde2
mdadm --grow /dev/md1 --raid-disks=4

Because the RAID5 array is big, rebuilding it takes a lot of time. Mine took about 8.5 hours! The rebuilding process starts as soon as you execute the 2nd line. You can monitor the process of rebuilding the array by:
cat /proc/mdstat

You'll get something looking like these:
[=>...................]  reshape =  7.7% (24075264/310472064) finish=583.2min speed=8184K/sec
[===>.................] reshape = 19.8% (61607172/310472064) finish=582.5min speed=7116K/sec

Neat, right? Indeed, but the work isn't done yet!

Stage 2: Command and Conquer

Occupying the newly available free space is the last thing to do. After roughly 8.5 hours of rebuilding the array, it's finally online and ready to be abused by yours truly.
As the title of this post suggests, I use XFS filesystem, and one great feature that it offers is the ability to grow the filesystem online: No need to unmount the filesystem.
Quoting the manual page:
The filesystem must be mounted to be grown (see mount(8)). The existing contents of the
filesystem are undisturbed, and the added space becomes available for additional file
storage.

This is how things went:
root@adrenalin:~# xfs_growfs /
/dev/root: No such file or directory
Usage: xfs_growfs [options] mountpoint

Options:
-d grow data/metadata section
-l grow log section
-r grow realtime section
-n don't change anything, just show geometry
-I allow inode numbers to exceed 32 significant bits
-i convert log from external to internal format
-t alternate location for mount table (/etc/mtab)
-x convert log from internal to external format
-D size grow data/metadata section to size blks
-L size grow/shrink log section to size blks
-R size grow realtime section to size blks
-e size set realtime extent size to size blks
-m imaxpct set inode max percent to imaxpct
-V print version information
root@adrenalin:~# xfs_growfs -t /etc/mtab /
meta-data=/dev/md/1 isize=256 agcount=45, agsize=3449690 blks
= sectsz=4096 attr=0
data = bsize=4096 blocks=155236032, imaxpct=25
= sunit=0 swidth=0 blks, unwritten=1
naming =version 2 bsize=4096
log =internal bsize=4096 blocks=16384, version=2
= sectsz=4096 sunit=1 blks
realtime =none extsz=262144 blocks=0, rtextents=0
data blocks changed from 155236032 to 232854048
root@adrenalin:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md/1 889G 543G 347G 62% /
/dev/sdd1 67G 22G 46G 33% /crap
/dev/md/0 92M 16M 71M 19% /boot
root@adrenalin:~# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
md1 : active raid5 sde2[3] sdc3[2] sdb3[1] sda3[0]
931416192 blocks level 5, 128k chunk, algorithm 2 [4/4] [UUUU]

md0 : active raid1 sde1[3] sdc1[2] sdb1[1] sda1[0]
96256 blocks [4/4] [UUUU]

unused devices:
root@adrenalin:~# cat /etc/raidtab
raiddev /dev/md0
raid-level 1
nr-raid-disks 4
nr-spare-disks 0
persistent-superblock 1
chunk-size 32

device /dev/sda1
raid-disk 0
device /dev/sdb1
raid-disk 1
device /dev/sdc1
raid-disk 2
device /dev/sde1
raid-disk 3

raiddev /dev/md1
raid-level 5
nr-raid-disks 4
nr-spare-disks 0
persistent-superblock 1
parity-algorithm left-symmetric
chunk-size 128

device /dev/sda3
raid-disk 0
device /dev/sdb3
raid-disk 1
device /dev/sdc3
raid-disk 2
device /dev/sde2
raid-disk 3