LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-19-2010, 09:12 AM   #1
boki15
LQ Newbie
 
Registered: Jul 2010
Posts: 11

Rep: Reputation: 0
Question Formating FAT32, but linux created FAT32 is not like win created FAT32?? Difference?


Hello,

I have one Problem and can't even understand it.

When I format my SD Card in win with fat32 (I do it with bootice), everything works but when I format with linux (I tried mkfs.vfat, mkfs.msdos, gparted, fdisk) nothing works.

I created a shell script which creates multiboot usb with one NT6 system some Live ISO's and I added posibillity to chainload with grub2 in mbr all other popular bootloaders like syslinux, grub4dos, nt5 (ntldr),...

Problem: If I format my SD card in win and run then my script, everything works great. But as soon as I format it in linux nothing works. I can't boot win7 (pc restarts), for syslinux I get "boot error" and for grub "no grldr". I really don't understand what the difference is or how to format. I tried some other commands (with offset, -o) but nothing works, I getting already mad it's like somebody is telling me that 1+1 is not 2!

Actually everything works, but I just can't belive that I really need commercial OS like Win to format my SD card if there are so many great linux distros.

If nobody knows how to format right, just explain the difference beetween windows created FAT32 (0x0b) and gparted, fdsik,... created FAT32 (0x0b)?

BTW: I tried it from ubuntu lucid, maverick installed and also iso's, same results
 
Old 07-19-2010, 09:21 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
You might find this other thread of interest: http://www.linuxquestions.org/questi...tition-386916/

Hopefully that addresses the issue; if not, let us know.
 
Old 07-19-2010, 09:22 AM   #3
boki15
LQ Newbie
 
Registered: Jul 2010
Posts: 11

Original Poster
Rep: Reputation: 0
thanks, I'll take a look now
 
Old 07-19-2010, 09:39 AM   #4
boki15
LQ Newbie
 
Registered: Jul 2010
Posts: 11

Original Poster
Rep: Reputation: 0
@GrapefruiTgirl

as long as I understood the link, there was an LBA problem. The solution was to format it with 0x0C instead of 0x0B. As long as I understand LBA, with 8gb SD Card there is no sense to format with 0x0C (win formats it also with 0x0B and everything works). And I don't have problem that win/linux/macos/dos/... (I tried them all) can't read the partition (no matter if formated in win, linux, macos). My problem is more that in both OS I create FAT32 (0x0B) without errors and everything works fine. The only difference is the behavior during boot process, which is incorrect if I format it from linux, in my case ubuntu lucid.

I thought also that it could be BIOS thing, but it can't be bios problem because I tested it on different mainboards and notebooks).

Last edited by boki15; 07-19-2010 at 09:41 AM. Reason: spelling mistake
 
Old 07-19-2010, 09:44 AM   #5
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Hmm.. OK, I don't have a further suggestion at this time - hopefully someone else can shed some insight.

Best of luck - hopefully it's something simple!
 
Old 07-19-2010, 09:58 AM   #6
boki15
LQ Newbie
 
Registered: Jul 2010
Posts: 11

Original Poster
Rep: Reputation: 0
Anyway, thanks for a help.

Here are some things that I tried, maybe it helps someone to help me

format with linux:
1. Format fat32
Code:
sudo mkfs.vfat -n ${VOLUME} ${DEVICE}1
or
Code:
sudo mkfs.msdos -n ${VOLUME} ${DEVICE}1
or
gparted/fdisk
2. install syslinux
Code:
sudo ./syslinux/linux/syslinux ${DEVICE}1
3. install grub2
Code:
sudo grub-install --no-floppy --root-directory=/media/${VOLUME} ${DEVICE}
4. create all menus with "cat <<EOF>"

format with Win:
1. Format fat32
2. Start Linux/Linux LiveCD
3. install syslinux
Code:
sudo ./syslinux/linux/syslinux ${DEVICE}1
4. install grub2
Code:
sudo grub-install --no-floppy --root-directory=/media/${VOLUME} ${DEVICE}
5. create all menus with "cat <<EOF>"


