<?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>zeyaLabs &#187; drives</title>
	<atom:link href="http://www.zeyalabs.ch/tags/drives/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zeyalabs.ch</link>
	<description>Binary and Plain Stuff... and more</description>
	<lastBuildDate>Tue, 30 Nov 2010 14:27:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>External USB Hard Drive under Linux</title>
		<link>http://www.zeyalabs.ch/posts/external-usb-hard-drive-under-linux/</link>
		<comments>http://www.zeyalabs.ch/posts/external-usb-hard-drive-under-linux/#comments</comments>
		<pubDate>Sun, 23 May 2010 22:27:39 +0000</pubDate>
		<dc:creator>Oldie</dc:creator>
				<category><![CDATA[Techy Articles]]></category>
		<category><![CDATA[drives]]></category>
		<category><![CDATA[gear]]></category>
		<category><![CDATA[howtos]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://www.zeyalabs.ch/?p=312</guid>
		<description><![CDATA[&#8220;640 kilobytes ought to be enough for anybody.&#8221; — unknown source (often misattributed to Bill Gates) Yesterday, I had to replace a one-terabyte external USB hard drive attached to my home file server with a larger one&#8230; Oh, I wasn&#8217;t going to ramble about these days&#8217; lack of disk space, I just wanted to document&#160;<a class="more" href="http://www.zeyalabs.ch/posts/external-usb-hard-drive-under-linux/" title="read whole article">[...]</a>]]></description>
			<content:encoded><![CDATA[<p class="epigraph">
&#8220;640 kilobytes ought to be enough for anybody.&#8221;<br />
— unknown source (often misattributed to Bill Gates)
</p>
<p>Yesterday, I had to replace a one-terabyte external <acronym title="Universal Serial Bus">USB</acronym> hard drive attached to my home file server with a larger one&#8230;</p>
<p>Oh, I wasn&#8217;t going to ramble about these days&#8217; lack of disk space, I just wanted to document what I did to get the drive up and running: maybe someone could use this article as a quick start for their own configuration. (Mine was a two-terabyte Hitachi SimpleDrive under Fedora Core Linux.)</p>
<p>Please note that this is not a complete newbie manual on all aspects of the procedure, so don&#8217;t expect to find detailed explanations on things like which shell command does what or why this filesystem is better than that one or why I am <code>sudo</code>-ing when switching to <code>root</code> seems to be much easier an approach.</p>
<p>Here we go now. (Skip steps marked with <code>**</code> if you are not replacing a drive but installing a new one.)</p>
<ul>
<li>First of all, connect the <acronym title="Universal Serial Bus">USB</acronym> drive to your running Linux machine and power the former up.</li>
</ul>
<ul>
<li>Find out if and how the system recognized it.</li>
</ul>
<pre class="brush: plain; title: ; notranslate">
$&gt; sudo dmesg | tail
usb 4-6: new high speed <acronym title="Universal Serial Bus">USB</acronym> device using ehci_hcd and address 3
usb 4-6: configuration #1 chosen from 1 choice
scsi3 : <acronym title="Small Computer System Interface">SCSI</acronym> emulation for <acronym title="Universal Serial Bus">USB</acronym> Mass Storage devices
usb-storage: device found at 3
usb-storage: waiting for device to settle before scanning
usb-storage: device scan complete
scsi 3:0:0:0: Direct-Access     Hitachi  HDS722020ALA330       PQ: 0 ANSI: 2 CCS
sd 3:0:0:0: [sdc] 3907029168 512-byte hardware sectors (2000399 <acronym title="Megabyte">MB</acronym>)
sd 3:0:0:0: [sdc] Write Protect is off
sd 3:0:0:0: [sdc] Mode Sense: 34 00 00 00
sd 3:0:0:0: [sdc] Assuming drive cache: write through
sd 3:0:0:0: [sdc] 3907029168 512-byte hardware sectors (2000399 <acronym title="Megabyte">MB</acronym>)
sd 3:0:0:0: [sdc] Write Protect is off
sd 3:0:0:0: [sdc] Mode Sense: 34 00 00 00
sd 3:0:0:0: [sdc] Assuming drive cache: write through sdc: sdc1
sd 3:0:0:0: [sdc] Attached <acronym title="Small Computer System Interface">SCSI</acronym> disk
sd 3:0:0:0: Attached scsi generic sg3 type 0
VFS: Can't find ext3 filesystem on dev sdc1.
</pre>
<p>From this output you can see that the drive was recognized as device <code>/dev/sdc</code> with a single partition <code>/dev/sdc1</code>.</p>
<p>The partition&#8217;s filesystem is not ext3. (Factory-preformatted FAT32, most likely.) Since the drive will remain attached to a Linux machine, it would make sense to reformat it into something native.</p>
<ul>
<li>Partition the drive.</li>
</ul>
<pre class="brush: bash; title: ; notranslate">
$&gt; sudo /sbin/fdisk /dev/sdc
</pre>
<p>Choose the appropriate options from the menu. I went this way:<br />
<code>p</code> — print current partition table;<br />
<code>l</code> — list known partition types (filesystems);<br />
<code>d</code> — delete current partition;<br />
<code>n</code> — create new partition.</p>
<p>For this new partition, specify:<br />
<code>p</code> — primary partition;<br />
<code>1</code> — partition number;<br />
default values for first/last cylinder;<br />
<code>Linux</code> — partition type (which is <code>etx3</code> on this system; ID 83 in the list of known partition types mentioned above).</p>
<p>And finally:<br />
<code>w</code> — write table to disk and exit.</p>
<ul>
<li>Create filesystem (format partition).</li>
</ul>
<pre class="brush: bash; title: ; notranslate">
$&gt; sudo /sbin/mkfs.ext3 -j /dev/sdc1
</pre>
<ul>
<li>Create mount point.</li>
</ul>
<pre class="brush: bash; title: ; notranslate">
$&gt; sudo mkdir /mnt/mynewdrive
</pre>
<ul>
<li>Mount the new drive&#8217;s partition for file transfer.**</li>
</ul>
<pre class="brush: bash; title: ; notranslate">
$&gt; sudo mount -t ext3 /dev/sdc1 /mnt/mynewdrive
</pre>
<ul>
<li>Transfer files from the old drive.**</li>
</ul>
<pre class="brush: bash; title: ; notranslate">
$&gt; sudo cp -Rvp /mnt/myolddrive/ /mnt/mynewdrive
</pre>
<p>Don&#8217;t forget the <code>-p</code> option to preserve file ownership and permissions. Mind the slash after <code>myolddrive/</code>.</p>
<p>This will take some time. (14 hours for approximately 800 <acronym title="Gigabyte">GB</acronym> in my case.)</p>
<ul>
<li>Unmount both drives.**</li>
</ul>
<p>Prior to that, stop any processes/services which might still be using the drives. (In my case, for instance, it was a Samba fileserver daemon holding shared folders on the old drive.)</p>
<pre class="brush: bash; title: ; notranslate">
$&gt; sudo umount /mnt/mynewdrive
$&gt; sudo umount /mnt/myolddrive
</pre>
<p>Notice that the command is <code>umount</code>, not <code>u<del>n</del>mount</code>.</p>
<ul>
<li>Disconnect the old drive. Reposition and/or reconnect the new one, if necessary.**</li>
</ul>
<ul>
<li>Check if the new drive is still recognized under its original name.**</li>
</ul>
<p>In my case, it wasn&#8217;t: it took place of the old one, which went under <code>/dev/sdb</code> (with partition <code>/dev/sdb1</code>).</p>
<p>For this check, look through latest system messages like you did in the beginning:</p>
<pre class="brush: bash; title: ; notranslate">
$&gt; sudo dmesg | tail
</pre>
<ul>
<li>Adjust <code>fstab</code>.</li>
</ul>
<p>Open <code>fstab</code> for editing:</p>
<pre class="brush: bash; title: ; notranslate">
$&gt; sudo vi /etc/fstab
</pre>
<p>Remove old drive&#8217;s mapping**:</p>
<pre class="brush: bash; title: ; notranslate">
/dev/sdb1     /mnt/myolddrive     ext3     defaults     0 0
</pre>
<p>Add new drive&#8217;s mount options:</p>
<pre class="brush: bash; title: ; notranslate">
/dev/sdb1     /mnt/mynewdrive     ext3     defaults     0 0
</pre>
<p>Make sure to specify the correct partition name.</p>
<p>Save changes.</p>
<ul>
<li>Re-mount the new drive.</li>
</ul>
<pre class="brush: bash; title: ; notranslate">
$&gt; sudo mount /dev/sdc1
</pre>
<ul>
<li>Enjoy your new large-capacity storage.</li>
</ul>
<p>Two terabytes ought to be enough for anybody, right?</p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.zeyalabs.ch%2Fposts%2Fexternal-usb-hard-drive-under-linux%2F&amp;title=External%20USB%20Hard%20Drive%20under%20Linux" id="wpa2a_2"><img src="http://www.zeyalabs.ch/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.zeyalabs.ch/posts/external-usb-hard-drive-under-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

