Linux parted invalid token

parted with «free» option, results in invalid token in some cases

when parted with «free» option is run when there is unallocated space at end of the disk (not consumed by partition), I get this error..

[root@sprintlab423vm4 ~]# parted /dev/disk/by-path/pci-0000:03:00.0-scsi-0:0:1:0 unit MB print free Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the old backup)? parted: invalid token: free Fix/Ignore/Cancel? Ignore Warning: Not all of the space available to /dev/sdb appears to be used, you can fix the GPT to use all of the space (an extra 20971520 blocks) or continue with the current setting? Fix/Ignore? Ignore Model: VMware Virtual disk (scsi) Disk /dev/sdb: 783832MB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1.05MB 773093MB 773092MB primary [root@sprintlab423vm4 ~]# rpm -qa | grep parted parted-2.1-25.el6.x86_64 

Same command works in other cases where I suspect the disk is completely allocated via partitions..(dont see the warning)

[root@blrvse12vm04 ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.7 (Santiago) [root@blrvse12vm04 ~]# parted /dev/disk/by-path/pci-0000:03:00.0-scsi-0:0:0:0 unit MB print free Model: VMware Virtual disk (scsi) Disk /dev/sda: 102005MB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 0.03MB 1.05MB 1.02MB Free Space 1 1.05MB 158MB 157MB primary ext4 boot 2 158MB 91268MB 91110MB primary lvm 91268MB 102005MB 10737MB Free Space [root@blrvse12vm04 ~]# rpm -qa | grep parted parted-2.1-29.el6.x86_64 

Источник

Читайте также:  Linux mint вай фай

It is a bug in the documentation.

When using the command line you cannot leave the «Partition name» portion blank.

Also, the «parted: invalid token: mkpart» is because of the

Warning: The existing disk label on /dev/xvdf will be destroyed and all data on this disk will be lost. Do you want to continue?

Yes/No?

Since mkpart is not Yes or No you get the invalid token error message.

Fix: Use the -s or —script option.

sudo parted -s /dev/xvdf mklabel gpt mkpart MyPartName 'ext2' '0%' '100%' print all 

Invalid Token LKPM Online

Unix & Linux: Error

Unix & Linux: parted: invalid token

Unix & Linux: parted: invalid token: swap (2 Solutions!!)

Invalid tokken Issue Solved

antonio

antonio

I use Emacs and R for financial research Consider to post or follow the virtualization proposal.

Updated on September 18, 2022

Comments

antonio

# parted /dev/sda mklabel gpt mkpart P1 ext3 1MiB 8MiB 

[. ] In interactive mode, commands are entered one at a time at a prompt, and modify the disk immediately.

When I run the former line it seems instead that parted goes interactive waiting for user input and raises the error:

parted: invalid token: mkpart 

Am I missing something or is there a bug in the documentation? PS: The error does not show with -s switch.

Источник

Error «parted: invalid token: 1» When Using Parted To Format A Partition?

ss of term

Screenshot: http://imgur.com/DQnhwG2 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:

«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:

  • 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
Читайте также:  Второй экран линукс минт

@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.

If you don’t pre-enter the details you can successfully complete it with prompts. Of course this isn’t «-s» flag friendly.

3 Answers 3

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.

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.

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

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 .

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. 

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».

Читайте также:  Linux generic linux headers generic linux image generic

Steps:

[«/dev/sdb» being the drive you want.]

When prompted to proceed choose «yes».

When prompted for partition enter number eg «1»

When prompted for filesystem enter choice eg «fat32»

[«/dev/sdb» being the drive you want.]

When prompted to proceed choose «yes».

When prompted for partition enter number eg «1»

When prompted for filesystem enter choice eg «fat32»

Источник

Оцените статью
Adblock
detector