on linux /data .. Volume groups

I am not an administrator.. The box I am working on have an sdc1 has 215 GB which is free.
/data exist... I don't know if it is part of a logical volume. it has only 10 GB...

I want to harvest like 150 GB from sdc1 in a volume group and add it to /data so this drive partition would be like 160GB
How would  I do that. I apologize if my terminology is off!
EmadGirgisAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Zephyr ICTCloud ArchitectCommented:
First thing we can do is check what is configured, can you post the outcome of following commands:

sudo pvdisplay
sudo lvdisplay

And perhaps

sudo fdisk -l
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
EmadGirgisAuthor Commented:
[collector1]root [ / ]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               vg01
  PV Size               10.00 GiB / not usable 3.96 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              2559
  Free PE               0
  Allocated PE          2559
  PV UUID               zDeV0O-0mm1-v30k-A5u3-Idkp-Q8c2-XFxjW1

  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               vg00
  PV Size               37.75 GiB / not usable 31.00 MiB
  Allocatable           yes (but full)
  PE Size               32.00 MiB
  Total PE              1207
  Free PE               0
  Allocated PE          1207
  PV UUID               GWyYX5-GpFP-H1XS-50mv-bKqn-QjQV-finc81

  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               vg00
  PV Size               112.00 GiB / not usable 30.03 MiB
  Allocatable           yes
  PE Size               32.00 MiB
  Total PE              3583
  Free PE               22
  Allocated PE          3561
  PV UUID               tAN8cX-W6VE-vAeN-2gm4-zjZn-cYND-uewtpp

  "/dev/sdc1" is a new physical volume of "200.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc1
  VG Name
  PV Size               200.00 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               dWLVvm-8bYf-TxU9-OfJE-fj5z-bJWo-b02lwn
0
EmadGirgisAuthor Commented:
[collector1]root [ / ]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg01/swaplv
  LV Name                swaplv
  VG Name                vg01
  LV UUID                K1D6Po-B3AC-FB3T-ohU4-gsqj-mgvQ-q6yiuY
  LV Write Access        read/write
  LV Creation host, time ip-l-00160-f5b, 2014-07-10 09:10:35 -0400
  LV Status              available
  # open                 1
  LV Size                10.00 GiB
  Current LE             2559
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/vg00/rootlv
  LV Name                rootlv
  VG Name                vg00
  LV UUID                tOU0f2-2rdE-sIkD-aeap-IdPI-gwqp-kNt6CX
  LV Write Access        read/write
  LV Creation host, time NEW-RHEL64-x64, 2013-08-08 13:08:34 -0400
  LV Status              available
  # open                 1
  LV Size                10.00 GiB
  Current LE             320
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/vg00/homelv
  LV Name                homelv
  VG Name                vg00
  LV UUID                d7RTsS-oTAi-07Xr-Vy7m-iUGE-EOaH-KxdAf6
  LV Write Access        read/write
  LV Creation host, time NEW-RHEL64-x64, 2013-08-08 13:09:44 -0400
  LV Status              available
  # open                 1
  LV Size                1.00 GiB
  Current LE             32
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/vg00/sahomelv
  LV Name                sahomelv
  VG Name                vg00
  LV UUID                iEG5hY-YCbI-YZTA-UNrv-si5B-JUqF-jIAV7v
  LV Write Access        read/write
  LV Creation host, time NEW-RHEL64-x64, 2013-08-08 13:10:09 -0400
  LV Status              available
  # open                 1
  LV Size                2.00 GiB
  Current LE             64
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3

  --- Logical volume ---
  LV Path                /dev/vg00/varlv
  LV Name                varlv
  VG Name                vg00
  LV UUID                Yd290f-Hacv-aWBF-36L2-Qufk-I7A8-Cxt84w
  LV Write Access        read/write
  LV Creation host, time NEW-RHEL64-x64, 2013-08-08 13:10:30 -0400
  LV Status              available
  # open                 1
  LV Size                4.00 GiB
  Current LE             128
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:4

  --- Logical volume ---
  LV Path                /dev/vg00/optlv
  LV Name                optlv
  VG Name                vg00
  LV UUID                BR7Gh3-6ixj-lKwA-1dTS-l3Ql-Htpo-MbXWNB
  LV Write Access        read/write
  LV Creation host, time NEW-RHEL64-x64, 2013-08-08 13:11:31 -0400
  LV Status              available
  # open                 1
  LV Size                131.00 GiB
  Current LE             4192
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:5

  --- Logical volume ---
  LV Path                /dev/vg00/tempswap
  LV Name                tempswap
  VG Name                vg00
  LV UUID                nQ8JMT-R2Yb-anAe-yES5-ajeC-IKPH-Cliwpj
  LV Write Access        read/write
  LV Creation host, time ip-l-00160-f5b, 2014-07-10 09:07:09 -0400
  LV Status              available
  # open                 0
  LV Size                1.00 GiB
  Current LE             32
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:6
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

EmadGirgisAuthor Commented:
[collector1]root [ / ]#  fdisk -l

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
22 heads, 16 sectors/track, 59578 cylinders
Units = cylinders of 352 * 512 = 180224 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000f1642

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       59578    10485720   83  Linux

Disk /dev/sdc: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf006bb78

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       26108   209712478+  8e  Linux LVM

Disk /dev/sda: 161.1 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000cff70

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          33      262144   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              33        4961    39582720   8e  Linux LVM
/dev/sda3            4961       19581   117438494+  8e  Linux LVM

Disk /dev/mapper/vg01-swaplv: 10.7 GB, 10733223936 bytes
255 heads, 63 sectors/track, 1304 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-rootlv: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-homelv: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-sahomelv: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-varlv: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-optlv: 140.7 GB, 140660178944 bytes
255 heads, 63 sectors/track, 17100 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-tempswap: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

[collector1]root [ / ]#
0
EmadGirgisAuthor Commented:
[collector1]root [ / ]#  df /data
Filesystem           1K-blocks    Used Available Use% Mounted on
/dev/mapper/vg00-rootlv
                      10321208 3221732   6575188  33% /
0
EmadGirgisAuthor Commented:
Let me clarify,

/data should not be part of vg00-rootlv

I want to move /data to a newly created vg00-datalv

I want to add /dev/sdc1 which is not formatted to vg00

I want vg00-datalv to be about 150 GB

Thanks in advance for your help... This will be extremely helpful to my career
0
Zephyr ICTCloud ArchitectCommented:
So /data is located on vg00 which is on a volume of 37.75 GiB, which seems to be full.
Now what you want to do is to use a part of the new disk to expand vg00-rootlv which houses /data.

This means you have to create a partition on the new disk sdc1 (fdisk /dev/sdc)

When done (you probably have to reboot) we can use this new partition to expand the volume group vg00 but first we need to create a physical volume (pvcreate /dev/sdb1)

