I bought a Seagate External Portable Drive a few days back as I have a lot of movie and music files now that require hundreds of gigabytes of disk space. When I connected it to my laptop running Debian GNU/Linux, I found that Debian was unable to mount it automatically as the file system was NTFS. I wanted to convert it to FAT32 so that I could use it across various operating systems without any hassles. I thought that I would do it next day at office where I had a laptop running Windows XP. But next day, at office, I found that Windows XP wouldn't give me an option to format the 320 GB portable drive as FAT32. The only option that appeared was NTFS. On searching the web, it seemed that I needed to use some third party tool to format a volume greater than 32 GB using the FAT32 file system on Windows. There are plenty of them available on the web. However, I decided to avoid the hassle of finding an appropriate tool (I was later told by a friend that 'fat32format' is a good tool for Windows). So, I decided to do the formatting using Linux. I am documenting the commands I had to run to do it in this blog post.
I ran the fdisk
command to list the partition table and
selected the relevant lines by piping the output through
grep
.
nifty:/home/susam# fdisk -l | grep ^Disk Disk /dev/sda: 160.0 GB, 160041885696 bytes Disk identifier: 0x0002ade8 Disk /dev/sdb: 320.1 GB, 320072933376 bytes Disk identifier: 0x00225e47 nifty:/home/susam# fdisk -l | grep ^/dev/sdb /dev/sdb1 1 38913 312568641 7 HPFS/NTFS
So, the output showed that /dev/sdb represents the 320 GB portable
drive, /dev/sdb1 represents the file system on it and the file system is
NTFS. So, I changed the file system to FAT32 using the
fdisk
command again.
nifty:/home/susam# fdisk /dev/sdb 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) Command (m for help): t Selected partition 1 Hex code (type L to list codes): b Changed system type of partition 1 to b (W95 FAT32) Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. Syncing disks.
Note that this time fdisk
was invoked with the device file
representing the portable drive as an argument. The t
command at the fdisk prompt is used to change a partition's system ID.
The system ID was entered as b
which is the code for FAT32
file system. The w
command is used to write the partition
table to disk and exit.
Next, the disk was formatted with the FAT32 file system.
nifty:/home/susam# mkdosfs -v -F 32 -n Susam320GB /dev/sdb1 mkdosfs 3.0.5 (27 Jul 2009) /dev/sdb1 has 255 heads and 63 sectors per track, logical sector size is 512, using 0xf8 media descriptor, with 625137282 sectors; file system has 2 32-bit FATs and 32 sectors per cluster. FAT size is 152547 sectors, and provides 19526004 clusters. Volume ID is aa58f967, volume label Susam320GB.
The string following the -n
option is the volume label for
the volume. The volume label can of course be changed later using the
mlabel
command. This command comes with the 'mtools'
package. The command can be used as shown below.
nifty:/home/susam# mlabel -i /dev/sdb1 -s :: Volume label is Susam320GB nifty:/home/susam# mlabel -i /dev/sdb1 ::FooThe first command prints the existing volume label. The second one, changes the volume label to 'Foo'.
No comments