Welcome!

Linux Containers Authors: Liz McMillan, Pat Romanski, Yeshim Deniz, Elizabeth White, PagerDuty Blog

Related Topics: Linux Containers

Linux Containers: Article

How to install another hard disk

Adding 120 gigabytes to your Linux computer is easy as 1-2-3

(LinuxWorld) — My desktop machine has been cramped for space for at least a year. I've had to shuffle games, data, applications and digital images on and off the system as I needed them. There just wasn't enough available space on the two existing drives, and it was past time to do something about it. That's what I'm writing about this week: adding a new hard drive to your existing Linux system.

I decided on a Western Digital Caviar IDE drive. Model WD1200JB is rated at 120-gigabyte capacity, spins at 7200 RPMs and sports an 8-megabyte cache. I found a good price for it online as a bare drive (meaning without any cables or hardware to facilitate installation), and I ordered it. Total cost was $131.99, including shipping and handling. Bless froogle.google.com.

I remember scraping my knuckles a couple of times when I did a similar upgrade a few years ago. I was hopeful that this time it would go a little easier. It did, by a considerable margin. Maybe I've gotten better at reading the HowTo's; this time, I followed the LinuxPlanet tutorial on adding a new (empty) hard drive (See the Resources below).

To begin with, of course, I had to decide where I would attach the new drive. My desktop machine can handle four IDE-drives in its current configuration. Three of them were already occupied, handling the two existing hard drives and the HP 9100 CD-RW drive.

 

The hardware map looked like this

The primary IDE-controller had my boot drive connected as master and the HP CD-ROM as slave. Linux recognizes those devices as /dev/hda and /dev/hdb. I think of them as hard drive a and hard drive b. The secondary IDE controller (each controller can support only two drives) had my second hard drive as master. At one time, I had a DVD drive as secondary, but it's been gone for a while.

Idiot laws like the DMCA make a DVD-drive on a Linux box a much less attractive option, so I simply don't use my DVD-drive any longer. Linux sees my second hard drive as /dev/hdc. See the pattern emerging? I think of it as hard drive c. Extra credit if you can predict what Linux called my new hard drive when I connect it as slave on the secondary controller. That's right, my dweeb! It is now known as /dev/hdd.

As I looked at my existing hardware, something inside told me I had better be sure whether I should connect the new drive to the middle connector on the cable or if it should be at the end. I went on one of the help channels on irc.freenode.net to find out. It turns out that it doesn't matter, so long as you have correctly strapped the drive as either master or slave. If you strap it for Cable Select, it matters.

Back in the day, I think it mattered when I was adding new 20-megabyte Seagate MFM drives to my 80286 machine. Not so with the IDE drives of today. My new drive came jumpered as CS, for Cable Select. I removed the jumper cap from the CS pins and slipped it over the pins marked as SL, for slave.

With that irritating question out of the way, I shut down my desktop machine and physically installed the drive. The middle connector was available on the cable (the end connector was connecting to my existing second hard drive), so I used it. The ribbon edge of the cable, which marks the pin-1 side, almost always is closest to the power connection on the back of the drive. That rule held true this time as well, so there was no fumbling around required for me to connect the cable. Then I connected a power lead from the box to the drive. With the drive secured inside the box, the hardware side of the installation was done. It only took about five minutes.

After rebooting, I followed the HowTo and started the software side of the installation. The first step of that process was to partition the drive. I used fdisk for the task. As root, I entered the following command to start fdisk and point it at the correct drive:

# /sbin/fdisk /dev/hdd

If you're not familiar with fdisk usage, it's pretty simple. Enter an m, and it will list all the commands available to you. The first command I entered was p, to print the current partition table. Because the drive was brand-new, nothing was displayed. Then I entered n to create a new partition, p to make it a primary partition, and 1 for the partition number. Easy as pie, and we're almost halfway through.

Next, I told fdisk how large I wanted the partition to be. There are several ways to do this, but the default is to give it a starting and ending cylinder number. It prompts you for each, suggesting the first cylinder as the starting place and the last cylinder for the ending spot. I just hit Enter to accept both suggestions. Then it was only a matter of telling fdisk to write the new partition table.

