1

Alright people be nice. First question here. I tried searching on blogs but could get anywhere.

I am using Debian which is on VMware so case may be little different.

Situation:

This is machine setup in VMware environment in data center, so I can not put bootable disk.

I have two option :

  1. Resizing some dev/sda1 partition which seems impossible. So I have decided to do option 2.

  2. Add another partition with remaining of disk space.

I already increased size on VMware to 300 GB (I also tried adding another disk 1st 30 GB, second 200 GB).

+++++++++++++++

less /proc/version

Linux version 3.16.0-4-amd64 ([email protected]) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.7-ckt20-1+deb8u2 (2016-01-02)
/proc/version (END)


root@Penxxy3:/# df -h
Filesystem                        Size  Used Avail Use% Mounted on
/dev/sda1                          29G   29G     0 100% /
udev                               10M     0   10M   0% /dev
tmpfs                             1.6G   29M  1.6G   2% /run
tmpfs                             4.0G   12K  4.0G   1% /dev/shm
tmpfs                             5.0M     0  5.0M   0% /run/lock
tmpfs                             4.0G     0  4.0G   0% /sys/fs/cgroup
10.224.0.124:/data/backups/xxmer   11T  521G   11T   5% /homer
tmpfs                             801M  4.0K  801M   1% /run/user/1000
root@PentahoSy3:/#

++++++++++++++

Command (m for help): p

Disk /dev/sda: 300 GiB, 322122547200 bytes, 629145600 sectors   <<<<< 300 GiB
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: 0x8476ef5a

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sda1  *        2048 60262399 60260352 28.8G 83 Linux
/dev/sda2       60264446 62912511  2648066  1.3G  5 Extended
/dev/sda5       60264448 62912511  2648064  1.3G 82 Linux swap / Solaris


Command (m for help): m



Command (m for help): n
Partition type
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p):

Using default response p.
Partition number (3,4, default 3):
First sector (60262400-629145599, default 60262400):
Last sector, +sectors or +size{K,M,G,T,P} (60262400-60264445, default 60264445):

Created a new partition 3 of type 'Linux' and of size 1023 KiB.

Command (m for help): p
Disk /dev/sda: 300 GiB, 322122547200 bytes, 629145600 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: 0x8476ef5a

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sda1  *        2048 60262399 60260352 28.8G 83 Linux
/dev/sda2       60264446 62912511  2648066  1.3G  5 Extended
/dev/sda3       60262400 60264445     2046 1023K 83 Linux
/dev/sda5       60264448 62912511  2648064  1.3G 82 Linux swap / Solaris

Any idea how can i add another partition with rest of 260 odd GB ?

3
  • I added another HDD in vmware dev/sdb with 200 GB and was able to partition that using fdisk /dev/sdb but I can not see that shown. root@PentahoSy3:/# fdisk /dev/sdb Disk /dev/sdb: 200 GiB, 214748364800 bytes, 419430400 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: 0x28205cd1 Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 419430399 419428352 200G 83 Linux
    – Krishnam
    Commented Mar 23, 2016 at 1:00
  • Oh I see, you tried to make a new partition, but it would only create 1023K partition?
    – Paul
    Commented Mar 23, 2016 at 1:03
  • 1
    When extending a partition the extended space in not automatically added to the exist space, instead it becomes unused space after the partition. You need to get an ISO copy of gparted or partedmagic or etc. Boot, and use it to increase the size of the existing partition to include the unused space.
    – cybernard
    Commented Mar 23, 2016 at 1:13

3 Answers 3

2

My suggestion is to get a partition editor like gparted https://gparted.org/

  1. Put it on your datastore.
  2. Go into the properties of the VM and assign the ISO to the virtual CD/DVD
  3. Boot the VM, and press ESC and you should get a boot menu
  4. Select virtual CD/DVD
  5. Boot
  6. When loaded launch gparted, and you can then visually see what is going on.
  7. Delete,add, resize, or etc the necessary partitions.
  8. Commit your changes
  9. Wait for that to complete
  10. Reboot
  11. Don't press any key and it should boot normally.
1
  • This needs a way higher score. It's a very simple solution. Basically just download gparted and the GUI is selfexplanatory. Commented Nov 4, 2021 at 21:49
0

You currently have a primary partition, and an extended partition.

You attempted to create a new primary partition, but there isn't very much space between the current primary partition and the extended.

An extended partition lets you create additional partitions beyond the four primaries permitted.

Instead of choosing p when creating the partition, choose l. This will let you use the remaining space.

8
  • also tried wit with adding diff partition. There is limit on characters left so I cant share output here. root@PentahoSy3:/# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 29G 29G 0 100% / udev 10M 0 10M 0% /dev tmpfs 1.6G 8.9M 1.6G 1% /run Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 419430399 419428352 200G 5 Extended
    – Krishnam
    Commented Mar 23, 2016 at 1:10
  • @Krishnam And what happened?
    – Paul
    Commented Mar 23, 2016 at 1:11
  • Oh wait, I see. The extended partition was created when the disk was only 30GB, and so it doesn't know about the rest of the space.
    – Paul
    Commented Mar 23, 2016 at 1:11
  • You don't seem to be using sda2 and sda3, and sda5 is swap. Could you turn swap off, then delete these three partitions?
    – Paul
    Commented Mar 23, 2016 at 1:13
  • Ok searching on how to disable swap.
    – Krishnam
    Commented Mar 23, 2016 at 1:15
0

These operations come with risk - so back up your disk first.

Both options are possible. The first step is to increase the size of the disk outside the VM. I don't use VMWare, so can't advise, but you seem to have this in hand.

****Option 1 - Increase the size of the partition ****

  • Boot the system
  • Unmount swap using swapoff -a
  • Use FDISK to delete the swap partition (/dev/sda5). Then delete and recreate the primary partition to the desired size, making careful note to start it at the same block, use type 83 and make it bootable. If you don't use swap often, and think you may need this process again, you can create a swap file rather then disk, otherwise you can create a new swap partition at the end of the disk - make sure its type 82.

  • (May not be needed) comment out the swap mounting from /etc/fstab

  • Reboot the system.
  • When the system comes up, you can grow the filesystem to take advantage of the additional space with a command like resize2fs /dev/sda1 (some distros its resize4fs /dev/sda1 - either is OK)
  • Create a swap file if you need one, for example dd if=/dev/zero of=/swap.file bs=102400 count=10240 [for a 1 gig file]
  • Format swap file or partition mkswap /file/or/partition
  • Add swap file/partition to /etc/fstab
  • swapon -a to activate swap

** Option 2 - Create a new partition **

Follow the instructions above, except create a new partition for the new space rather then expand the existing partition. You will need to format the space rather then expand it. You will need to reformat recreated swap partition as well.

** Future Builds ** In future, consider using LVM - if you had an LVM install you could put swap and additional partitions on LVM, and simply add new LVM partitions - then use LVM to join partitions together into a single logical device.

0

You must log in to answer this question.

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