LinuxLinux

  Main Menu


  How much does a website cost?

Please contact us for a quote.

"If a man lives, it is a certainty he will die. Therefore, it is foolish to think of death as if he were a foe to be vanquished. He will come when he will come." - Caine

http://kungfu.bewarne.com

Home: Linux: Hard_drive_upgrade

Intro

I just recently did an upgrade on this system, added a newer bigger better drive. Initially when I inststalled redhat 8.0 (abandoning windows 2k), I just went for a default install, which only used a single partition. I was running into some crasing, and felt it might be the drive so got a newer faster bigger one. Turns out that the drive was (is) fine, but the newer one is way faster. :)

First, I ran some utils on the drive I had (Seagate Cheetah ST318203LC) that came out of a Sun box laying around a job I had in 2000. 18 gigger. I noticed in demsg output that the drive was limited to 20mhz (40mb/sec copies). I have an adaptec 160 controller, so I can use a faster drive.
So, its off to Fry's to get a Maxtor 36 gigger for $159 (plus 30 dollar mail in rebate. Whatever to rebates, but its nice to get a check like a year later or whenever). I still like Maxtor. Maxtor and IBM. Never Western Digital. Never never never.

Overview

Examine what you have
fdisk (restart)
mke2fs -j device
tune2fs -L LABEL device
mount
mkdir `ls /`
cp -rp src dest
edit /etc/fstab /boot/grub/grub.conf
.

Examine your setup

First, find you what you have. Do:

[root]# fdisk -l
That should list all the partition maps for all the drives you have on the system.

Read your fstab (File Systems TABle). It should be /etc/fstab. Do:

[root]# less /etc/fstab
You should see something like this:
LABEL=ROOT       /              ext3    defaults        1 1
LABEL=BOOT       /boot          ext3    defaults        1 2
LABEL=USR        /usr           ext3    defaults        1 2
LABEL=VAR        /var           ext3    defaults        1 2
LABEL=HOME       /home          ext3    defaults        1 2
/dev/sda2        swap           swap    defaults        0 0

#Stuff the system does:
none                  /dev/pts          devpts  gid=5,mode=620  0 0
none                  /proc             proc    defaults        0 0
none                  /dev/shm          tmpfs   defaults        0 0

# IDE files drive:
/dev/hdc1		/home/pub		ext3	defaults	1 1
/dev/hdc2		/home/files		ext3	defaults	1 1

# User mounts
/dev/cdrom       /mnt/cdrom        iso9660 noauto,owner,kudzu,ro 0 0
/dev/cdrom1      /mnt/cdrom1       udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0         /mnt/floppy       auto    noauto,owner,kudzu 0 0

I learned about using disk labels doing this. Its pretty cool. One way of writing a disk label is:

[root]# tune2fs -L ROOT /dev/sda1
Tune2fs should print some message about it's version if it suceeded. You can also use e2label. Usage: e2label device [newlabel]. I didn't, but you could.

tune2fs -l will show a bunch of info about a disk:

[root]# tune2fs -l
Should output a gallon of info about size, superblocks, mounts, create date, label, and a bunch of other stuff.

Plan your partition layout

Plan your partition layout. This is usually pretty nerve wracking. No one will tell you what your partition sizes should be. No one can say what your needs are but you and you probably don't even know. Anyway, here is what I ended doing with my 36 gig drive. (note that I had plenty of space left on my 18gb, most big files i— movies, mpegs — are on an ide drive)

[root]# fdisk -l /dev/sda

Disk /dev/sda: 36.7 GB, 36778545152 bytes
255 heads, 63 sectors/track, 4471 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
   /dev/sda1   *         1         7     56196   83  Linux
   /dev/sda2             8       132   1004062+  82  Linux swap
   /dev/sda3           133       257   1004062+  83  Linux
   /dev/sda4           258      4471  33848955    5  Extended
   /dev/sda5           258       880   5004216   83  Linux
   /dev/sda6           881      1005   1004031   83  Linux
   /dev/sda7          1006      4471  27840613+  83  Linux
1. First, the boot partition. 50mb. Way more than it will ever need. Its using like 8mb now.
2. Next, a gig of swap. (1024M)
3. Then, root. 1 gb. It’s 73% free.
4. An extended partion of the rest of the space
5. 5120M of space on /usr. This was the hardest to call. I could run out on /usr. Its 72 % full now.
6. A gig for /var
7. The rest for /home (about 26g)