checking all if formated with win:
Backup mbr, destroy mbr, restore mbr - all OK
Backup pbr, destroy pbr, restore pbr - all OK
Backup mbr & pbr, create new ms-dos fs ie w. gparted, create new partition (smaller) in windows, restore mbr & pbr - all OK
Backup mbr & pbr, create new ms-dos fs ie w. gparted, create new partition (smaller) in linux, restore mbr & pbr - NOT WORKING

checking all if formated with linux:
Backup mbr, destroy mbr, restore mbr - no difference only grub2 works - NOT WORKING
Backup pbr, destroy pbr, restore pbr - no difference only grub2 works - NOT WORKING
Backup mbr & pbr, create new ms-dos fs ie w. gparted, create new partition (smaller) in windows, restore mbr & pbr - all OK
Backup mbr & pbr, create new ms-dos fs ie w. gparted, create new partition (smaller) in linux, restore mbr & pbr - NOT WORKING

Last edited by boki15; 07-19-2010 at 12:58 PM.
 
Old 07-19-2010, 10:32 AM   #7
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,851
Blog Entries: 14

Rep: Reputation: 284Reputation: 284Reputation: 284
Maybe of interest, from "man mkfs.vfat":

Quote:
Bugs
mkdosfs can not create bootable filesystems. This isn't as easy as you might think at first glance for various reasons and has been discussed a lot already. mkdosfs simply will not support it
 
Old 07-19-2010, 10:32 AM   #8
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
No, you misunderstand:

It not "format with 0x0C instead of 0x0B", it is partition as ...

When you partition a disk, there is a byte to the partition table that describes the filesystem type. This is the Id of the partition that you see listed with fdsik -l

FAT16 is type 5
FAT16 LBA is type e
FAT32 is type b
FAT32 LBA is type c
Linux is type 83

Etc.

Linux does not care if the filesystem (as generated by format (mkfs...)) is different from the partition table descriptor byte (as written by fdisk).

Windows does care.

So, check your partition table on the removable device. You probably need to change it to type b, by using fdisk and then reformat the partition to FAT32.
 
Old 07-19-2010, 10:33 AM   #9
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
LOL -- thanks *harmless, apparently the answer right under our noses, in the man pages :/ though I still am optimistic for *something* good..
 
Old 07-19-2010, 10:45 AM   #10
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
In the light of the above, don't forget to mark the partition as "bootable" ( by using fdisk not mkfs... [this is not mkfs's job, it is the job of fdisk to mark partitions as "bootable"] )
 
Old 07-19-2010, 10:54 AM   #11
boki15
LQ Newbie
 
Registered: Jul 2010
Posts: 11

Original Poster
Rep: Reputation: 0
Partition is marked as bootable and it has never changed from 0x0b. Actually grub2 should work on all, syslinux not, the only one compatible to all bootloaders I use is fat32, it's slow but it has advantage that all OS can read/write it, including macos which I also boot.

I tried msdos just to see if there is a difference in booting, grub2 can boot from msdos, syslinux too.

mkfs.vfat:
Code:
Platte /dev/sdf: 8166 MByte, 8166309888 Byte
255 Köpfe, 63 Sektoren/Spur, 992 Zylinder
Einheiten = Zylinder von 16065 × 512 = 8225280 Bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004c935

   Gerät  boot.     Anfang        Ende     Blöcke   Id  System
/dev/sdf1               1         992     7968208+   b  W95 FAT32
Screenshot

Last edited by boki15; 07-19-2010 at 11:09 AM. Reason: add image to attachment
 
Old 07-19-2010, 11:19 AM   #12
boki15
LQ Newbie
 
Registered: Jul 2010
Posts: 11

Original Poster
Rep: Reputation: 0
Maybe it will help if you look at menus:

Grub2 is in MBR and Syslinux 3.86 in PBR and if it's formated from win, then these entries work:
Grub2 Menu:
Code:
menuentry "00. BOOTMGR (NT6) via PBR file" {
insmod fat
set root=(hd0)
chainloader (hd0,1)/bootmgr.pbr +1
boot
}
menuentry "01. Grub via PBR (second stage bootloader)" {
 insmod fat
 set root=(hd0)
 chainloader (hd0,1)/grldr.pbr +1
}
menuentry "02. Grub4Dos" {
 linux16 /boot/grub4dos/grub.exe
}
menuentry "03. Syslinux via chainloading" {
 insmod fat
 set root="(hd0,1)"
 chainloader +1
}
menuentry "03. Syslinux via PBR file" {
 insmod fat
 set root="(hd0)"
 chainloader (hd0,1)/syslinux.pbr +1
}
menuentry "04. NTLDR (NT5) via PBR file" {
 insmod fat
 set root="(hd0)"
 chainloader (hd0,1)/ntldr.pbr +1
}
syslinux menus
Code:
label back
menu  label grub2
TEXT HELP
 This entry will bring you to the Grub2 menu.
