[Sussex] Label and partition external hard drive

Steven Dobson steve at dobbo.org
Tue Feb 22 21:37:03 UTC 2011


Hi Fay

On 22/02/11 20:32, 'Fay Zee' wrote:
> I ran into a problem with mlabel.
> # cat /etc/mtools.conf shows the final line as: drive x:
> file="/dev/sdf1" but:
> # mlabel x:
> Result:
> Initial byte of fat is not 0xff
> Cannot initialize 'X:'
> mlabel: Cannot initialize drive

Are us sure that that is a valid DOS FS on that disk?

I don't know much about DOS (vfat/fat16/fat32) and how they work with
the MBR.  I only use VFAT were I am working with mobile devices (read
USB flash disk, my camera and my phone).  Where possible I format on the
mobile device as it is more likely to have a more limited VFAT
implementation.

> # cfdisk -P s /dev/sdf
> This will print the partition table to the screen in sector order
> format.
> Result:
> 
> Partition Table for /dev/sdf
> 
>                First       Last
>  # Type       Sector      Sector   Offset   
> Length   Filesystem Type (ID) Flag
> -- ------- ----------- ----------- ------ -----------
> -------------------- ----
>    Pri/Log           0        2047*    
> 0#       2048*Free Space           None
>  1 Primary        2048*  312496127*     0  
> 312494080*HPFS/NTFS (07)       None
>    Pri/Log   312496128*  312496379      0        
> 252*Free Space           None
> 
> But how do I get my disk partitioned into three partitions of 50GB
> each, with geometry that will get recognised by XP?

Run cfdisk with out options:

    # cfdisk /dev/sdf

Use the up & down arrows to select a partition, and the left right
options to selected an option and RETURN to execute it.

You need to:

0). Make sure that the disk is not mounted before running "cfdisk".

1). Delete file-system partition entries until there is only one "Free
Space" partition remaining.

2). Look at the header information and find where it gives the number of
cylinders the disk has.  It is best to align partitions/file-systems on
cylinder boundaries.  Integer divide this number by three and that is
the number of cylinders each partition should have.

3). Create a "New" partitions.  As you only want three partition you can
make it "Primary" ones (the max number of primary partitions on a disk
is four).  When prompted for a size enter the cylinder count you worked
out in (2) and enter it followed by a "c".  There may also be a prompt
for placement, I always go for beginning.

4). Move the partition selector to the "Free Space" again.

5). Create a second "New" partition just like you did in (3).

6). Move the partition selector to the "Free Space" for the final parititon.

6). Create the final "New" partition. This time you can accept whatever
size if offers as this will use the remainder of the disk.  The
partitions may not be of equal size.

7). Now selected each partition in turn and set it's "Type".  For the
NFTS partition it looks like the code is "07", for the Linux Ext3
partitions the code is "83".

8). Select the "Write" option to write this changes to the disk.  Until
now you have only been defining what you want.  "Quit" will get you
safely out without touching the disk.  Once you've written the new
partition table - there are warnings with "Write" - there is no going
back; you're committed.

9). Quit cfdisk

10). Do an "ls -l /dev/sdf*" and you should see your three new partitions.

11). Run the appropriate format and labeling commands to lay down the
filesystems and prepare them for use.

12). Remove the USB cable for the disk, wait a moment and then plug it
back in.  All three partition should be auto mounted.

Steve
-- 
Steve "Dobbo" Dobson



More information about the Sussex mailing list