17

I'm trying to resize a partition using parted, but it has no the 'resize' command available

gchain@archbogchain@archbook:~$ sudo parted /dev/sdb 
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) help
  align-check TYPE N                        check partition N for TYPE(min|opt) alignment
  help [COMMAND]                           print general help, or help on COMMAND
  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
  mkpart PART-TYPE [FS-TYPE] START END     make a partition
  name NUMBER NAME                         name partition NUMBER as NAME
  print [devices|free|list,all|NUMBER]     display the partition table, available devices, free space, all found partitions, or a
        particular partition
  quit                                     exit program
  rescue START END                         rescue a lost partition near START and END
  rm NUMBER                                delete partition NUMBER
  select DEVICE                            choose the device to edit
  disk_set FLAG STATE                      change the FLAG on selected device
  disk_toggle [FLAG]                       toggle the state of FLAG on selected device
  set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
  unit UNIT                                set the default unit to UNIT
  version                                  display the version number and copyright information of GNU Parted

I'm using Archlinux x86_64, is this normal ?

Thanks !

Gustavo Chaín
  • 271
  • 1
  • 1
  • 4
  • 1
    You can first [convert](https://wiki.archlinux.org/index.php/GUID_Partition_Table#Convert_from_MBR_to_GPT) it from MBR to a GUID partition table. The process is simple and not prone to errors. The gdisk tool can then resize these partitions. It's in the Arch Linux "extra" repo. When you are done sizing it just right, see this thread: [How to Convert GPT back to MBR](https://bbs.archlinux.org/viewtopic.php?id=139990). – zero2cx Nov 10 '12 at 17:34
  • gparted works very well, but you need to be running GUI desktop – LatinSuD Jul 28 '16 at 15:24

7 Answers7

10

Yes, it is normal.

From the GNU site:

Note that after version 2.4, the following commands were removed: check, cp,
mkfs, mkpartfs, move, resize.
zero2cx
  • 641
  • 5
  • 16
  • 4
    Why? How should you move a partition? – azzid Jan 10 '17 at 20:23
  • 2
    @azzid I'll recommend the graphical utility **GParted** for the task of moving an existing partition. See [the link here](http://gparted.org/livecd.php) for more from the developer. – zero2cx Jan 13 '17 at 14:33
  • 7
    absolutely love gparted, but gui apps is not always an option. – azzid Jan 13 '17 at 15:13
  • 3
    sure, but I'm still curious. Why was the functionality dropped? – azzid Jan 15 '17 at 06:59
  • 5
    @azzid I would't know about the why of the matter but moving the partition [block-by-block](http://superuser.com/questions/541067/how-to-move-a-partition-in-gnu-linux) would work. It appears to me as if that's now the preferred method. Also, I notice that there have been what were probably many requests for the re-implementation of [parted's `resizepart`](https://bugzilla.redhat.com/show_bug.cgi?id=807101#c16). I've checked, and `resizepart` is available in version 3.2, so there is that. – zero2cx Jan 15 '17 at 19:23
  • In v3.2 I see it's listed there but it doesn't seem to actually do anything. I wonder what the deal is. – Andrew Jul 13 '17 at 01:42
  • 3
    This is infuriating. – Alexander Gonchiy Apr 18 '18 at 08:25
9

Most modern OSes now include the CHUI version of parted 3.2 which has resizepart instead:

(parted) resizepart 2 100%

You should find it in your package manager.

KolonUK
  • 212
  • 2
  • 7
3

I managed to perform this using sfdisk and then a filesystem resize. See this for sfdisk usage example.

Cand3r
  • 2,687
  • 1
  • 9
  • 24
  • 1
    This is a very old post and it is better to put as much of the link info into the question as possible in case the link dies in future. – Cand3r Jul 28 '16 at 14:51
3

You need to updating Parted to version 3.1-29.

parted-3.1-28 without resizepart

parted-3.1-29 with resizepart

Kata
  • 31
  • 2
3

Came across your question while trying to find a solution for a similar problem. I managed to resize my partition (and filesystem) and while I'm not sure if it's still relevant for you, I've documented my solution in a gist which might help out.

It boils down to not having the partion you want to resize mounted, resizing the partition to take up free continuous space on the disk by deleting and then recreating it and then running resize2fs to resize the filesystem as well.

Matijs
  • 131
  • 3
1

You will need parted 3.2. I had to compile it from source (on CentOS 6).

https://ftp.gnu.org/gnu/parted/parted-3.2.tar.xz

0

You can find resizepart as independient command. You can invoque it with this sintax: resizepart /dev/sdx #partnumber newsizeinblock

  • Despite the name, `resizepart` does not change the size of partitions. From [the man page](http://man7.org/linux/man-pages/man8/resizepart.8.html): "_This command doesn't manipulate partitions on a block device._" – Deltik Aug 06 '19 at 21:58