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
(1 ) become root
sudo su
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
There should be some entries at the end about
Fdisk should tell you the same kind of information, i.e.
df
If they are mounted, unmount them. Do not perform the following commands on mounted partitions
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
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