2

Screenshot: http://imgur.com/DQnhwG2

  ss of term

I'm trying to format an existing ext2 partition as ntfs (or any filesystem) using the mkfs command in Parted, but when I specify the partition to format I get:

parted: invalid token: 1

"1" being the partition number I specified. I'm not sure what's wrong. The goal here is to find the correct command. I'm not interested in work-arounds using a different program. I'm just doing this to learn the ins/outs of Parted. I've already read the manuals, and a ton of blog posts. The command I used was:

$ mkfs 1 ntfs

Details:

  • Ubuntu 12.04 - Desktop X86-64
  • Parted 2.3
  • There is no valuable data on the machine. It's just a vm running Ubuntu with 2 virtual hard drives attached. Sda: Ubuntu Sdb: The drive for testing Parted
3
  • Oops. Didn't realize you were using parted. My answer will work in the shell, is that OK? Commented Apr 13, 2014 at 22:13
  • @PlasmaPower I appreciate the answer, but the goal here is to use Parted. I don't actually need to format anything. I'm just trying to learn how to use Parted. Commented Apr 13, 2014 at 22:41
  • If you don't pre-enter the details you can successfully complete it with prompts. Of course this isn't "-s" flag friendly. Commented Apr 14, 2014 at 0:44

3 Answers 3

2

The error message is because it is asking a yes/no question, and "1" is not yes or no. Don't use parted's mkfs command: it is incomplete ( doesn't even support ntfs ), broken, and was removed from parted upstream several releases/years ago beacuse of this. Use mkntfs instead.

1
  • I edited to add the commands. While adding "yes" goes against the documentation, and isn't required for other commands for some reason it fixes it for mkfs. Weird. Thanks for you help. Commented Apr 14, 2014 at 23:53
1

I don't know about Parted, but try something like this in the shell:

$ mkfs -t ntfs /dev/sdXX

Do not use /dev/sdXX . First find the partition. df -H lists currently mounted ones and their size. The partition should look something like /dev/sda1 or /dev/hda1.

From the man page:

mkfs [options] [-t type] [fs-options] device [size]
...
The device argument is either the device name (e.g.  /dev/hda1, /dev/sdb2), 
or a regular file that shall contain the filesystem.
...
-t, --type type
       Specify  the  type  of  filesystem  to be built.  If not specified, 
       the default filesystem type (currently ext2) is used.
1

While the documentation in various sources states that "mkfs 1 fat32" is the correct command, and I've even found screenshots of people successfully using it, it doesn't work in real life. However, as mentioned in my comments if you don't specify the information ahead of time Parted will prompt you to input it later, and that will work. This of course means you cannot use the "mkfs" command in combination with the "-s" flag for automation purposes which sucks, but it gets the job done. Hopefully a better answer can be found. Note that NTFS is apparently not supported, which is why I've changed the examples to "fat32".

Steps:

Option 1:

Step #1

In terminal type:

sudo parted /dev/sdb

["/dev/sdb" being the drive you want.]

Step #2

In (Parted) terminal type:

mkfs

Step #3 =

When prompted to proceed choose "yes".

When prompted for partition enter number eg "1"

When prompted for filesystem enter choice eg "fat32"

Option 2:

Step #1

In terminal type:

sudo parted /dev/sdb mkfs

["/dev/sdb" being the drive you want.]

Step #2

When prompted to proceed choose "yes".

When prompted for partition enter number eg "1"

When prompted for filesystem enter choice eg "fat32"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .