The 60GB disk on my laptop has become a huge limitation recently and instead of having to burn my movies onto DVDs regularly, I opted to shell out a whopping $65 (thanks to a BestBuy sale and $25 coupon) to buy a 120GB external mini-hard drive. It is not only tiny (weighing 7.2 oz) but it does not require an external power source as it can simply plug into my laptop's USB port.
While this hard drive does come with a lot of cool features like one-touch backups and file encryption for Windows and Macs, one would be lucky to just get it to work for Linux. For one, it comes formatted in NTFS format and is not writable initially. I will describe how I got it to work below. For starters, here are some specs of my system:
Pentium M 1.5MHz Banias, 60GB HD, 768MB DDR SDRAM, Linux version 2.6.20-15-generic (gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)) #2 SMP Sun Apr 15 07:36:31 UTC 2007
First, power up the external HD simply by plugging it into your computer. Most recent Linux systems should automatically recognize the external HD and probably auto-mount it. You can check if and where the HD is mounted by looking through the log files (/var/log/messages) or search the kernel logs (dmesg | tail ). For example, 'dmesg | grep -A 10 Maxtor | tail -10' gives:
Eritrea(berhane)% dmesg | grep -A 3 Maxtor | tail -3[ 94.604000] SCSI device sdb: 234441648 512-byte hdwr sectors (120034 MB)
[ 94.604000] sdb: Write Protect is off
[ 94.604000] sdb: Mode Sense: 17 00 00 00
Apparently the 120GB HD is labeled as '/dev/sdb'
There is some junk on the external HD that might be of some use to Windows/Mac users, so we can first copy those items to another location before repartitioning and formatting the disk. So, lets mount the HD and copy stuff off it.
cd /mnt
mkdir externalHD
mkdir /root/Maxtor
mount /dev/sda externalHD
cp -r externalHD/* /root/Maxtor/
Now, lets proceed to looking into the partition table for the external disk and change it into something we want.
fdisk /dev/sdb
Enter 'm' to see list of options if you have not used fdisk before. To see the partition table, enter 'p'. You probably see an NTFS partition if not more than one filesystem. Enter 'd' and delete the existing partitions until there are none left.
Not that the HD is clean, it is time to create new partition(s). I wanted one giant partition I could use for backing up my system, so I entered 'n' to create a new partition,and set the starting block at 0 and ending block to the last(default). I set the partition as primary, since you can have as many as four primary partitions per drive in Linux. The new parition table looks like:
Device Boot Start End Blocks Id System
/dev/sdb 1 14563 117640009+ 83 Linux
Enter 'w' to write the partition table. Thank fdisk and exit out of fdisk mode. Now, it is time to format the filesystem. To do that, enter
mkfs -t ext3 /dev/sdb
This process will probably take a while but it is the last thing you need to do to get the new external HD up and working.
When the external HD is connected, one would usually want the drive to be mounted automatically to a specific directory. To do so, it is necessary to add a line to '/etc/fstab' corresponding to this external HD. My addition looks like this:
/dev/sdb /mnt/externalHD auto users,noauto,atime,rw,dev,exec,suid 0 2
Well, that's it.
While this hard drive does come with a lot of cool features like one-touch backups and file encryption for Windows and Macs, one would be lucky to just get it to work for Linux. For one, it comes formatted in NTFS format and is not writable initially. I will describe how I got it to work below. For starters, here are some specs of my system:
Pentium M 1.5MHz Banias, 60GB HD, 768MB DDR SDRAM, Linux version 2.6.20-15-generic (gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)) #2 SMP Sun Apr 15 07:36:31 UTC 2007
First, power up the external HD simply by plugging it into your computer. Most recent Linux systems should automatically recognize the external HD and probably auto-mount it. You can check if and where the HD is mounted by looking through the log files (/var/log/messages) or search the kernel logs (dmesg | tail ). For example, 'dmesg | grep -A 10 Maxtor | tail -10' gives:
Eritrea(berhane)% dmesg | grep -A 3 Maxtor | tail -3[ 94.604000] SCSI device sdb: 234441648 512-byte hdwr sectors (120034 MB)
[ 94.604000] sdb: Write Protect is off
[ 94.604000] sdb: Mode Sense: 17 00 00 00
Apparently the 120GB HD is labeled as '/dev/sdb'
There is some junk on the external HD that might be of some use to Windows/Mac users, so we can first copy those items to another location before repartitioning and formatting the disk. So, lets mount the HD and copy stuff off it.
cd /mnt
mkdir externalHD
mkdir /root/Maxtor
mount /dev/sda externalHD
cp -r externalHD/* /root/Maxtor/
Now, lets proceed to looking into the partition table for the external disk and change it into something we want.
fdisk /dev/sdb
Enter 'm' to see list of options if you have not used fdisk before. To see the partition table, enter 'p'. You probably see an NTFS partition if not more than one filesystem. Enter 'd' and delete the existing partitions until there are none left.
Not that the HD is clean, it is time to create new partition(s). I wanted one giant partition I could use for backing up my system, so I entered 'n' to create a new partition,and set the starting block at 0 and ending block to the last(default). I set the partition as primary, since you can have as many as four primary partitions per drive in Linux. The new parition table looks like:
/dev/sdb 1 14563 117640009+ 83 Linux
Enter 'w' to write the partition table. Thank fdisk and exit out of fdisk mode. Now, it is time to format the filesystem. To do that, enter
mkfs -t ext3 /dev/sdb
This process will probably take a while but it is the last thing you need to do to get the new external HD up and working.
When the external HD is connected, one would usually want the drive to be mounted automatically to a specific directory. To do so, it is necessary to add a line to '/etc/fstab' corresponding to this external HD. My addition looks like this:
Well, that's it.
Comments