Software Repository Mirror

From IHRIS Wiki

Preparing the Hard Drive

In the directions below we will assume that you have a brand new hard drive. We will be formatting the hard drive (partition) which means that all of the data on the hard drive will be lost. PLEASE MAKE SURE YOU KNOW EXACTLY WHAT YOU ARE DOING IN EACH STEP

To format the partition, we will first need to set the partition type

Determining the Hard Drive Paritition

To format the hard drive, we first to know what "partition" it is using. Ubuntu should automatically mount the hard drive should automatically once you plug it in. To determine run the command:

mount | grep media

Running this on my machine, I see output

/dev/sdb1 on /media/3539-6663 type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks)

Which means the /dev/sdb1 is the partition we will need to use.

If you see more than one line in the output then STOP as these directions may not be correct. If you see more than one line here, you probably have more than one external hard drive or flash disk connected. Remove all extra hard drive and rerun the "grep" command. If you still see more than one line, Please contact one of the of the iHRIS developers for more help.

Change The Hard Drive Partition Type

We will need to run the "fdisk" command interactively on the hard drive device. If the parition was /dev/sdb1, the hard drive device is /dev/sdb (remove the number from the partition). Here is a sample interaction. You should type in everything in bold (changing /dev/sdb as neeeded):

litlfred@cumin:/tmp$ sudo fdisk /dev/sdb
Command (m for help): p

Disk /dev/sdb: 1015 MB, 1015808000 bytes
13 heads, 36 sectors/track, 4239 cylinders, total 1984000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008db47

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     1983999      990976    6  FAT16

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 83
Changed system type of partition 1 to 83 (Linux) 

Command (m for help): p 

Disk /dev/sdb: 1015 MB, 1015808000 bytes
13 heads, 36 sectors/track, 4239 cylinders, total 1984000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008db47 

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     1983999      990976   83  Linux

Command (m for help): w
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.

Formatting The Hard Drive as ext3

Simply do:

sudo mkfs.ext3  /dev/sdb1


Labelling the hard drive

Now we want to make a lablel for our newly formatted hard drive so that we can refer to it easily later:

sudo tune2fs -L ihris /dev/sdb1

Testing

Unplug the hard drive and plug it back in. There should be a USB disk icon on your Desktop with the label "ihris". Also, running:

mount | grep medai

you should see somethine like:

/dev/sdc1 on /media/ihris type ext3 (rw,nosuid,nodev,uhelper=udisks)

Don't worry if your partition has changed from /dev/sdb1 to something else like /dev/sdc1

Creating the Software Repository

sources.list

The file /etc/apt/sources.list tells apt-get where to look for software packages to install.

We will want to have two versions of the sources.list file. One that will use the hard drive (sources.list.harddrive) and one that will use the internet (sources.list.internet). You will need to create a file /etc/apt/sources.list.harddrive


sources.list.internet

The default ubuntu installation assumes that you are connected to the interent. So we will simply copy the existing /etc/apt/sources.list to sources.list.internet

sudo cp /etc/apt/sources.list /etc/apt/sources.list.internet

sources.list.hardrive

We now need to create a version of the sources.list that will use the hard drive.

echo "deb file:///media/ihris/" `lsb_release -cs` "main universe " | sudo tee /etc/apt/sources.list.harddrive


Updating the Software Repository

Using the Software Repository

sources.list

deb file:/usb_drive/ubuntuMirror/mirror oneiric main