Then we can use vgextend to expand rootlv (which I presume has /data since it's not a separate volume)

The complete process is explained here you can of course skip the part where it says to add a new virtual disk, the important part is further down.

Let me know if it's not completely clear.
0
Zephyr ICTCloud ArchitectCommented:
So I was typing and didn't see your last post, so yeah... That's a little different.

You still need to make a partition on your new disk using fdisk, but instead of using it to extend an existing volume you create a new volume also with pvcreate, then lvcreate, you can name this new volume data or something.

Once created you need to make a filesystem on it (there's a nice walk-through here)

With the filesystem created, the volume mounted ready for use, we can create a folder on it, let's call it newdata.

If you are sure there's no writing action happening on the original data volume you can copy everything from /data to /newdata (cp -R /data /newdata), once everything is copied you can delete the old /data and rename the /newdata to /data (mv /newdata /data).

There's other ways to do it, for instance if the /data folder is being written to while copying the first way wouldn't work very well, you'll have to boot into single mode (init 1)...

I hope it's somewhat clear ...
0
EmadGirgisAuthor Commented:
[collector1]root [ ~ ]# pvscan
  PV /dev/sdb1   VG vg01   lvm2 [10.00 GiB / 0    free]
  PV /dev/sda2   VG vg00   lvm2 [37.72 GiB / 0    free]
  PV /dev/sda3   VG vg00   lvm2 [111.97 GiB / 704.00 MiB free]
  PV /dev/sdc1   VG vg00   lvm2 [199.97 GiB / 199.97 GiB free]
  Total: 4 [359.65 GiB] / in use: 4 [359.65 GiB] / in no VG: 0 [0   ]


my sdc1 is showing only 199 GB while it is actually 214 GB... Any Idea why?
0
Zephyr ICTCloud ArchitectCommented:
my sdc1 is showing only 199 GB while it is actually 214 GB... Any Idea why?

That's because the listed size is the fabricator's size calculation, they use 1000kb, whereas in reality they need to use 1024kb. To know the real size (in the Gb's) you always have to deduct about 7,2% so applied to your advertised size 214-7,2%= 198.592, so about 199Gb.
0
Zephyr ICTCloud ArchitectCommented:
After taking another look, I see most of the work seems to be done, the new disk is already in vg00 ... So it should be usable, besides maybe creating a filesystem on it.
0
EmadGirgisAuthor Commented:
I AM DOING A PVSCAN
I see trouble with unkown devices and such
can you hold my hand here.... I am lost

 pvscan -vP
  PARTIAL MODE. Incomplete logical volumes will be processed.
    Wiping cache of LVM-capable devices
    Wiping internal VG cache
    Walking through all physical volumes
  Couldn't find device with uuid Xj0dOj-Luh2-oeqs-Qxtl-dksf-36ff-jcfdFh.
    Couldn't find device with uuid Xj0dOj-Luh2-oeqs-Qxtl-dksf-36ff-jcfdFh.
    Couldn't find device with uuid Xj0dOj-Luh2-oeqs-Qxtl-dksf-36ff-jcfdFh.
    Couldn't find device with uuid Xj0dOj-Luh2-oeqs-Qxtl-dksf-36ff-jcfdFh.
    There are 1 physical volumes missing.
  PV /dev/sdb1        VG vg01   lvm2 [10.00 GiB / 0    free]
  PV /dev/sda2        VG vg00   lvm2 [37.72 GiB / 0    free]
  PV /dev/sda3        VG vg00   lvm2 [111.97 GiB / 704.00 MiB free]
  PV unknown device   VG vg00   lvm2 [199.97 GiB / 199.97 GiB free]
  PV /dev/sdc1        VG vg00   lvm2 [100.41 GiB / 100.41 GiB free]
  PV /dev/sdc2        VG vg00   lvm2 [99.56 GiB / 99.56 GiB free]
  Total: 6 [559.62 GiB] / in use: 6 [559.62 GiB] / in no VG: 0 [0   ]
0
Zephyr ICTCloud ArchitectCommented:
There could be metadata missing, or it is corrupt ...  But it could point to:

PV unknown device   VG vg00   lvm2 [199.97 GiB / 199.97 GiB free]

Open in new window


Did you recently change something here? I see that you have 2 other volumes using /dev/sdc, /dev/sdc1 and /dev/sdc2, the one is 100,41Gb and the other is 99,56Gb, so nothing left of the sdc disk.

In case you need it, there's recover procedure, it's quite lengthy to explain and I'm about to sign off for the night. But here's a link that should get you through.

Though I have a sneaky suspicion that you'd better remove it ... Because you already created 2 volumes on sdc.
0
EmadGirgisAuthor Commented:
How I can remove the the wrong entries and fix the table!
0
EmadGirgisAuthor Commented:
I ran this command
lsblk -f
NAME                     FSTYPE      LABEL UUID                                   MOUNTPOINT
sr0
sdb
└─sdb1                   LVM2_member       zDeV0O-0mm1-v30k-A5u3-Idkp-Q8c2-XFxjW1
  └─vg01-swaplv (dm-0)   swap              1192203f-f020-4654-9025-a8c200ef6e0c   [SWAP]
sdc                      ext3              f9f612ac-fb4b-4cbb-94a6-9b35bb7e6d9f
├─sdc1                   LVM2_member       nvVrn2-K5YX-Q1Nu-WBzb-YHvm-Lmbm-06DedJ
└─sdc2                   LVM2_member       sqqLMA-95mb-CsFR-BdwV-nsQN-vwvx-fVEhYZ
sda
├─sda1                   ext3              c38119d7-36a3-44bc-b581-149994060230   /boot
├─sda2                   LVM2_member       GWyYX5-GpFP-H1XS-50mv-bKqn-QjQV-finc81
│ ├─vg00-rootlv (dm-1)   ext3              e98b02e9-1978-42e1-9497-5579cf7e9dfc   /
│ ├─vg00-homelv (dm-2)   ext3              698ecc9d-6d5f-4df0-9b1d-ad80bcbaeaa6   /home
│ ├─vg00-sahomelv (dm-3) ext3              dda32392-f369-4186-bdb8-5d84b2ca3a01   /sahome
│ ├─vg00-varlv (dm-4)    ext3              cb317580-473d-4d2a-9d19-27faed953426   /var
│ ├─vg00-optlv (dm-5)    ext3              fb24e3e9-5d82-49f2-9248-4a3bdb68c8d0   /opt
│ └─vg00-tempswap (dm-6) swap              1c7e31ac-d1ab-4915-8f5b-574f055bb249
└─sda3                   LVM2_member       tAN8cX-W6VE-vAeN-2gm4-zjZn-cYND-uewtpp
  └─vg00-optlv (dm-5)    ext3              fb24e3e9-5d82-49f2-9248-4a3bdb68c8d0   /opt

Now you see that sda and sdb both don't have uuid... sdc has one... this seems to be the error!
0
EmadGirgisAuthor Commented:
How to move my /data which is now part of /dev/mapper/vg00-rootlv to my newly created /dev/mapoper/vg00-datalv

This is the last piece of the puzzle.. Can you help me please
0
EmadGirgisAuthor Commented:
trying to mount but getting the error below
 

mount -t ext3 /dev/mapper/vg00-datalv /data
mount: wrong fs type, bad option, bad superblock on /dev/mapper/vg00-datalv,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
0
EmadGirgisAuthor Commented:
O.K. O.K.

I have to apologize for having to confuse you due to my ignorance of the subject.
Now it worked and here are the steps: -

A) backup the /data directory
B)
    1  cd /data
    2  df -B g .
    3.  cd /
    4   pvscan -vP
    5  fdisk -l
    6  fdisk /dev/sdc ( split the drive to sdc1 and sdc2.. use type 8e)
    7  pvcreate /dev/sdc1
    8   vgextend vg00 /dev/sdc1
    9     pvcreate /dev/sdc2
   10   vgextend vg00 /dev/sdc2
    11   mkfs.ext3 /dev/mapper/vg00-datalv
    12 mkfs.ext3 /dev/mapper/vg00-datalv
    13   mount -t ext3 /dev/mapper/vg00-datalv /data
    14    cd /data
     15   df -Bg .
C)
    restore data directory..

Thanks for helping me on this!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.