LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 04-06-2015, 04:05 AM   #1
koichirose
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Rep: Reputation: Disabled
Extending a partition with LVM, "device not found"


Hello!

I'm trying to extend a partition from 10 to 100GB on a server I'm managing.

Current situation:
Code:
# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu-root  8.5G  5.4G  2.8G  67% /
none                     4.0K     0  4.0K   0% /sys/fs/cgroup
udev                     3.4G  4.0K  3.4G   1% /dev
tmpfs                    698M  544K  698M   1% /run
none                     5.0M     0  5.0M   0% /run/lock
none                     3.5G     0  3.5G   0% /run/shm
none                     100M     0  100M   0% /run/user
/dev/sda1                228M   60M  157M  28% /boot


# fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 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: 0x00080ac2

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758    20969471    10233857    5  Extended
/dev/sda5          501760    20969471    10233856   8e  Linux LVM

Disk /dev/mapper/ubuntu-root: 9403 MB, 9403629568 bytes
255 heads, 63 sectors/track, 1143 cylinders, total 18366464 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: 0x00000000

Disk /dev/mapper/ubuntu-root doesn't contain a valid partition table

Disk /dev/mapper/ubuntu-swap_1: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 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: 0x00000000

Disk /dev/mapper/ubuntu-swap_1 doesn't contain a valid partition table


# vgdisplay
  --- Volume group ---
  VG Name               ubuntu
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               9.76 GiB
  PE Size               4.00 MiB
  Total PE              2498
  Alloc PE / Size       2498 / 9.76 GiB
  Free  PE / Size       0 / 0
  VG UUID               gG7dRH-wy0v-M2cL-wBjo-ALha-YRHp-ieceEi


# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda5
  VG Name               ubuntu
  PV Size               9.76 GiB / not usable 2.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              2498
  Free PE               0
  Allocated PE          2498
  PV UUID               U8FaKr-ynzz-sV08-T8Ro-NEbz-aX8o-7U3C4l


# lvscan
  ACTIVE            '/dev/ubuntu/root' [8.76 GiB] inherit
  ACTIVE            '/dev/ubuntu/swap_1' [1.00 GiB] inherit
I'd like /dev/mapper/ubuntu-root to use all the available space (100gb).
AFAIK, /dev/mapper/ubuntu-root is on /dev/sda5, so I should initialize /dev/sda2 with pvcreate, then extend it with vgextend/lvextend (need to look it up yet).

output:
Code:
# pvcreate /dev/sda2
  Device /dev/sda2 not found (or ignored by filtering)
How should I proceed?

Thank you
 
Old 04-06-2015, 04:41 AM   #2
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628

Rep: Reputation: 496Reputation: 496Reputation: 496Reputation: 496Reputation: 496
A good place to start would be with;
Code:
man lvm
sda2 is not a lvm volume. sda5 is. Try initializing it instead of sda2. I suspect that will give sda2 some sort of recognizable partition table.

You seem to have one drive with 2 partitions so why are you creating an lvm within an extended partition?

Is this simply to raise the overhead with the extra partition in the MSDos partition table or is there some other reason.

There is mention of some sort of swap. This is not liste by fdisk so it is not correctly created.

Why not start by getting rid of sda2 and whatever is supposed to be swap and then start over with simply a new sda2 and a new swap. Leaving the lvm completely off the drive?

If you had more than one drive and little idea what you were going to need partition wise would make lvm make some sense to me. This just looks kind of silly.
 
Old 04-06-2015, 04:44 AM   #3
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628

Rep: Reputation: 496Reputation: 496Reputation: 496Reputation: 496Reputation: 496
One nice output to have would be the output of, as root;
Code:
blkid
 
Old 04-06-2015, 04:52 AM   #4
koichirose
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
widget:
Code:
# blkid
/dev/sda1: UUID="981b4420-1a40-4ab7-a3d5-dca9b09af1f8" TYPE="ext2"
/dev/sda5: UUID="U8FaKr-ynzz-sV08-T8Ro-NEbz-aX8o-7U3C4l" TYPE="LVM2_member"
/dev/mapper/ubuntu-root: UUID="b223021e-9395-43a9-8690-75491f0a4793" TYPE="ext4"
/dev/mapper/ubuntu-swap_1: UUID="4420e660-3bfd-4ceb-877b-438cd800c24b" TYPE="swap"
Thank you for your answer. This is a remote cloud server that came with 10GB. They have a control panel where they set my available space to 100GB.
I'm not sure if /dev/sda5 was already there or it was created after this, but I don't have much control over this.
My only task is to make 'ubuntu-root' use the whole 100GB.

