0

On my 1and1 root cloud server I'm trying to extend my file system size after an upgrade. I should have 120gb instead of 70gb. I'm not very experienced with filesystem extending

I'm on Ubuntu 16.04.3 LTS

Steps I took

$ pvcreate /dev/sda3

$ vgextend vg00 /dev/sda3

root@localhost:~$ vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  vg00   2   2   0 wz--n- 119.52g    0 

$ lvextend -l +100%FREE /dev/mapper/vg00-lv00

$ resize2fs /dev/mapper/vg00-lv00

this gives me the following error

root@localhost:~$ resize2fs /dev/mapper/vg00-lv00
resize2fs 1.42.13 (17-May-2015)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/vg00-lv00
Couldn't find valid filesystem superblock.

Here is what it currently looks like

root@localhost:~$ fdisk -l 
Disk /dev/sda: 120 GiB, 128849018880 bytes, 251658240 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: 0x4a065104

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         2048    999423    997376  487M 83 Linux
/dev/sda2          999424 104857599 103858176 49.5G 8e Linux LVM
/dev/sda3       104857600 251658239 146800640   70G 8e Linux LVM


Disk /dev/mapper/vg00-lv01: 47.6 GiB, 51124371456 bytes, 99852288 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 /dev/mapper/vg00-lv00: 71.9 GiB, 77204553728 bytes, 150790144 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

Df -h gives me:

 root@localhost:~$ df -h
    Filesystem             Size  Used Avail Use% Mounted on
    udev                   2.0G     0  2.0G   0% /dev
    tmpfs                  395M   11M  384M   3% /run
    /dev/mapper/vg00-lv01   47G   18G   28G  39% /
    tmpfs                  2.0G     0  2.0G   0% /dev/shm
    tmpfs                  5.0M     0  5.0M   0% /run/lock
    tmpfs                  2.0G     0  2.0G   0% /sys/fs/cgroup
    /dev/sda1              464M  146M  290M  34% /boot

****** EDIT *****

As sven pointed out correctly I have resized the wrong logical volume.

I want to remove it using

sudo lvremove /dev/vg00/lv00 which results in Logical volume vg00/lv00 in use.

I'm assuming it is used by another process, so I did

root@localhost:~$ dmsetup info -c | grep lv00 vg00-lv01 252 1 L--w 1 1 0 LVM-bajqBKcCFFgPQp40yHNfmReEAFHXcXe03BdrfHZV1JCVJigtzDTs2eEC3Y2GCepy

and tried to grep the process root@localhost:~$ lsof | grep 252,1

which does not find anything.

How can I remove the wrong logical volume?

xhallix
  • 243
  • 2
  • 8
  • The `dmsetup` output shows `vg00-lv01`, aka your `/` file system, but you grep for `lv00`, but this string doesn't match at all. This is confusing. – Sven Jun 10 '18 at 10:55
  • sorry this grep was for lv01 - updated the question. by grepping for lv00 I'm getting 252 - 1 – xhallix Jun 10 '18 at 10:58

1 Answers1

1

Assuming you want to increase the size of your / file system:

This is located on /dev/mapper/vg00-lv01. However, you have also another unmounted logical volume /dev/mapper/vg00-lv00 which is the one you have increased the size with lvextend. This volume doesn't appear to have a file system, so the resize2fs command failed, as there is nothing to resize.

You now have two options:

  1. If you want to increase the size of /, you need to

    • remove the unused secondary LV: lvremove /dev/mapper/vg00-lv00
    • then resize the LV containing / with lvextend -l +100%FREE /dev/mapper/vg00-lv01
    • finally, resize your file system: resize2fs /dev/mapper/vg00-lv01.

    Beware. This is potentially dangerous. Make sure you have a current and tested backup. It's on you if you loose any data while doing this.

  2. You want to have a second file system. This is easier and less dangerous:

    • Create a file system on lv00 with mkfs.ext4 /dev/mapper/vg00-lv00:
    • Create a mountpoint for it, e.g. /data with mkdir /data
    • Mount it: mount /dev/mapper/vg00-lv00 /data
    • Add an appropriate line in /etc/fstab to make the mount survive a reboot.
Sven
  • 98,649
  • 14
  • 180
  • 226
  • I ended up resizing my lv00 to a minimum because I'm not able to delete it and put the size for the other lv01 – xhallix Jun 10 '18 at 11:02