2

I am using SUSE 11, which is on VM. There are 3 partitions on an extended partition of 850GB named /dev/sda5, /dev/sda6, /dev/sda7. There is no space available on the disk. Now I want to increase the size of /dev/sda5 as its space is full. The thing is /dev/sda7 is completely free and unused. so I want to reduce the size of /dev/sda7 and allocate that space to /dev/sda5. How can I do it, if I can I so online?

Details are as below.

# df -h
Filesystem                     Size  Used Avail Use% Mounted on
/dev/sda1                      150G  8.3G  142G   6% /
udev                           3.7G  108K  3.7G   1% /dev
tmpfs                          3.7G   72K  3.7G   1% /dev/shm
/dev/sda3                      2.0G   65M  2.0G   4% /boot
/dev/sda7                      400G   33M  400G   1% /data
/dev/sda5                      100G  100G  117M 100% /opt
/dev/sda6                      100G  2.4G   98G   3% /var


# fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 1073.7 GB, 1073741824000 bytes
255 heads, 63 sectors/track, 130541 cylinders, total 2097152000 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
Disk identifier: 0x000e6978

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048   314568703   157283328   83  Linux
/dev/sda2       314568704   381671423    33551360   82  Linux swap / Solaris
/dev/sda3   *   381671424   385865727     2097152   83  Linux
/dev/sda4       385865728  2097151999   855643136    f  W95 Ext'd (LBA)
/dev/sda5       385867776   595576831   104854528   83  Linux
/dev/sda6       595578880   805289983   104855552   83  Linux
/dev/sda7       805292032  1644156927   419432448   83  Linux

# parted /dev/sda
GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 1074GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  161GB   161GB   primary   reiserfs        type=83
 2      161GB   195GB   34.4GB  primary   linux-swap(v1)  type=82
 3      195GB   198GB   2147MB  primary   reiserfs        boot, type=83
 4      198GB   1074GB  876GB   extended                  lba, type=0f
 5      198GB   305GB   107GB   logical   reiserfs        type=83
 6      305GB   412GB   107GB   logical   reiserfs        type=83
 7      412GB   842GB   429GB   logical   reiserfs        type=83
Anthon
  • 79,293

1 Answers1

2

Since sda5 and sda7 are not contiguous you cannot combine them if they are not under LMV or something similar.

Since sda7 is so much larger, the quickest solutions would be to just copy the files from sda5 to sda7 and mount sda7 where you used to mount sda5. If sda5 is not a partition you boot from that should be relatively straightforward.

Alternatively you shrink sda7 to make space for an sda8 that has at least the same size as sda6, format it and then copy its files from to that new partition. And mount sda8 where sda6 is. After that you can remove sda6 and the smaller sda7 to make sda5 bigger, and extend reiserfs on that partition.

Anthon
  • 79,293
  • Thanks Anthon, for the reply. Can i not increase /dev/sda5 directly by just decreasing the /dev/sda7 space?. If i decrease /dev/sda7 where does the shrinked space go(available). is it necessary to destroy the /dev/sda6 partition. pls reply. – Vamshi K Apr 19 '16 at 04:49
  • @VamshiK No, because sda6 would have to be moved, which is not trivial. sda5 needs contiguous blocks on the disc – Anthon Apr 19 '16 at 04:54
  • @VamshiK If the host has enough space, you can also create a new disc to the VM, partition that, copy all the files from the sda5 partition and mount the new disc where sda5 is mounted. – Anthon Apr 19 '16 at 04:58