Technology news and Jobs
The Linux distillery
Adding a new hard disk to Linux, and why the Linux filesystem trounces Windows' butt
The Linux distillery
Adding a new hard disk to Linux, and why the Linux filesystem trounces Windows' butt | Adding a new hard disk to Linux, and why the Linux filesystem trounces Windows' butt |
|
| by David M Williams | |
| Thursday, 02 October 2008 | |
|
Page 4 of 5 Now, if you have added a pristine, virgin hard drive to your computer it will not have any existing partitions on it. It will be completely blank. In this case it’s certain Linux has not mounted it automatically.Featured Whitepaper
5 Best Practices for Smartphone Support
The first thing you must do is prepare the disk for use, and to partition it yourself. This is handled by the command fdisk (for “fixed disk”) and needs the target hard drive to be named, eg fdisk /dev/sdb1. The fdisk command gives a lengthy menu of options. The only ones you’ll really need to know are ‘p’ which prints the current proposed partition table, ‘n’ to make a new partition, ‘q’ to quit without applying any changes and ‘w’ to exit after applying your changes. Even if you’re sure the disk is blank it is sensible to use ‘p’ before doing anything else to verify there definitely are no existing partitions. Once you are sure press ‘n’ to make a new partition. It’s up to you, and your purposes, whether you turn the whole disk into one big partition or you break the disk up into smaller sized chunks. No matter what you do press ‘p’ one more time to verify things are how you wanted. At this stage the disk has not actually been altered in any way. If you press ‘q’ you will quit and leave things just as they were. Press ‘w’ to actually apply the partitioning. Secondly, you must now format the partition(s) you made. Keep in mind that although you partition a disk (/dev/sdb in this case) you format (and mount) partitions (for instance /dev/sdb1.) Use the command mkfs (“make filesystem”) followed by the partition, such as mkfs /dev/sdb1. The disk will be formatted using the default filesystem type in your distribution. You can use the –t flag to specify a different filesystem type. If you want to share the hard drive with Windows computers you might execute mkfs –t ntfs /dev/sdb1. Once this step has been performed you can treat your hard disk just as if it had been partitioned and formatted from the beginning. Use the mount command to connect it to the filesystem wherever you desire. I mentioned we’d look at a third case. This one is actually pretty simple. If you plug in a removable USB hard drive Linux will almost certainly mount it and place a shortcut icon on your desktop. It gets special treatment because Linux recognises it as a removable disk just like a memory stick that could be loaded with photos. Yet, it’s still a hard drive at heart. It still has a device name like /dev/sdb1 and it can be manually mounted and unmounted. Which leads us nicely to something that Linux truly is fabulous at and which Windows can’t do anywhere near as well. CONTINUED |
| < Next story in category | Previous story in the category > |
|---|