I'm sorry but I mentioned /dev/sda2 by mistake before, I meant /dev/sda5.
Output:
Code:
# pvcreate /dev/sda5
  Can't initialize physical volume "/dev/sda5" of volume group "ubuntu" without -ff
I'm not sure if forcing this would create any issues. This is a live production server unfortunately, so I'm trying not to mess things up

Thank you.
 
Old 04-06-2015, 05:06 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,615

Rep: Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527
On the contrary, that is a quite common LVM arrangement.

Simply create a new logical partition (/dev/sda6) using all the unallocated space, then pvcreate that, then as you say simply vgextend, then lvextend.
Plenty of tutorials online, but Redhat have a good LVM Admin guide you might find useful.
 
Old 04-06-2015, 05:26 AM   #6
koichirose
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
syg00:
I tried doing that using fdisk:
Code:
# fdisk /dev/sda
Command (m for help): n
Partition type:
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p): l
Adding logical partition 6
No free sectors available
Also I'm not sure what is the role of /dev/sda2 in all this.

Thank you again
 
Old 04-06-2015, 05:31 AM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,615

Rep: Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527
An extended partition is a container for logical partitions. It is a (Microsoft) hack to get around the MS-DOS limit of 4 primary partitions. Let's see the output from this run as sudo/root
Code:
parted /dev/sda "print free"
 
Old 04-06-2015, 05:40 AM   #8
koichirose
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Here it is
Code:
# parted /dev/sda "print free"
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
        32.3kB  1049kB  1016kB            Free Space
 1      1049kB  256MB   255MB   primary   ext2         boot
        256MB   257MB   1048kB            Free Space
 2      257MB   10.7GB  10.5GB  extended
 5      257MB   10.7GB  10.5GB  logical                lvm
        10.7GB  107GB   96.6GB            Free Space
So does this mean that sda2 contains sda5 (which "contains" ubuntu-root) ?
I don't have 4 primary partitions yet though, so it should let me create /dev/sda6 with all the unallocated space in it.
 
Old 04-06-2015, 06:10 AM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,615

Rep: Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527Reputation: 3527
You could use a primary to allocate that space (it would become /dev/sda3), however if your provider later adds more space again, you might start to get into trouble.
Better to use cfdisk to create the new logical - it will enlarge the extended partition automatically for you. fdisk won't do that. In cfdisk, simply highlight the unused space (it's an ncurses application), and create the new logical.
 
1 members found this post helpful.
Old 04-06-2015, 09:27 AM   #10
koichirose
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Got it, done with cfdisk, thank you very much!
For the record, after creating a new logical partition using cfdisk, taking up all available space, I ran the following:
pvcreate /dev/sda6
vgextend ubuntu /dev/sda6
lvextend -l +100%FREE /dev/mapper/ubuntu-root
resize2fs /dev/ubuntu/root
 
Old 04-07-2015, 04:38 PM   #11
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628

Rep: Reputation: 496Reputation: 496Reputation: 496Reputation: 496Reputation: 496
That sounds better.

When asking for help it is always a great idea to say what hardware you are using. Knowing this is a cloud server does make some difference in what your options are.

Nice to see the numbers making more sense anyway.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"Device is busy" message when trying to resize filesystem on encrypted LVM rokyo Linux - Newbie 1 07-11-2014 02:35 AM
LVM has lost the plot - "Couldn't find device with uuid...." The Fold Slackware 0 10-21-2008 09:54 AM
LVM pvcreate "Device not found" error susmitha Linux - Newbie 2 07-14-2005 06:07 AM
"Successful install" results in "Boot device not found" slackr007 Fedora 2 06-21-2005 04:05 PM
"Successful install" results in "Boot device not found" slackr007 Linux - Newbie 2 05-31-2005 08:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 05:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration