Welcome!

Linux Containers Authors: Liz McMillan, Pat Romanski, Elizabeth White, Yeshim Deniz, Jyoti Bansal

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
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with the 21st International Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. @ThingsExpo Silicon Valley Call for Papers is now open.
SYS-CON Events announced today that DivvyCloud will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. DivvyCloud software enables organizations to achieve their cloud computing goals by simplifying and automating security, compliance and cost optimization of public and private cloud infrastructure. Using DivvyCloud, customers can leverage programmatic Bots to identify and remediate common cloud problems in rea...
SYS-CON Events announced today that Tintri, Inc, a leading provider of enterprise cloud infrastructure, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Tintri offers an enterprise cloud platform built with public cloud-like web services and RESTful APIs. Organizations use Tintri all-flash storage with scale-out and automation as a foundation for their own clouds – to build agile development environments...
SYS-CON Events announced today that Fusion, a leading provider of cloud services, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Fusion, a leading provider of integrated cloud solutions to small, medium and large businesses, is the industry’s single source for the cloud. Fusion’s advanced, proprietary cloud service platform enables the integration of leading edge solutions in the cloud, including cloud...
SYS-CON Events announced today that Peak 10, Inc., a national IT infrastructure and cloud services provider, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Peak 10 provides reliable, tailored data center and network services, cloud and managed services. Its solutions are designed to scale and adapt to customers’ changing business needs, enabling them to lower costs, improve performance and focus intern...
SYS-CON Events announced today that Progress, a global leader in application development, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Enterprises today are rapidly adopting the cloud, while continuing to retain business-critical/sensitive data inside the firewall. This is creating two separate data silos – one inside the firewall and the other outside the firewall. Cloud ISVs ofte...
SYS-CON Events announced today that Systena America will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Systena Group has been in business for various software development and verification in Japan, US, ASEAN, and China by utilizing the knowledge we gained from all types of device development for various industries including smartphones (Android/iOS), wireless communication, security technology and IoT serv...
DevOps at Cloud Expo – being held October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA – announces that its Call for Papers is open. Born out of proven success in agile development, cloud computing, and process automation, DevOps is a macro trend you cannot afford to miss. From showcase success stories from early adopters and web-scale businesses, DevOps is expanding to organizations of all sizes, including the world's largest enterprises – and delivering real r...
SYS-CON Events announced today that Hitachi Data Systems, a wholly owned subsidiary of Hitachi LTD., will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City. Hitachi Data Systems (HDS) will be featuring the Hitachi Content Platform (HCP) portfolio. This is the industry’s only offering that allows organizations to bring together object storage, file sync and share, cloud storage gateways, and sophisticated search and...
The 21st International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Digital Transformation, Machine Learning and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding busin...
SYS-CON Events announced today that Technologic Systems Inc., an embedded systems solutions company, will exhibit at SYS-CON's @ThingsExpo, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Technologic Systems is an embedded systems company with headquarters in Fountain Hills, Arizona. They have been in business for 32 years, helping more than 8,000 OEM customers and building over a hundred COTS products that have never been discontinued. Technologic Systems’ pr...
SYS-CON Events announced today that Carbonite will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Carbonite protects your entire IT footprint with the right level of protection for each workload, ensuring lower costs and dependable solutions with DoubleTake and Evault.
New competitors, disruptive technologies, and growing expectations are pushing every business to both adopt and deliver new digital services. This ‘Digital Transformation’ demands rapid delivery and continuous iteration of new competitive services via multiple channels, which in turn demands new service delivery techniques – including DevOps. In this power panel at @DevOpsSummit 20th Cloud Expo, moderated by DevOps Conference Co-Chair Andi Mann, panelists will examine how DevOps helps to meet th...
SYS-CON Events announced today that Progress, a global leader in application development, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Enterprises today are rapidly adopting the cloud, while continuing to retain business-critical/sensitive data inside the firewall. This is creating two separate data silos – one inside the firewall and the other outside the firewall. Cloud ISVs oft...
SYS-CON Events announced today that CollabNet, a global leader in enterprise software development, release automation and DevOps solutions, will be a Bronze Sponsor of SYS-CON's 20th International Cloud Expo®, taking place from June 6-8, 2017, at the Javits Center in New York City, NY. CollabNet offers a broad range of solutions with the mission of helping modern organizations deliver quality software at speed. The company’s latest innovation, the DevOps Lifecycle Manager (DLM), supports Value S...
SYS-CON Events announced today that Cloudistics, an on-premises cloud computing company, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Cloudistics delivers a complete public cloud experience with composable on-premises infrastructures to medium and large enterprises. Its software-defined technology natively converges network, storage, compute, virtualization, and management into a ...
SYS-CON Events announced today that Ocean9will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Ocean9 provides cloud services for Backup, Disaster Recovery (DRaaS) and instant Innovation, and redefines enterprise infrastructure with its cloud native subscription offerings for mission critical SAP workloads.
Multiple data types are pouring into IoT deployments. Data is coming in small packages as well as enormous files and data streams of many sizes. Widespread use of mobile devices adds to the total. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists will look at the tools and environments that are being put to use in IoT deployments, as well as the team skills a modern enterprise IT shop needs to keep things running, get a handle on all this data, and deli...
We build IoT infrastructure products - when you have to integrate different devices, different systems and cloud you have to build an application to do that but we eliminate the need to build an application. Our products can integrate any device, any system, any cloud regardless of protocol," explained Peter Jung, Chief Product Officer at Pulzze Systems, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.