Weblog of an Aspiring Computer Scientist
Random header image... Refresh for more!

Posts from — May 2007

jammed dirname.py on top of mount.py

Trouble’s struck !!. Ubuntu’s libATA has stopped functioning and my partitions are now seen as IDE subsystems once again. Hence we have a conflict between udev rules and device names leading to automount getting <censored>. I seriously can’t be bothered by this. Considering that I try to behave as much as a sysadmin as possible, I tried to whip up a script that would mount the device specified as I have no idea what filesystems my 3 identical (in appearance) external drives have on them. I think one has reiserfs, another has ext3 and the third has fat32 on it. I tried to find out the command that would let me know about the fs I have on my external drive without actually mounting it. fdisk didn’t help and I was stuck with waiting for the new kernel 2.6.20-16-generic to be fixed. Later that day I did:

man -k locate

The first line in there was:

blkid (8)            - command-line utility to locate/print block device attributes

Was this command the solution to my troubles? It indeed was. I then whipped up a script in no time. Here it is:

 #!/usr/bin/python

#mountcreatingdir.py

#Author:Shriphani Palakodety

import commands

index = 1

while True:

 dir = "/mnt/usbdisk" + str(index)

 string = commands.getoutput('mkdir %s' % dir)

 if string == "":

  continue

 else:

  index = index + 1

 device = raw_input('Enter the name of the device you want to mount: ')

 a = commands.getoutput('blkid %s' % device)

 import string

 number = string.find(a, " T")

 print number

 requirement = a[number+6:]

 s = commands.getoutput('mount -t %s %s %s' % (requirement, device, dir))

 print s

That’s about it.

May 15, 2007   No Comments

Feisty fawn, first observation

I got my feisty cds this morning. I installed feisty immediately and considering that one of the ubuntu devs on #ubuntu told me that feisty’s way of handling storage devices had changed, I immediately did:

shriphani@psp-laptop:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
#
proc            /proc           proc    defaults        0       0
# /dev/sda3
UUID=1a97343a-e3ed-48e2-9db4-ea67228fb1aa /               ext3    defaults,errors=remount-ro 0       1
# /dev/sda2
UUID=68033b3d-f469-4a8b-8ade-c3a9984f5281 /boot           ext2    defaults        0       2
# /dev/sda1
UUID=01107bb3-77bb-41c3-b271-6019bfa8ebb3 /home           ext3    defaults        0       2
# /dev/sda4
UUID=da271254-066a-46f4-b1a0-75ba2c4b494f none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto     0       0

What’s this !!. a UUID describing a device ? I was a bit confused. I also saw that my IDE drive (I have an acer travelmate 4500 laptop) was being recognised as SCSI. I immediately went to #ubuntu on freenode to figure out what was wrong. I was then given the link to this.
Wow! Surely a lot of thought going into that. So we will be dealing with just one subsystem from now on in Ubuntu land.

May 8, 2007   1 Comment