LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-07-2012, 10:57 AM   #1
littlebigman
Member
 
Registered: Aug 2008
Location: France
Posts: 658

Rep: Reputation: 35
Question [partition] Which ID to use to get "fat16", "fat32", or "vfat"?


Hello

There's a script that expects "parted -s /dev/sdb1 print" to return either "fat16", "fat32", or "vfat".

However, when using "mkfs.vfat -F 32 /dev/sdb1" followed by "fdisk /dev/sdb" to set its ID to "W95 FAT32" (type=b), parted returns "Partition Table: msdos". I also tried type=c, ie. "W95 FAT32 (LBA)", to no avail.

Does someone know which ID I should use so that parted is happy and the script proceeds?

Thank you.
 
Old 03-07-2012, 02:09 PM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
You confuse partition type and filesystem format and partition table type. "fat16", "vfat", "ext4" are filesystems, partition types can be for example FAT12, FAT16, FAT32, Linux swap, etc. And partition tables can be "msdos" (most common), "GPT", "Apple". So specify which you want. Anyway filesystem is visible with this command "parted -s /dev/sdb1 print". You can paste this script here, maybe in there is something wrong.

Last edited by eSelix; 03-07-2012 at 02:14 PM.
 
Old 03-08-2012, 04:56 AM   #3
littlebigman
Member
 
Registered: Aug 2008
Location: France
Posts: 658

Original Poster
Rep: Reputation: 35
Thanks for the info.

Here's the script:
Code:
# 0. Check if partition is a FAT partition
if [ -z "$(LANG=C parted -s $target_disk print | grep -E "^[[:space:]]*${pt_dev_no}\>" |  grep -iE "(fat16|fat32|vfat)")" ]; then
  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
  echo "$target_part: this doesn't look like a valid FAT filesystem"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo "Program terminated!"
  exit 1
fi
How should I partition/format a USB keydrive so that "parted" reads fat32 or vfat?

Thank you.
 
Old 03-08-2012, 05:14 AM   #4
littlebigman
Member
 
Registered: Aug 2008
Location: France
Posts: 658

Original Poster
Rep: Reputation: 35
For some reason, parted shows nothing...
Quote:
root@ubuntu:~# parted /dev/sdb1
GNU Parted 2.3
Using /dev/sdb1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Unknown (unknown)
Disk /dev/sdb1: 1079MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
... while fdisk seems OK:
Quote:
root@ubuntu:~# fdisk -l

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xadd80556

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2432 19535008+ 7 HPFS/NTFS
/dev/sda2 34051 38913 39062047+ 83 Linux

Disk /dev/sdb: 4008 MB, 4008706048 bytes
124 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7688 * 512 = 3936256 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9eb01a01

Device Boot Start End Blocks Id System
/dev/sdb1 1 274 1053225 b W95 FAT32
 
Old 03-08-2012, 05:42 AM   #5
littlebigman
Member
 
Registered: Aug 2008
Location: France
Posts: 658

Original Poster
Rep: Reputation: 35
And here's what cfdisk says:
Code:
root@ubuntu:/tmp# cfdisk -P s /dev/sdb
Partition Table for /dev/sdb

               First       Last
 # Type       Sector      Sector   Offset    Length   Filesystem Type (ID) Flag
-- ------- ----------- ----------- ------ ----------- -------------------- ----
 1 Primary           0     1952751     62     1952752 W95 FAT32 (0B)       Boot
   Pri/Log     1952752     7826383      0     5873632 Free Space           None
So the 1GB partition I made and formated in vfat on the USB keydrive seems OK. I could create a file there successfully.
 
Old 03-08-2012, 03:17 PM   #6
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
You say that "parted /dev/sdb1 print" show nothing. What about "parted /dev/sdb print", maybe it not support showing info about partition, only about whole disk?
 
Old 03-12-2012, 09:24 AM   #7
littlebigman
Member
 
Registered: Aug 2008
Location: France
Posts: 658

Original Poster
Rep: Reputation: 35
Both are working now (/dev/sdb and /dev/sdb1). I have no idea why :-/

Thanks for your help.
 
  


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
unpredictable "delete" "move to trash" or "cut" file menu option dorianrenato Linux - General 3 11-28-2011 06:41 PM
net working eth0 eth1 wlan0 "no connection" "no LAN" "no wi-fi" Cayitano Linux - Newbie 5 12-09-2007 07:11 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:34 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