[Sussex] Label and partition external hard drive

Steven Dobson steve at dobbo.org
Tue Feb 22 19:22:35 UTC 2011


Hi Fay

On 22/02/11 18:52, 'Fay Zee' wrote:
> Thanks for replying Steve.

Not a problem.  It's nice to have something techie on the list for a change.

> On 22 February 2011 17:47, Steven Dobson  wrote:
>> I use XFS (which was first developed by SGI, although there are
> other
>> filesystems like ext2/3/4, JFS and others) for which the command
> is:
>> # mkfs -t xfs -L  
> 
> Having never used multiple-partitioned external disks, is it one
> label for the disk or one per partition?

One per partition.

> One partition is to share between Windows XP and Debian.
> Do I assume this Windows partition will have to be the first on the
> disk?

I don't think it is a requirement.  It certainly for Debian GNU/Linux
[well I have going to see RMS next month :-)], but as for Windows XP I
don't know.

Play safe, put it first.

> Should I go for ntfs or vfat?

NTFS is relatively new in Linux.  I'm not absolutely sure if NTFS writes
are out of testing.  But as this is for backup play it safe.  Use the
most common FS so you can read on something:  VFAT.

> $ man mkfs only mentions vfat, but googling came up with mkntfs.
> $ man mkntfs shows there is a -n option which looks like a practice
> step :-)
> So assuming I've already created the partitions:
> It's either: # mkfs -t vfat -L "eSATA-DS160" "/dev/sdf1"
> Or: # mkntfs -L "eSATA-DS160" "/dev/sdf1"

I don't use XP so I have no need for NTFS support so I haven't installed
the FS tools for it.  But those commands look like I would expect them
to, so they are probably good.

> The other two partitions are for Linux. I will probably go for ext3.
> Is it: # mkfs -t ext3 -L "eSATA-DS160" "/dev/sdf2"

Not the thing to do.  Your giving your partitions the same labels.

With removeable media the Gnome auto-mounter (I don't know KDE) will
mount all partitions it finds when you plug in the disk automatically.
If first try to mount the device on "/media/<label>", but if it can't
find a label (and I assume but don't know) a name clash will resort to
using the devices universally unique identifier (UUID).  So use
different labels, to really should.

I have three identical black SpanDisk 1G USB flash disks.  In order to
distinguish them put three different coloured electrical tape around
each and then labeled them RED, GREEN and BLUE.  They appear on my
desktop as these names.  Makes life very easy.

>> The echo command doesn't look right to me.  The quotes will be
>> interrited by the command shell.  What you are trying to do is
>> add the line:
>>     ndrive x: file="/dev/sdf1"
>> to the end of the file.  You need to use the command:
>>         # echo -e "ndrive x: file="/dev/sdf1"" >>
> /etc/mtools.conf
>> The backslashes are important.
> 
> Actually the backslashes must have been removed by your mail client
> in reply mode.
> They are present in my original post:

Yes, they do appear to be stripped.

> # echo -e "ndrive x: file="/dev/sdf1"" >> /etc/mtools.conf
> 
>>> # mlabel ????????
>>> I want to know how to view the label first.
>> Having just tried it mlabel displays any label if there is one
> before
>> asking you want you want the new label to be.
>>         # mlabel r:
>>          Volume label is RedDisk (abbr=REDDIS~1àÀ¶)
>>         Enter the new volume label : RedFlash
>>         #
> 
> I ran into a problem here. # 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
> 
>> However the screen partitioning tool "cfdisk" will display the
> partition
>> table and any labels it finds there in:
>>
>>         # cfdisk -P s /dev/sdc
>>
>>                        cfdisk (util-linux-ng
> 2.17.2)
>>
>>                               Disk
> Drive: /dev/sdc
>>                         Size: 1000275456
> bytes, 1000 MB
>>                Heads: 64   Sectors per Track: 32  
> Cylinders: 953
>>
>>     Name  Flags Part Type  FS Type  [Label]        Size
> (MB)
>>    ------------------------------------------------------------
>>     sdc4  Boot  Primary    FAT16    [REDFLASH]    
> 999.30
>>
>>
>>    [ Bootable ]  [  Delete  ]  [   Help   ]  [ Maximize
> ]  [  Print   ]
>>    [   Quit   ]  [   Type   ]  [  Units   ]  [ 
> Write   ]
>>
>>                   Quit program without writing
> partition table
>>
>>         
> 
> (Thanks for including the last hint about quitting at that point.)
> 
> $ man cfdisk gives me plenty of info about geometry and zeroing the
> first 512 bytes but it looks like there will be more to it since I
> need Windows to access one of the partitions.
> And without exact example commands I wouldn't have the confidence to
> run anything.
> 
> The last time I attempted to label a disk was with the single hard
> drive in my favourite PC of the time. I used a graphical tool, either
> in Ubuntu or puupy live and the drive ended up corrupted. It was only
> 10 or 20GB and I had deliberately backed up my entire home directory
> onto an external drive beforehand :-) so no harm done other than
> needing to get a replacement disk.

These things can happen.

>> Then you can use "mkfs" to lay a filesystem down.
> 
> Yes, label and partition in one step, then format and build the fs in
> the next step.
> 
> I think I've still got a way to go yet though.

I remember I was a little nervous the first time I played around with
the partition tables.  But it isn't really that difficult.

> But I'll document when I'm done. 

Well if you need any more advice I'll do my best.

Have fun
Steve
-- 
Steve "Dobbo" Dobson



More information about the Sussex mailing list