<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nick poore &#187; Linux</title>
	<atom:link href="http://www.npoore.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.npoore.com</link>
	<description>Notes of a Software Engineer</description>
	<lastBuildDate>Tue, 28 Apr 2009 02:32:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Fixing your usb drive</title>
		<link>http://www.npoore.com/2009/04/02/fixing-your-usb-drive/</link>
		<comments>http://www.npoore.com/2009/04/02/fixing-your-usb-drive/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 02:47:18 +0000</pubDate>
		<dc:creator>npoore</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://www.npoore.com/?p=45</guid>
		<description><![CDATA[I have updated my Apple TV by using the patchstick on my usb flash drive.  Now I need to use my usb drive to do a linux boot so I can do a network install of RedHat AS 4.  I plugged in my usb drive to a SUSE 9 box I have and checked to [...]]]></description>
			<content:encoded><![CDATA[<p>I have updated my <a href="http://www.apple.com/appletv/">Apple TV</a> by using the <a href="http://code.google.com/p/atvusb-creator/">patchstick</a> on my usb flash drive.  Now I need to use my usb drive to do a linux boot so I can do a network install of RedHat AS 4.  I plugged in my usb drive to a SUSE 9 box I have and checked to see if it could see the device connected.</p>
<p>mikey:~ # view /proc/bus/usb/devices</p>
<p>T:  Bus=04 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=480 MxCh= 0<br />
D:  Ver= 2.00 Cls=00(&gt;ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1<br />
P:  Vendor=14af ProdID=af01 Rev=11.00<br />
S:  Manufacturer=SAMSUNG<br />
S:  Product=SAMSUNG SUM-2G<br />
S:  SerialNumber=0190107060001334<br />
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA<br />
I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage<br />
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms<br />
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=31875us</p>
<p>My machine sees the device but if I try and mount it.</p>
<p>mikey:~ # mkdir /mnt/usb<br />
mikey:~ # mount -t vfat /dev/sda1 /mnt/usb/<br />
mount: /dev/sda1 is not a valid block device</p>
<p>Now lets see what fdisk says.</p>
<p>mikey:~ # fdisk -l</p>
<p>Disk /dev/hda: 80.0 GB, 80032038912 bytes<br />
255 heads, 63 sectors/track, 9730 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>Device Boot      Start         End      Blocks   Id  System<br />
/dev/hda1               1         131     1052226   82  Linux swap<br />
/dev/hda2             132        9729    77095935   83  Linux</p>
<p>Disk /dev/sda: 2030 MB, 2030043136 bytes<br />
255 heads, 63 sectors/track, 246 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>Device Boot      Start         End      Blocks   Id  System<br />
/dev/sda1               1         247     1982463+  ee  EFI GPT<br />
<strong>Partition 1 has different physical/logical beginnings (non-Linux?):</strong><br />
phys=(1023, 254, 63) logical=(0, 0, 2)<br />
Partition 1 has different physical/logical endings:<br />
phys=(1023, 254, 63) logical=(246, 205, 23)<br />
The problem is the first (non-Linux?) physical partition.  To fix it I need to delete the partitions and recreate them.  Now I know my device isn&#8217;t mounted but just to make sure.</p>
<p>mikey:~ # umount /dev/sda1<br />
umount: /dev/sda1: not mounted</p>
<p>mikey:~ # fdisk /dev/sda</p>
<p>Command (m for help): d<br />
Selected partition 1</p>
<p>Command (m for help): n<br />
Command action<br />
e   extended<br />
p   primary partition (1-4)<br />
p<br />
Partition number (1-4): 1<br />
First cylinder (1-246, default 1): 1<br />
Last cylinder or +size or +sizeM or +sizeK (1-246, default 246): +750M</p>
<p>Command (m for help): a<br />
Partition number (1-4): 1</p>
<p>Command (m for help): t<br />
Selected partition 1<br />
Hex code (type L to list codes): 6<br />
Changed system type of partition 1 to 6 (FAT16)</p>
<p>Command (m for help): n<br />
Command action<br />
e   extended<br />
p   primary partition (1-4)<br />
p<br />
Partition number (1-4): 2<br />
First cylinder (93-246, default 93):<br />
Using default value 93<br />
Last cylinder or +size or +sizeM or +sizeK (93-246, default 246):<br />
Using default value 246</p>
<p>Command (m for help): w<br />
The partition table has been altered!</p>
<p>Calling ioctl() to re-read partition table.</p>
<p>WARNING: If you have created or modified any DOS 6.x<br />
partitions, please see the fdisk manual page for additional<br />
information.<br />
Syncing disks.<br />
mikey:~ # mkfs.vfat -F 16 -n rhboot /dev/sda1<br />
mkfs.vfat 2.10 (22 Sep 2003)</p>
<p>mikey:~ # mkfs.ext2 -b 4096 -L casper -rw /dev/sdb2<br />
mke2fs 1.38 (30-Jun-2005)<br />
Filesystem label=casper<br />
OS type: Linux<br />
Block size=4096 (log=2)<br />
Fragment size=4096 (log=2)<br />
154880 inodes, 309251 blocks<br />
15462 blocks (5.00%) reserved for the super user<br />
First data block=0<br />
10 block groups<br />
32768 blocks per group, 32768 fragments per group<br />
15488 inodes per group<br />
Superblock backups stored on blocks:<br />
32768, 65536, 98304, 131072, 163840, 196608, 229376, 262144, 294912</p>
<p>Writing inode tables: done<br />
Writing superblocks and filesystem accounting information: done</p>
<p>This filesystem will be automatically checked every 32 mounts or<br />
180 days, whichever comes first.  Use tune2fs -c or -i to override.</p>
<p>mikey:~ # mount /dev/sda1 /mnt/usb/</p>
<p>mikey:~ # dd if=/root/diskboot.img of=/dev/sda1<br />
12288+0 records in<br />
12288+0 records out</p>
<p>mikey:~ # fdisk /dev/sda</p>
<p>Command (m for help): p</p>
<p>Disk /dev/sda: 2030 MB, 2030043136 bytes<br />
255 heads, 63 sectors/track, 246 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>Device Boot      Start         End      Blocks   Id  System<br />
/dev/sda1   *           1          92      738958+   6  FAT16<br />
/dev/sda2              93         246     1237005   83  Linux</p>
<p>Now windows and Linux can read/write to my flash drive.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.npoore.com/2009/04/02/fixing-your-usb-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
