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 - 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-29-2010, 11:34 AM   #1
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
is the parted command completely worthless?


I'm trying to do some disk partitioning to specific sectors using the parted command (because fdisk hasn't been updated to handle large drives). But this thing doesn't seem to work as documented.
Code:
root@ubuntu:~# parted /dev/sda unit s mklabel gpt mkpart primary 50331648 7812415487
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
parted: invalid token: gpt
Yes/No? ^C                                                                
root@ubuntu:~# parted /dev/sda unit s mkpart primary 50331648 7812415487
Error: partition length of 7762061790 sectors exceeds the msdos-partition-table-imposed maximum of 4294967295
root@ubuntu:~# parted /dev/sda unit s mkpart gpt 50331648 7812415487
parted: invalid token: gpt
Partition type?  primary/extended? primary                                
File system type?  [ext2]?                                                
Start? 50331648                                                           
End? 7812415487                                                           
Error: partition length of 7762061790 sectors exceeds the msdos-partition-table-imposed maximum of 4294967295
root@ubuntu:~#
One of the most lame pieces of software I've seen ... or else its man page (the info doc is just a replica of the man page) is just plain wrong.
 
Old 03-29-2010, 02:14 PM   #2
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by Skaperen View Post
Code:
Error: partition length of 7762061790 sectors exceeds the msdos-partition-table-imposed maximum of 4294967295
You can't make a partition in a PC MBR (master boot record) that is larger than ((2^32) - 1) sectors. The field used to store the partition size is only 32 bits wide. The largest positive number that field can hold is 4294967295.

See this link about partition tables for more information.
 
Old 03-29-2010, 03:30 PM   #3
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
If you will notice, I tried to set the label to be a GPT. Yes, I know of the issue with MSDOS style partition table. The parted command was supposed to be able to do this ... to do GPT ... to solve this issue. It seems to be broken at least in the Ubuntu package. Or at least the man page (go read it) isn't consistent with it.
 
