0

I have 3 partitions (linux, extended, swap) I need to extend my live partition (linux) to the space available after these partition.

More info:

#fdisk /dev/vda

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/vda: 164 GiB, 176093659136 bytes, 343932928 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdbf0e7ee

Device     Boot     Start       End   Sectors  Size Id Type
/dev/vda1  *         2048 117575679 117573632 56.1G 83 Linux
/dev/vda2       117575680 134217727  16642048    8G  5 Extended
/dev/vda5       117577728 134217727  16640000    8G 82 Linux swap / Solaris

This virtual disk is in a proxmox machine. I read several tutorials that say to do parted /dev/vda with resizepart 1 100% but that give me the error parted: invalid token: 100%. Some other tutorials say to delete the partition and recreate but as I have 2 partitions after the one I need to resize I don't know how to do, I must not lost my data.

1

In fact, you have 2 partitions only. The "Extended" means that an other kind of partition table is used to overcome the available number of "primary" partitions (max 4) in standard MBR partiton table. Another problem I see: you cannot change size of a mounted partiton, what you probably did try.

Each partiton have to be continuous so you cannot "resize" the first partition simply "jumping" over the swap partition. If you do not want to make a new the partitoning from the scratch I can recommend the Live Gparted CD (may be used also as live iso conected to a virtual machine). It uses an intuitive GUI which can help you to shift the swap and resize the first partition.

Advices:

  • put the swap always at the begining of the disk as the first partiton
  • use the primary MBR partitons if you do not need more than 4 partiton
  • start to learn how to use GPT partitoning - it is the future

P.S. You have:

(MBR)vdavdavda(ExPT)swapswap ---------------------------------

You asked:

(MBR)vdavdavda(ExPT)swapswap vdavdavdavdavdavdavdavdavdavdavda

What you need:

1) (MBR)vdavdavda---------------------------------(ExPT)swapswap
2) (MBR)vdavdavdavdavdavdavdavdavdavdavdavdavdavda(ExPT)swapswap

P.P.S. As you may temporarily run without swap, you may simply delete the swap partition at all (with the "Extended partiton table"), then enlarge the vda, and then again create the swap.

| improve this answer | |
  • I can't use a live cd because it's on a remote server. Ok, You gave the method, but how do I do that without risk ? – Entretoize Mar 24 at 7:54
  • Remote server?! Ouh. Is it realy impoirtant to resize the vda1 partiton? If you need just more space for your user document, you may simply create a new partition, format it as ext3 and then mount it either to subdir of your home dir, or anywhere else e.g. as /var/www to enlarge the space for your web pages. Or ask your hosting support for help. They may give you temporarily a new virtual disk of the same amout of space, and you can simply install a new pure system on it, and finaly copy your important data (migrate). After that you can give them the wrong virtual disk back. – schweik Mar 24 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.