Jan 22 2009
Preparing the external disks(USB) for linux
All new external USB/FireWire disks come formatted as FAT32. The file permissions can get a little messed up, if we use that type of disk for Linux machines. So, there are two things we need to do for any brand new disk: (1) Create a partition (provides a partition table) and (2) format the disk for ext3. An example follows after two important notes…
Before you begin:
Please take note that all of the specific /dev/### device information used in the example will be unique to your machine. Therefore, you should not follow the example verbatim… you’ll need to figure out WHICH device you actually need to partition and format. One way to determine the logical mount point of a new device is to compare what is listed by running ‘df’ or ‘mount’ with what shows up in:
#> cat /proc/diskstats
Also, the new disk that you are formatting SHOULD NOT be mounted to the machine during the format process. It is also necessary to disable fstab-sync prior to formatting to prevent the machine from trying to ‘automount’ the disk during the process.
Disabling fstab-sync:
Follow these steps to disable/enable fstab-sync before/after formatting a new disk:
Disabling…
(1) #> cd /etc/hal/device.d/
(2) #> rm 50-fstab-sync.hal
(3) #> ln -s /bin/false 50-fstab-sync.hal
Enabling…
(1) #> cd /etc/hal/device.d/
(2) #> rm 50-fstab-sync.hal
(3) #> ln -s /usr/sbin/fstab-sync 50-fstab-sync.hal
Format example using fdisk:
Here is an example of how the process works:
#Partition the disk for ext3
[root@linuxtips ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won’t be recoverable.
The number of cylinders for this disk is set to 38913.
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)
Warning: invalid flag 0×0000 of partition table 4 will be corrected by w(rite)
Command (m for help): m
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
No partition is defined yet!
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-38913, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-38913, default 38913):
Using default value 38913
Command (m for help): p
Disk /dev/sdc: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 38913 312568641 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
#Format the disk for ext3 using `mkfs`
[root@linuxtips ~]# mkfs -t ext3 /dev/sdc1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
39075840 inodes, 78142160 blocks
3907108 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=79691776
2385 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Leave a Reply
You must be logged in to post a comment.
Not A Member? Register for Free!