If doing geeky stuff from the command line makes you nervous, it may help calm your nerves to know that nothing you do in fdisk is applied until you tell it to write a new partition-table. This allows you to check and double-check every step to make sure you have it right. I printed the partition table again to make sure that partition 1 was there, and then entered w to save the new table. Nothing to it.

Then it was time to format the drive. I used the example mkfs command to create an ext3 filesystem given in the HowTo by typing the following as root:

mkfs -t ext2 -j /dev/hdd1

Note that in addition to telling mkfs what drive we are talking about, we need to tell it which partition. There is only one partition on the new drive: partition 1. That's why I entered /dev/hdd1 instead of simply /dev/hdd in the command above.

Now just two more quick tasks, and my new drive will be installed and ready to use. I decided to call it bigdog, because it dwarfs the older drives in the box. The first step was to create a directory I could use as a mount-point. I did this by entering the following commands as root. The first command creates the directory while the second gives me all rights to it:

mkdir /bigdog
chown warthawg.warthawg /bigdog

Now I was ready for the very last part of the installation: adding bigdog to /etc/fstab so the system would know about it at boot time. That way, I won't have to manually mount it each time I restart the system. That was as easy as adding the following line to the end of the file:

/dev/hdd1   /bigdog   ext3    defaults     1 2

Then I rebooted the system and watched as the drives spun up. I was able to use the new drive immediately; everything just worked exactly as it was supposed to. The entire process only took about 15 or 20 minutes. It sure didn't seem that easy the first time I did it — I know I've learned a lot more about Linux than I knew then, but I think most of the credit has to go to the HowTo I followed to do the job.

OK, now it's your turn. Have I missed something? Would you have done it differently? Is there a nice disk-manager available that does all of the above in a friendly GUI? Let me know in the forum.

More Stories By Joe Barr

Joe Barr is a freelance journalist covering Linux, open source and network security. His 'Version Control' column has been a regular feature of Linux.SYS-CON.com since its inception. As far as we know, he is the only living journalist whose works have appeared both in phrack, the legendary underground zine, and IBM Personal Systems Magazine.

Comments (5) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Adipex 03/21/04 08:17:52 PM EST

interesting article .. any more?

Peter Sattler 12/08/03 04:51:25 PM EST

Nice description, clearly helpful for beginners. The only flaw I see is : why reboot ? Add to /etc/fstab and mount !
e.g. mount /bigblock - or how was the name of your freshly created mountpoint ?!
btw: Thanks to bex for cfdisk. I like that.

bex 11/12/03 10:29:32 AM EST

Instead of using fdisk you could have used cfdisk. It's not _exactly_ a nice friendly GUI since it's done in the console but I like it better than fdisk. You can see what you're doing better. I think it's an fdisk clone of sorts.

Jon Keeble 10/02/03 07:49:21 AM EDT

Good article, and relevant for systems with pre-existing ide drivers. What happens when the existing disk(s) are SCSI? When the ide disk is added, attempts for format result in messages like 'hda: no driver present'. How to add a driver?

J-J Cote 08/26/03 01:40:16 PM EDT

I think it would be helpful, on the mkfs line, to explain that the -j option specifies an ext3 filesystem. Everything is correct as you have it, but it looks like a typo if you don't understand the arguments to mkfs.

Thanks.

@ThingsExpo Stories
SYS-CON Events announced today that B2Cloud will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. B2Cloud specializes in IoT devices for preventive and predictive maintenance in any kind of equipment retrieving data like Energy consumption, working time, temperature, humidity, pressure, etc.
SYS-CON Events announced today that Massive Networks, that helps your business operate seamlessly with fast, reliable, and secure internet and network solutions, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. As a premier telecommunications provider, Massive Networks is headquartered out of Louisville, Colorado. With years of experience under their belt, their team of...
SYS-CON Events announced today that NetApp has been named “Bronze Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. NetApp is the data authority for hybrid cloud. NetApp provides a full range of hybrid cloud data services that simplify management of applications and data across cloud and on-premises environments to accelerate digital transformation. Together with their partners, NetApp em...
SYS-CON Events announced today that Interface Corporation will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Interface Corporation is a company developing, manufacturing and marketing high quality and wide variety of industrial computers and interface modules such as PCIs and PCI express. For more information, visit http://www.i...
SYS-CON Events announced today that Mobile Create USA will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Mobile Create USA Inc. is an MVNO-based business model that uses portable communication devices and cellular-based infrastructure in the development, sales, operation and mobile communications systems incorporating GPS capabi...
SYS-CON Events announced today that Nihon Micron will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Nihon Micron Co., Ltd. strives for technological innovation to establish high-density, high-precision processing technology for providing printed circuit board and metal mount RFID tags used for communication devices. For more inf...
SYS-CON Events announced today that N3N will exhibit at SYS-CON's @ThingsExpo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. N3N’s solutions increase the effectiveness of operations and control centers, increase the value of IoT investments, and facilitate real-time operational decision making. N3N enables operations teams with a four dimensional digital “big board” that consolidates real-time live video feeds alongside IoT sensor data a...
SYS-CON Events announced today that SIGMA Corporation will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. uLaser flow inspection device from the Japanese top share to Global Standard! Then, make the best use of data to flip to next page. For more information, visit http://www.sigma-k.co.jp/en/.
SYS-CON Events announced today that Suzuki Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Suzuki Inc. is a semiconductor-related business, including sales of consuming parts, parts repair, and maintenance for semiconductor manufacturing machines, etc. It is also a health care business providing experimental research for...
While some developers care passionately about how data centers and clouds are architected, for most, it is only the end result that matters. To the majority of companies, technology exists to solve a business problem, and only delivers value when it is solving that problem. 2017 brings the mainstream adoption of containers for production workloads. In his session at 21st Cloud Expo, Ben McCormack, VP of Operations at Evernote, will discuss how data centers of the future will be managed, how th...
SYS-CON Events announced today that Ryobi Systems will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Ryobi Systems Co., Ltd., as an information service company, specialized in business support for local governments and medical industry. We are challenging to achive the precision farming with AI. For more information, visit http:...
SYS-CON Events announced today that MIRAI Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MIRAI Inc. are IT consultants from the public sector whose mission is to solve social issues by technology and innovation and to create a meaningful future for people.
SYS-CON Events announced today that mruby Forum will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. mruby is the lightweight implementation of the Ruby language. We introduce mruby and the mruby IoT framework that enhances development productivity. For more information, visit http://forum.mruby.org/.
SYS-CON Events announced today that Fusic will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Fusic Co. provides mocks as virtual IoT devices. You can customize mocks, and get any amount of data at any time in your test. For more information, visit https://fusic.co.jp/english/.
In his session at @ThingsExpo, Greg Gorman is the Director, IoT Developer Ecosystem, Watson IoT, will provide a short tutorial on Node-RED, a Node.js-based programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using a wide range of nodes in the palette that can be deployed to its runtime in a single-click. There is a large library of contributed nodes that help so...
SYS-CON Events announced today that Enroute Lab will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Enroute Lab is an industrial design, research and development company of unmanned robotic vehicle system. For more information, please visit http://elab.co.jp/.
Agile has finally jumped the technology shark, expanding outside the software world. Enterprises are now increasingly adopting Agile practices across their organizations in order to successfully navigate the disruptive waters that threaten to drown them. In our quest for establishing change as a core competency in our organizations, this business-centric notion of Agile is an essential component of Agile Digital Transformation. In the years since the publication of the Agile Manifesto, the conn...
Real IoT production deployments running at scale are collecting sensor data from hundreds / thousands / millions of devices. The goal is to take business-critical actions on the real-time data and find insights from stored datasets. In his session at @ThingsExpo, John Walicki, Watson IoT Developer Advocate at IBM Cloud, will provide a fast-paced developer journey that follows the IoT sensor data from generation, to edge gateway, to edge analytics, to encryption, to the IBM Bluemix cloud, to Wa...
There is huge complexity in implementing a successful digital business that requires efficient on-premise and cloud back-end infrastructure, IT and Internet of Things (IoT) data, analytics, Machine Learning, Artificial Intelligence (AI) and Digital Applications. In the data center alone, there are physical and virtual infrastructures, multiple operating systems, multiple applications and new and emerging business and technological paradigms such as cloud computing and XaaS. And then there are pe...
SYS-CON Events announced today that Keisoku Research Consultant Co. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Keisoku Research Consultant, Co. offers research and consulting in a wide range of civil engineering-related fields from information construction to preservation of cultural properties. For more information, vi...