LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Format a partition fat32 (https://www.linuxquestions.org/questions/linux-newbie-8/format-a-partition-fat32-480144/)

royeo 09-03-2006 09:01 PM

Format a partition fat32
 
I've been trying to find a way to format a partition fat32 with no luck. I've put out the word on 3 forums and nothing works. mkdosfs is in my /sbin but it doesn't work. I bought Partition Magic just so I could format it fat32. It works at first but over time I lost files and it finally came to Linux not being able to write to that partition. So I decided to format in Linux and try that. I've tried mkdos ... /dev/sda2 and I get the message "command not found". I've tried /sbin/mkdosfs ... /dev/sda2 and I get the message "permission denied". I'm trying to format an existing partition made in Windows. Maybe that's the problem. I don't know how to make a partition in Linux. Can anybody tell me how to make partition in Linux? Do you need to start with unallocated space?

I've heard of a program called "qparted" that will supposedly do the job in a GUI environment but I don't how to get it. It's not on my system and when I do a "yum -y install qparted" it can't find it with my current configuration. If anybody can think of something I'd sure appreciate it.

Thanks,

royeo

zhangmaike 09-03-2006 09:19 PM

Quote:

I've tried /sbin/mkdosfs ... /dev/sda2 and I get the message "permission denied"
Permission denied means exactly what it says. Your normal user doesn't (and shouldn't) have permission to do this, hence the error. /sbin isn't included in the path of a normal user because a normal user shouldn't run those commands.

Become root, then (as root):
Code:

/sbin/mkdosfs /dev/sda2
Quote:

I'm trying to format an existing partition made in Windows. Maybe that's the problem. I don't know how to make a partition in Linux. Can anybody tell me how to make partition in Linux? Do you need to start with unallocated space?
A partion is a partition, it does not matter in which OS the partition was created.

Brian1 09-03-2006 09:21 PM

You can use the mkfs command. /sbin/mkfs -t vfat /dev/sda2
Note it must NOT be mounted yet. Also it might be a good idea to use /sbin/fdisk to blow the partition then create a new one. Also don't forget to set the type of partition before exiting fdisk. One more thing you must be root to use either command.

To learn a little more on mkfs and fdisk use man command.
man fdisk
man mkfs

Brian1

sn68 09-03-2006 09:30 PM

Re : Format a FAT32 Parttion
 
Please check the way your FAT32 parttion is mounted, if it is moounted read only for all users including root, then logging in as root may not help.
First edit the /etc/fstab to mount the partition with rw permissions and then try and format it.
As regards Gparted, download the the relevant rpm file from the website (google gparted) and do "yum -y localinstall gparted", though even with gparted the you will have to mount the partiion with write permissions

Insert following in fstab instead of what is there for that particular partiton, substituting for hda1 & win_c as in your case.

/dev/hda1 /mnt/win_c vfat rw,defaults,umask=0222 0 0

zhangmaike 09-03-2006 09:35 PM

Quote:

Originally Posted by sandeepnatu
Please check the way your FAT32 parttion is mounted, if it is moounted read only for all users including root, then logging in as root may not help.
First edit the /etc/fstab to mount the partition with rw permissions and then try and format it.
As regards Gparted, download the the relevant rpm file from the website and do "yum -y localinstall gparted", though even with gparted the you will have to mount the partiion with write permissions

Insert following in fstab instead of what is there for that particular partiton, substituting for hda1 & win_c as in your case.

/dev/hda1 /mnt/win_c vfat rw,defaults,umask=0222 0 0

You SHOULD NOT run mkfs on a mounted partition. Formatting (creating a new filesystem with mkfs) does not involve mounting in any way. It is performed on the raw, unmounted partition device.

You do not need to mount a partion to edit the partition table (which is what qparted/gparted/fdisk does), nor do you need to edit the partition table to create a filesystem, unless the partition you intend to run mkfs on does not yet exist (according to your first post, it does).

sn68 09-03-2006 10:13 PM

Fat32 partition
 
zhangmaike

thanks for correcting, my mistake, I was not aware of this
regards

royeo 09-04-2006 12:08 PM

Re: How do you format a partition fat32 (vfat)
 
Quote:

Originally Posted by sandeepnatu
Please check the way your FAT32 parttion is mounted, if it is moounted read only for all users including root, then logging in as root may not help.
First edit the /etc/fstab to mount the partition with rw permissions and then try and format it.
As regards Gparted, download the the relevant rpm file from the website (google gparted) and do "yum -y localinstall gparted", though even with gparted the you will have to mount the partiion with write permissions

Insert following in fstab instead of what is there for that particular partiton, substituting for hda1 & win_c as in your case.

/dev/hda1 /mnt/win_c vfat rw,defaults,umask=0222 0 0


Thank you. I was spelling gparted wrong. I had never heard of it till someone mentioned it and they spelled it with a "q". It might already be installed. Yum doesn't work too well on misspelled files.


I've already used gparted. GUIs are so nice. I can read and write to the partition in Windows.

Roy O'Neill

sn68 09-04-2006 12:49 PM

Re: Format FAT32 partition
 
royeo
nice to know that some good has come out of that post
Regards


All times are GMT -5. The time now is 07:28 PM.