ENDTEXT
kernel /boot/syslinux/chain.c32
append hd0 0

label nt6
menu  label 01. NT6 chainload
TEXT HELP
 NT6 - bootmgr
ENDTEXT
com32 /boot/syslinux/chain.c32
append ntldr=/bootmgr
If I format in Linux, these entries just don't work. I tried restoring pbr's and mbr's, but it's always the same. Win formated partiotion - OK, linux - NOT WORKING

If you want to try, here are my pbr's.

Last edited by boki15; 07-19-2010 at 11:30 AM. Reason: adde pbr link
 
Old 07-19-2010, 11:41 AM   #13
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Thank you. Two things to think about:
1] There is no boot marker:
Code:
Platte /dev/sdf: 8166 MByte, 8166309888 Byte
255 Köpfe, 63 Sektoren/Spur, 992 Zylinder
Einheiten = Zylinder von 16065 × 512 = 8225280 Bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004c935

   Gerät  boot.     Anfang        Ende     Blöcke   Id  System
/dev/sdf1   *           1         992     7968208+   b  W95 FAT32
2] Maybe format the card from windows, then, before you do anything else, use dd to make a copy of the MBR:

Code:
dd if=/dev/sdf of=WIN-MBR-backup bs=512 count=1
Then format the card from linux, and make another copy of the MBR:

Code:
dd if=/dev/sdf of=Linux-MBR-backup bs=512 count=1
Then use cmp to compare the two files.
Are they the same, if not, what are the differences?

Aside:
Quote:
If you want to try, here are my pbr's.
It won't download (but I'd have to read up on what a pbr is! I never had to mess with them).
 
Old 07-19-2010, 12:02 PM   #14
boki15
LQ Newbie
 
Registered: Jul 2010
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for help,

I did it already yesterday,but I didn't save logs about it (deleted non working). I'll try it now again to post the result.

Yesterday the result was:
Extracted mbr and pbr from Windows formated sd. Reformat in windows, restore mbr/pbr from win or linux. Everything works.

Formated in linux and restored mbr/pbr which was backed up from win formated partition. Same result, not working (exactly: mbr loads always,no matter if in win or linux formated. pbr boots only if formated in win. This is the problem. I even tried to install syslinux from win to pbr of partition which was created with mkfs.vfat/mkfs.msdos/gparted/fdisk, same result, not working.

As you can see in gparted, it's marked as boot. Even if not it should work with makeactive (for grub) and parttool (hd0,1) boot+ (for grub2).

I formated now with with win
sudo fdisk -l /dev/sdb
Code:
Platte /dev/sdb: 8166 MByte, 8166309888 Byte
255 Köpfe, 63 Sektoren/Spur, 992 Zylinder
Einheiten = Zylinder von 16065 × 512 = 8225280 Bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004c935
 
Old 07-19-2010, 12:04 PM   #15
boki15
LQ Newbie
 
Registered: Jul 2010
Posts: 11

Original Poster
Rep: Reputation: 0
PBR - Partition Boot Record (Second Stage Bootloader)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
fdisk created fat32 partition, which type 0b or 0c? onedingo Linux - General 14 09-25-2022 12:55 PM
Can the fat32 fs created by linux recognised by dos? kuertensun Linux - Newbie 4 09-07-2005 11:39 PM
Created new FAT32 partition, after that..GRUB console haunting me..what 2 do??? free_mumia Linux - Newbie 5 01-04-2004 07:02 PM
Created new FAT32 partition and now KDE freezes while loading WM Smile005 Linux - Software 4 11-09-2003 12:23 PM
Can't see files created using RH9 on the FAT32 partition in WinXP jvala Linux - General 1 09-02-2003 10:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration