|Shopping Cart Download Website|
|You are here: MP3 Player Detailed Info Disk Format, Linux|
Hard Drive Setup Using Linux (Command Line)
Check Device Name For The Disk DriveMost of these steps will require root access, so become root with su if you are logged in with normal access:
The most important step is to correctly identify the device name of the drive you will be using with the mp3 player. You wouldn't want to accidentally erase your PC's normal drive! This table shows the normal device names, but yours may differ if your PC has more than two IDE controllers.
If you've recently booted your PC (presumably you had to reboot to physically install the drive you're preparing for use with the mp3 player), you can use the dmesg command to view the startup messages that the Linux kernel prints and scroll off the screen before you can read them. Here's an example using grep to show only the relevant lines.
In this example, the PC's normal drive is an 80 gigabyte Maxtor drive, and the drive that will receive the MP3 files is a 10 gigabyte IBM laptop drive. So we'll be careful to type "hdc" to refer to the 10 gigabyte laptop drive. The exact messages you see will depend on the IDE devices installed in your PC, but knowing the capacity of each drive you should be able to double check the device name and avoid reformatting your PC's main drive.
Partition The Drive With "fdisk"The first step is to run the fdisk program, with the name of the device (in this example "/dev/hdc").
The fdisk program is interactive and it will prompt you for commands, which are single letters. You can use 'm' to get a list of the commands, and 'p' will show you the current partition table. The fdisk program never actually writes until you use the 'w' command, so can always just quit and nothing on the drive will change.
The warning about more than 1024 cylinders can be safely ignored. The MP3 player never uses cylinder numbers (all access is LBA-based). Only very old LILO bootloaders, old PC bios chips, Microsoft DOS and older versions of Windows have trouble beyond 1024 cylinders.
In this example, the drive was brand new and did not have any partition table from previously installed data. If it did, you would need to use the "d" command to delete each of the existing partitions, and perhaps use the "p" command to print a summary of the partition table to make sure it is blank.
Starting with a blank partition table, you need to create a single partition that uses the entire drive:
This linux-based fdisk program will create partitions that default to the correct type for the linux filesystems. You will need to change the type to "C", which is the FAT32 type (using LBA access mode):
As a quick check, the partition table should look approximately like this with the 'p' command:
When you're satisfied, use 'w' to write the partition table. This is the point of no return if the drive previously had other data on it. Once the new partition table is written, the drive is effectively a new blank drive ready to be formatted.
In most cases, you will not need to reboot (unlike all Microsoft operating systems, which require rebooting to re-read the partition tables). However, if the fdisk program can not verify that the kernel has updated its knowledge of the drive's partition, it will advise you to reboot. No reboot was needed in this example.
Create FAT32 Filesystem With "mkdosfs"Now that your drive is properly partitioned, you need to create a FAT32 filesystem using the mkdosfs program. Unlike the Microsoft format utility, you can control a great number of parameters, and of these you must choose the "-s" (sectors per cluster) setting. This table shows the four settings that will work properly with the mp3 player firmware:
As long as your filesystem is not too small, it really doesn't matter much which one you choose.
When you run the mkdosfs program, you must also specify "-F 32" to create a FAT32 filesystem. The device name must specify the partition (/dev/hdc refers to the whole drive, and /dev/hdc1 refers to the first partition on the drive). Here is what you should see:
The program runs very quickly... so quickly it might appear that nothing happened, but it follows the "no news is good news" style of most unix command line utilities. If there is no error message, it almost certainly worked.
Mount The New FilesystemNow you must mount the new filesystem so that you can access it. For this example, a new directory was created to mount the drive:
Then to actually mount it, the normal linux mount command it used:
Once the disk is mounted, it can be accessed just like any other part of the system. The df (disk free) program is a nice quick check that the mount command worked and that the filesystem size is what was expected.
Copy MP3 FilesNow the only step remaining is to copy files onto the drive. In this example, I inserted a cdrom (and let RedHat 7.2's automatic cdrom mount take care of mounting it). If you use the command line:
Modern linux-based systems come with Gnome and/or KDE, and perhaps you will prefer their file managers (nautilus and konqueror) to copy and organize your files into the /tmp/mp3disk directory.
Of course, you will need to shut down and remove the drive and then attach it to the mp3 player circuit board. The shutdown process in Redhat and most other distributions will take care of properly unmounting the drive, or you could type "umount /mnt/mp3disk" if you really want to do it yourself.