0

I need to extend / dev / sda6 on other occasions and used the following guide (https://www.miarec.com/doc/administration-guide/doc1012), adding a new disk to the vm, but apparently it is not compatible with this case. since the fs I am trying to extend does not correspond to an LVM. Also these do not have a vg name since when executing vgdisplay I do not get results. I have the possibility to take a snapshot to the machine so I have tried several ways but without success. Sorry if I did not pose the question in the correct way.

[root@runner003 ~]# fdisk -l
Disk /dev/sda: 150.3 GB, 150323855360 bytes, 293601280 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 label type: dos
Disk identifier: 0x000cf166

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   211814399   104857600   83  Linux
/dev/sda3       211814400   253757439    20971520   83  Linux
/dev/sda4       253757440   293601279    19921920    5  Extended
/dev/sda5       253759488   270276607     8258560   82  Linux swap / Solaris
/dev/sda6       270278656   280764415     5242880   83  Linux
/dev/sda7       280766464   293601279     6417408   83  Linux

Disk /dev/sdb: 15.7 GB, 15728640000 bytes, 30720000 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 label type: dos
Disk identifier: 0x22061e6d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    30719999    15358976   8e  Linux LVM
[root@runner003 ~]# lvmdiskscan
  /dev/sda1 [       1.00 GiB] 
  /dev/sda2 [     100.00 GiB] 
  /dev/sda3 [      20.00 GiB] 
  /dev/sda5 [      <7.88 GiB] 
  /dev/sda6 [       5.00 GiB] 
  /dev/sda7 [       6.12 GiB] 
  /dev/sdb1 [     <14.65 GiB] LVM physical volume
  0 disks
  6 partitions
  0 LVM physical volume whole disks
  1 LVM physical volume

1 Answer 1

0

To start, i'm sorry, but you need to understand what you are doing before trying random commands from internet. The guide you follow is for LVM setups, that you are not using, so all the LVM part is totally useless for you. If you are now knowledge enough to even understand the difference, probably it is better to ask for help from someone you know that understand more about linux. In the worse case, try IRC or other chats, or else you risk losing all the data in that linux. You need to understand what you are doing. If needed, search about all commands and/or use the man (command) to understand what each command can do and what parameters they use.

So to try to keep things simple, you have a setup that is not easy to expand, but if it is a VM, you can simply add a new disk (like you already did) and move the data from the old filesystem to the new and replace the mount point device. If you really want to resize the old one, you would need a temporary disk and many commands to move the last partition out of the way, expand the /dev/sda6 and then move back the last partition. Not easy, but can be done and it is a good task to learn how to work with partitions and filesystems :)

So lets keep this simple for now and delete that LVM disk (assuming it is the new disk and have no info!) and add a new, empty, one.

  • WARNING *

All the below commands are run as root or via sudo, so i will not add it to all commands. As root you can DESTROY your system, so be careful and if you do not understand a command, try to search about it first. DO NOT RUN COMMANDS without understanding what they are doing! If the /dev/sda6 partition is the root (/) filesystem or the /boot (or /boot/EFI), please stop, those will require more commands or a different way to move.

  • WARNING *

The simplest way now would be boot from a livecd and copy the partition to the new disk using a GUI tool, like gparted. If you like, you can even move all partitions to the new disk, but to have the system bootable you would need to reinstall grub in the new disk and maintain the same layout (partition numbers, but not the size). If you need this, please report.

So lets use gparted, it is easy to work with. So for moving a single partition, check the guide below

https://www.ghacks.net/2010/06/03/copy-partitions-with-gparted/

This will copy the disk to another disk. If you want, you can remove the old partition, but you will need to update the fstab for the /dev/sda7, as it will be renamed to /dev/sda6 (as extended partitions are always by order, no gaps allowed). If you do this, you can also resize the /dev/sda5 or /dev/sda7 to use the space used by the old /dev/sda6

Now you need to tell your linux setup to use that disk instead of the old one, so mount our root filesystem to a temporary location and edit the /etc/fstab to update the mountpoint device. Assuming the root filesystem is in /dev/sda1 (use df -h in your linux to find out)

mount /dev/sda /mnt
nano /mnt/etc/fstab

You can use any linux editor instead of nano. Search the /dev/sda6 and replace it with the new disk (probably /dev/sdb1). If you removed the old /dev/sda6 partition, also rename the /dev/sda7 entry to use /dev/sda6 instead. If you only have UUID, use blkid command to see the UUIDs for each partition.

Save the fstab and do

umount /mnt

and finally reboot. If all is good, the old sda6 filesystem should be in the new driver

You must log in to answer this question.

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