Old 03-29-2010, 04:22 PM   #4
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by Skaperen View Post
If you will notice, I tried to set the label to be a GPT.
Well, this is the latest documentation from the GNU web site:
Code:
    part-type is one of `primary’, ‘extended’ or ‘logical’, and may
    be specified only with ‘msdos’ or ‘dvh’ partition tables. A name
    must be specified for a ‘gpt’ partition table.
At the least, it looks like your desire to make a primary partition is in conflict with your desire to make a GPT label.

Also, if you use parted in interactive mode, you DO NOT want to use the "mkpart" command. You want to use the "mklabel" command.
 
Old 03-29-2010, 04:39 PM   #5
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by David1357 View Post
Also, if you use parted in interactive mode, you DO NOT want to use the "mkpart" command. You want to use the "mklabel" command.
I don't want to use it in interactive mode. That was just a test. I want to do it all on one command line, automated from a script. It just doesn't accept the "gpt" keyword for "mklabel". Maybe all the other errors are because it didn't understand "gpt"?

The only other command line partition program that is supposed to be GPT aware is "gptdisk", and it isn't available for Ubuntu and won't compile on Ubuntu due to a missing header.
 
Old 03-29-2010, 04:42 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Put the subcommands in (double) quotes.
 
Old 03-30-2010, 10:54 AM   #7
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by syg00 View Post
Put the subcommands in (double) quotes.
Syntactically, that seems to work. But it accepts commands both ways, too:
Code:
altair/root /root 368# parted /dev/sda unit s print
Model: ATA ST9250410ASG (scsi)
Disk /dev/sda: 488397168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start      End         Size        Type     File system     Flags
 1      256s       262143s     261888s     primary  ext2            boot
 2      262144s    12582911s   12320768s   primary  reiserfs
 3      12582912s  14680063s   2097152s    primary  linux-swap(v1)
 4      14680064s  488397167s  473717104s  primary  reiserfs

altair/root /root 369# parted /dev/sda 'unit s' print
Model: ATA ST9250410ASG (scsi)
Disk /dev/sda: 488397168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start      End         Size        Type     File system     Flags
 1      256s       262143s     261888s     primary  ext2            boot
 2      262144s    12582911s   12320768s   primary  reiserfs
 3      12582912s  14680063s   2097152s    primary  linux-swap(v1)
 4      14680064s  488397167s  473717104s  primary  reiserfs

altair/root /root 370# parted /dev/sda "unit s" print
Model: ATA ST9250410ASG (scsi)
Disk /dev/sda: 488397168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start      End         Size        Type     File system     Flags
 1      256s       262143s     261888s     primary  ext2            boot
 2      262144s    12582911s   12320768s   primary  reiserfs
 3      12582912s  14680063s   2097152s    primary  linux-swap(v1)
 4      14680064s  488397167s  473717104s  primary  reiserfs

altair/root /root 371#
However, no joy with the mklabel command in all forms:
Code:
altair/root /root 441# parted /dev/sdc unit s mklabel gpt
Warning: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want to continue?
parted: invalid token: gpt
Yes/No? ^C                                                                
altair/root /root 442# parted /dev/sdc 'unit s' 'mklabel gpt'
Warning: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want to continue?
parted: invalid token: gpt
Yes/No? ^C                                                                
altair/root /root 443# parted /dev/sdc "unit s" "mklabel gpt"
Warning: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want to continue?
parted: invalid token: gpt
Yes/No? ^C                                                                
altair/root /root 444#
It seems like this version of parted (both what's on the Live CD, which I am using to try to do it on a 4TB RAID array on a new server, and on my already installed laptop where I am testing doing this to a 4GB USB memory stick) doesn't support GPT.

I finally got the gptdisk package (source only, no ubuntu package found) to compile on my laptop and it seems to work. Now I need to figure out how to get it onto the live CD.
 
Old 03-30-2010, 12:03 PM   #8
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by Skaperen View Post
It seems like this version of parted (both what's on the Live CD, which I am using to try to do it on a 4TB RAID array on a new server, and on my already installed laptop where I am testing doing this to a 4GB USB memory stick) doesn't support GPT.
I have parted version 1.8.9 on an Ubuntu 8.10 installation:
Code:
[user@machine]:parted --version
parted (GNU parted) 1.8.9
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by <http://parted.alioth.debian.org/cgi-bin/trac.cgi/browser/AUTHORS>.
It allowed me to create a GPT partition on a thumb drive. If you really need a LiveCD with the latest parted, you should try System Rescue CD.
 
Old 03-30-2010, 12:33 PM   #9
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Ubuntu has ...
Code:
altair/root /root 447# parted --version
parted (GNU parted) 1.8.8.1.159-1e0e
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by <http://parted.alioth.debian.org/cgi-bin/trac.cgi/browser/AUTHORS>.
altair/root /root 448#
So I guess that's my issue.
 
Old 03-30-2010, 01:08 PM   #10
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by Skaperen View Post
So I guess that's my issue.
I ran strings on my libparted and this was the output:
Code:
[user@machine]:strings /lib/libparted-1.8.so.9 | grep gpt
ped_disk_gpt_done
ped_disk_gpt_init
../../../libparted/labels/gpt.c
(PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA) <= disk->dev->length - 1
_header_is_valid (disk->dev, gpt)
gpt_disk_data->entry_count > 0
gpt_disk_data->entry_count <= 8192
gpt_part_data != NULL
gpt_alloc_metadata
gpt_partition_enumerate
gpt_partition_align
gpt_partition_get_flag
gpt_partition_set_flag
gpt_partition_set_system
gpt_partition_destroy
gpt_write
gpt_read
gpt_clobber
gpt_probe
ped_disk_gpt_init
If your libparted does not have these symbols, then that is at least part of the problem if not the whole problem.
 
Old 03-30-2010, 04:40 PM   #11
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
It seems to have lots of GPT stuff:
Code:
altair/root /root 461# cat /lib/libparted-1.8.so.12.0.0 /sbin/parted | strings | fgrep -i gpt
ped_disk_gpt_done
ped_disk_gpt_init
GNU Parted supports this EXPERIMENTALLY for some special disk label/file system combinations, e.g. GPT and ext2/3.
-../../../libparted/labels/gpt.c
%s contains GPT signatures, indicating that it has a GPT table.  However, it does not have a valid fake msdos partition table, as it should.  Perhaps it was corrupted -- possibly by a program that doesn't understand GPT partition tables.  Or perhaps you deleted the GPT table, and are now using an msdos partition table.  Is this a GPT partition table?
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)?
The primary GPT table is corrupt, but the backup appears OK, so that will be used.
Both the primary and backup GPT tables are corrupt.  Try making a fresh table, and using Parted's rescue feature to recover partitions.
_header_is_valid (disk->dev, gpt)
The format of the GPT partition table is version %x, which is newer than what Parted can recognise.  Please tell us!  bug-parted@gnu.org
Not all of the space available to %s appears to be used, you can fix the GPT to use all of the space (an extra %llu blocks) or continue with the current setting? 
gpt_disk_data->entry_count > 0
gpt_disk_data->entry_count <= 8192
gpt_part_data != NULL
PARTED_GPT_APPLE
gpt_alloc_metadata
gpt_partition_enumerate
gpt_partition_align
gpt_partition_get_flag
gpt_partition_set_flag
gpt_partition_set_system
gpt_partition_destroy
gpt_write
gpt_clobber
gpt_probe
ped_disk_gpt_init
so I don't know what is the cause. An early bug? Disabled by Ubuntu team?
 
Old 03-31-2010, 03:58 AM   #12
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Just FYI my Arch system shows version 2.2
 
Old 03-31-2010, 09:47 AM   #13
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by syg00 View Post
...my Arch system shows version 2.2
From http://www.gnu.org/software/parted/index.shtml
Code:
Latest Stable Release
2.2 was released on 26 Feb 2010.
Advantage Arch.
 
Old 03-31-2010, 11:01 AM   #14
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
I've decided to write my own modeled on gdisk in the gptdisk package. The parted command is just too inflexible. I just don't know when I can get to that. I'll use gdisk in the mean time.
 
  


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
how to use the command parted farooqmncl Linux - Newbie 1 04-25-2009 06:07 PM
Another Completely Worthless And Irrelevant Thread peter_89 General 4 03-01-2006 12:58 PM
fdisk/parted/cfdisk: command not found indole Linux - Software 2 02-17-2005 12:08 PM
command to completely remove a program? dr_zayus69 Linux - Software 1 12-18-2004 04:18 PM
drive worthless? bdp Linux - General 2 10-05-2003 09:21 PM

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

All times are GMT -5. The time now is 01:50 PM.

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