Archive for Linux

format usb drive using linux so windows can read it

So you just go a external USB drive and you want to use it on you Windows box.  Well Windows is just not that smart to read osx formatted partitions.

Start by pluging it in, yaha.  Below is a snip it from dmesg that shows the usb drive being recognized when plunged in.

cfdisk example output

cfdisk 2.12r

Disk Drive: /dev/sdb
Size: 120034123776 bytes, 120.0 GB
Heads: 255   Sectors per Track: 63   Cylinders: 14593

Name              Flags            Part Type       FS Type                  [Label]               Size (MB)
———————————————————————————————————————-
sdb1                                Primary        NTFS volume set                                120031.52

[Bootable]  [ Delete ]  [  Help  ]  [Maximize]  [ Print  ]  [  Quit  ]  [  Type  ]  [ Units  ]
[ Write  ]

Notice that the dmesg output says sdb so the device path will be /dev/sdb, and the first partition will be /dev/sdb1.

sb 5-5: new high speed USB device using ehci_hcd and address 4
usb 5-5: configuration #1 chosen from 1 choice
Initializing USB Mass Storage driver…
scsi2 : SCSI emulation for USB Mass Storage devices
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 4
usb-storage: waiting for device to settle before scanning
Vendor: Ext Hard  Model:  Disk             Rev:
Type:   Direct-Access                      ANSI SCSI revision: 04
SCSI device sdb: 234441648 512-byte hdwr sectors (120034 MB)
sdb: Write Protect is off
sdb: Mode Sense: 10 00 00 00
sdb: assuming drive cache: write through
SCSI device sdb: 234441648 512-byte hdwr sectors (120034 MB)
sdb: Write Protect is off
sdb: Mode Sense: 10 00 00 00
sdb: assuming drive cache: write through
sdb: [mac] sdb1 sdb2
sd 2:0:0:0: Attached scsi disk sdb
usb-storage: device scan complete
SCSI device sdb: 234441648 512-byte hdwr sectors (120034 MB)
sdb: Write Protect is off
sdb: Mode Sense: 10 00 00 00
sdb: assuming drive cache: write through
sdb: sdb1
SCSI device sdb: 234441648 512-byte hdwr sectors (120034 MB)
sdb: Write Protect is off
sdb: Mode Sense: 10 00 00 00
sdb: assuming drive cache: write through
sdb: sdb1

First you have to delete the osx partition.  I suggest using cfdisk.  It is one of my favorite disk formatting command line gui programs.  fdisk /dev/device also works but is a little trickier to use.

The commands below show how to format the drive

server:~# mkdosfs -n “external disk” /dev/sdb1
mkdosfs 2.11 (12 Mar 2005)

Now go and mount the newly created the file system.

mount /dev/sdb1 /mnt/usb

Now you can unmount it so that it is safe to remove the usb device.

server:/mnt# umount /mnt/usb

server:/mnt# mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
mini:/mnt#

Now you can disconnect the usb drive.

usb 5-5: USB disconnect, address 4

server:~# mkdosfs -n “external disk” /dev/sdb1
mkdosfs 2.11 (12 Mar 2005)

Comments

How to change DNS servers

In both linux and Solaris and possibly other UNIX’es you can change your DNS servers simply by editing your /etc/resolv.conf

It should look like below.

search domain.com otherdomain.com
nameserver 192.168.0.1
nameserver 192.168.0.2

The nameserver’s or DNS server will try to be connected to in order from top to bottom. The search domains do not matter if they are at the top or bottom. Search domains are usefull if you dont want to have to type in the whole FQDN (Fully Qualified Domain Name). So instead of typing in “ping sparky.domain.com” you can shorten it to “ping sparky”.

Comments

How to renew your dhcp lease in linux

root@client:~# dhclient eth0
There is already a pid file /var/run/dhclient.pid with pid 4478
killed old client process, removed PID file
Internet Systems Consortium DHCP Client V3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/eth0/00:22:cb:ze:95:sh
Sending on   LPF/eth0/00:22:cb:ze:95:sh
Sending on   Socket/fallback
DHCPREQUEST of 192.168.0.101 on eth0 to 255.255.255.255 port 67
DHCPACK of 192.168.0.101 from 192.168.0.1
bound to 192.168.0.101 — renewal in 284384 seconds.
root@client:~#

You could want to restart your leas for a variety of reasons.  You just set up a static DHCP lease and you want to computer to pick up the new ip.  If you are logged in via SSH make sure when you connection is dropped that you know what the new ip will be before hand or at least have a log in to the router so you can find out what it was assigned.

Comments

« Previous Page« Previous entries « Previous Page · Next Page » Next entries »Next Page »