Tuesday, May 29, 2007

Partitioning hard disk

Sometimes, you want to have a new partition, but your system is already configured and you do not have anymore space.

To partition your hard disk again, you will need a live cd and boot on it.

You can use two methods

  • Use gparted: gparted is a gnome tool that allow to resize partitions. I have tried this version on the Feisty Fawn live cd but there are some bugs: partition are automatically mounted and it is impossible to partition a disk while its partitions are mounted. To umount them, you need to start the terminal and run the command:

    df

    You will see that a partition is mounted like /mnt/disk or /mnt/disk-?, you will need to unmount it: to do this:

    umount /mnt/disk

    After that you will be able to modify your partitions

  • Use command-line: To do this, you have some useful commands:

    • resize2fs can resize an ext2 filesystem, if you do not set the size, it will fill the partition to the available space. If you set a size it will reallocate the filesystem to the size specified.

    • fdisk creates, removes or resize partitions.


    To change your partitions, you will need to

    1. resize your filesystem with resize2fs

    2. resize your partition with fdisk and create new partitions.

    3. resize your original filesystem to fill the available partition with resize2fs

How to partition?



A disk contains 4 partitions that can be of type primary or of type extended.

  • A primary partition is a partition that contains a filesystem
  • An extended partition is a partition that contains other partitions, that allows to have more than 4 partitions
To create more than 4 partitions, you will need to
  1. create at least one extended partition
  2. define its size
  3. create logical partitions that will be in this new extended partition.

Friday, May 25, 2007

Avoid password ask for nm-applet

When you start Gnome, it asks you for your password to get the WEP key in the keyring. It is very annoying...

To avoid this behavior, the keyring password needs to be the same as the one you use to log on.

You will need to:


  1. Install libpam-keyring:
    sudo apt-get install libpam-keyring

  2. Set GDM to check password in pam for the logon password. In the file /etc/pam.d/gdm, add the lines:

    auth optional pam_keyring.so try_first_pass
    session optional pam_keyring.so
Restart your computer or more simply only gdm and it should not ask you for the password

Tuesday, May 22, 2007

Get the mac address

An easy way to get the mac address of the computer is to run the command:

/sbin/ifconfig -a | grep HWaddr | cut -d" " - f11

  1. ifconfig -a will list all the network interfaces, even the one that are down.

  2. grep will take all the lines containing HWaddr.

  3. cut -d" " -f11 will cut the line into fields separated by spaces and only print the 11th field.


An interesting point for this method is that it works in each run levels (even in run level 1).

Sunday, May 6, 2007

Connect a windows network drive on Ubuntu

To connect a windows network drive to ubuntu, it is quite easy:
  1. Install smbfs:
    sudo apt-get install smbfs

  2. create the directory that will be mounted to the network drive, let's say /windows.

  3. Create a file containing the account to access the shared directory in /etc/cifspsw in the form:

    username=$(user)
    password=$(password)

    It is better if you remove access to other users for this file:
    sudo chmod og-wr /etc/cifpsw 



  4. Edit /etc/fstab and add the lines:
    $ip/$(shared directory)   /windows   cifs  noauto,exec credentials /etc/cifpsw 0 0 

    This line informs that the /windows directory will be mapped to the ip/shared directory folder.


Your configuration is ready, to mount the disk, simply write:
sudo mount /windows 


Information: You need to be root to do all these actions: you need to start all the command with the sudo command.

Upgrade from Edgy Eft to Feisty Fawn

To upgrade to the latest distribution, you only need to type the command in the terminal:
gksudo "update-manager -d"

Installing VM ware on Ubuntu 7.04

VM ware instatlation does not work as-is on the 2.6.20 kernel, you will need to modify some code in the vm ware version.

  1. Download VM-ware
  2. untar the package:
    tar -zxvf vmware*.tar.gz


  3. Go into the directory created. And go into: lib/modules/source

  4. Change the access from read-only to read-write to the file vmmon.tar.

  5. In the archive, open the file vmmon-only/include/directory/compat-kernel.h

  6. Comment the line static inline _syscall1(int,compat_exit,exit_code);
    Now, you can install vmware