UH LADCP Documentation

Navigation

Previous topic

How to update the documentation

Next topic

Technical notes

This Page

Partition+Format a new disk

We use a file system called “ext3”. A new hard drive generally ships unpartitioned or with a single old-fashioned Windows (“fat32”) partition.

NOTE: Be very careful with these commands. You can erase the contents of your computer if you are wrong

Partitioning the disk

(1 ) become root

sudo su
(2 ) run the following command to see what disks exist on your
computer right now, and what their partitions exist. The program “fdisk” is used to partition the disk. The -l switch is to “look only”.
fdisk -l

You will see something like this:

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xcccdcccd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          12       96358+  83  Linux
/dev/sda2              13         255     1951897+  82  Linux swap / Solaris
/dev/sda3             256        9729    76099905    5  Extended
/dev/sda5             256        1471     9767488+  83  Linux
/dev/sda6            1472        9729    66332353+  83  Linux

(3 ) run the following command to see the end of this system status file:

dmesg | tail 30

(4 ) plug in your new disk

(5a) run dmesg | tail 30 and compare the results to the output of #3.

There should be some entries at the end about

  • finding the disk
  • identifying it by maker and size
  • giving it a name “/dev/sdb” – that is the disk
  • NOTE: Look for names with numbers too (“/dev/sdb1”, “/dev/sdb2”...) These are the partitions
(5b) run fdisk -l again to see what the new disk looks like.

Fdisk should tell you the same kind of information, i.e.

  • what size is the disk
  • what is the device letter
  • partition sizes and types (if any)
(6 ) If the disk has formatted partitions (eg. one “NTFS” or “fat32”
partition) then ubuntu probably mounted the disk. Run the following command to see whether the partitions on the new disk are mounted:
df
If they are mounted, unmount them. Do not perform the following commands on mounted partitions
(7 ) If you are ready to reformat (create a new/different filesytem on
a partition) skip to the section: putting a filesystem on a partition. Otherwise read the next section about using fdisk.

Using fdisk

In this simple example we have a disk denoted /dev/sde and it has no partitions. The program “fdisk” can be used to add one or more partitions to the disk. For a backup disk, we use one partition of type “ext3”.

You run fdisk on a disk (not a partition) and type letters as commands (one letter is one command) and follow the prompts. These are the commands fdisk uses (typing a ”?” results in this list):

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)

Run fdisk for our example by typing (as root)

fdisk /dev/sde

Then (comments are preceeded by “#” markes, commands are indented)

# print the partition table

      p

# make a new partition


      n

#  follow the prompts:

    # make a primary partition

        1

    # start at the beginning

       <CR>     # (hit the return key)


    # use the whole disk for the partition

       <CR>     # (hit the return key)

# by default this is an ext3 filesystem.

# we're done.  write out the partition table and exit

     w
Now you need to make a file system on that partition. See
putting a filesystem on a partition.

Putting a filesytem on a partition

Your disk should be

  • unmounted
  • have a partition present for the filesystem

If the partition is named /dev/sde1 and you are sure about this run the following command (as root)

mke2fs -j /dev/sde1

Assigning “volume name” (for example “ladcp_backup”) to the partition should result in the partition being mounted as /media/ladcp_backup. There is a character limitation (16 characters) for the name. To accomplish this, create the volume name (as root) :

e2label /dev/sde1 ladcp_backup

If your disk is a USB disk, you probably have to unplug it, count to 10, and plug it back in, and it should mount. Type df to see that it did mount as expected.

NOTE This mounted partition has no directories. You must add any directories to this partition as root, and set the permissions. For LADCP backups we want:

mkdir /media/ladcp_backup/current_cruise
mkdir /media/ladcp_backup/current_cruise_logging

chown science:efiring  /media/ladcp_backup/current_cruise
chown science:efiring  /media/ladcp_backup/current_cruise_logging