what to do with a new harddisk

Paul Howarth paul at city-fan.org
Thu May 5 07:41:40 UTC 2005


Jeff Kinz wrote:
> On Wed, May 04, 2005 at 07:10:22PM -0700, Charles Li wrote:
> 
>>I have FC3 installed.  Now I just put in a new HD,
>>which use to have Windows on it.  What do I need to do
>>to this HD to make FC3 use it, should I reformat it?
> 
> 
> Assuming this is a second ide drive:
> 
> no need to reformat, unless you have security concerns about the data.
> 
> Install the drive
> boot up
> bring up a root shell/xterm
> run fdisk on the drive
> delete all the existing partitions
> then create a new partition using the whole disk
> then write the partition out
> exit from fdisk 
> run mkfs to create a new file system on that device
> mount the new file system on the desired directory.
> 
> Looks like this:  (/* means "a comment" )
> 
> ###################################################################
> 
> [root at redline /]# fdisk /dev/hdb       /* start the fdisk program
> 
> The number of cylinders for this disk is set to 1870.
> There is nothing wrong with that, but this is larger than 1024,
> and could in certain setups cause problems with:
> 1) software that runs at boot time (e.g., old versions of LILO)
> 2) booting and partitioning software from other OSs
>    (e.g., DOS FDISK, OS/2 FDISK)
> 
> Command (m for help): p             /* print out the current partition
> 				    /*table
> 
> Disk /dev/hdb: 255 heads, 63 sectors, 1870 cylinders
> Units = cylinders of 16065 * 512 bytes
> 
>    Device Boot    Start       End    Blocks   Id  System
> /dev/hdb1             1       638   5120104+  83  Linux
> /dev/hdb2           638      1275   5120136   83  Linux
> 
> Command (m for help): m        /* print help
> Command action
>    a   toggle a bootable flag
>    b   edit bsd disklabel
>    c   toggle the dos compatibility flag
>    d   delete a partition
>    l   list known partition types
>    m   print this menu
>    n   add a new partition
>    o   create a new empty DOS partition table
>    p   print the partition table
>    q   quit without saving changes
>    s   create a new empty Sun disklabel
>    t   change a partition's system id
>    u   change display/entry units
>    v   verify the partition table
>    w   write table to disk and exit
>    x   extra functionality (experts only)
> 
> Command (m for help): d               /* delete a partition
> Partition number (1-4): 2             /* partition 2
> 
> Command (m for help): d               /* delete a partition
> Partition number (1-4): 1             /* partition 1
> 
> Command (m for help): p               /* print part. table
> 
> Disk /dev/hdb: 255 heads, 63 sectors, 1870 cylinders
> Units = cylinders of 16065 * 512 bytes
> 
>    Device Boot    Start       End    Blocks   Id  System
> 
> Command (m for help): n     /* add a new partition
> Command action
>    e   extended
>    p   primary partition (1-4)
> p                                    /* use "primary"
> Partition number (1-4): 1            /* start with #1
> First cylinder (1-1870, default 1):
> Using default value 1              /* use the defaults, Luke
> Last cylinder or +size or +sizeM or +sizeK (1-1870, default 1870):
> Using default value 1870           /* use the defaults, Luke
> 
> Command (m for help): p
> 
> Disk /dev/hdb: 255 heads, 63 sectors, 1870 cylinders
> Units = cylinders of 16065 * 512 bytes
> 
>    Device Boot    Start       End    Blocks   Id  System
> /dev/hdb1             1      1870  15020743+  83  Linux
> 
> Command (m for help): w           /* write table to disk
> The partition table has been altered!
> 
> Calling ioctl() to re-read partition table.
> 
> WARNING: If you have created or modified any DOS 6.x
> partitions, please see the fdisk manual page for additional
> information.
> Syncing disks.
> [root at redline /]#   /* done w/fdisk  start mkfs now
> 
> [root at redline /]# mkfs -t ext2 -v /dev/hdb1   /* make a filesystem
> mke2fs 1.23, 15-Aug-2001 for EXT2 FS 0.5b, 95/08/09
> Filesystem label=
> OS type: Linux
> Block size=4096 (log=2)
> Fragment size=4096 (log=2)
> 1880480 inodes, 3755185 blocks
> 187759 blocks (5.00%) reserved for the super user
> First data block=0
> 115 block groups
> 32768 blocks per group, 32768 fragments per group
> 16352 inodes per group
> Superblock backups stored on blocks:
>         32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632,
> 2654208
> 
> Writing inode tables: done
> Writing superblocks and filesystem accounting information: done
> 
> This filesystem will be automatically checked every 23 mounts or
> 180 days, whichever comes first.  Use tune2fs -c or -i to override.
> [root at redline /]# mount -t ext2 /dev/hdb1 /my_new_directory

If you have done a default install of FC3 then you will be using LVM. 
This gives you the opportunity to use the additional disk space as if it 
was extra space on your existing filesystems rather than creating a new 
partition and mounting it at a fixed mountpoint, where the only 
additional space you'll get is under that mountpoint.

To do this, proceed as above up to the "p" command in "fdisk". At this 
point, do the following:

Use the "t" command in fdisk to change the type of the new partition to 
"8e" (Linux LVM). Then use the "w" command as above to write out the new 
partition table.

You would then set up your new partition as an LVM physical volume:
# pvcreate /dev/hdb1

You can then add this new space to your existing volume group, which by 
default is called Volume00 (the "vgdisplay" command will show you which 
volume groups you have):
# vgextend Volume00 /dev/hdb1

You can then allocate additional space to any existing logical volumes 
you have. I think by default that you get LogVol00 for the root 
partition and LogVol01 for swap ("df" or a look in your /etc/fstab file 
should show you what you have). Use the "lvextend" command to do this 
(see "man lvextend").

e.g. to add 50G to LogVol00:
# lvextend --size 50G /dev/Volume00/LogVol00

Finally, you thne increase the size of the filesystem to fill the bigger 
logical volume. In FC3, this can be done whilst the filesystem is mounted:

# ext2online -v /dev/Volume00/LogVol00

Paul.




More information about the fedora-list mailing list