Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I'm a newbie to LVM and RAID, but it looks I have to work with that.
I have a server with 2 same size 320GB sata disks, and I wanted to have RAID-1.
During installation procedure I was pretty much sure I set RAID-1 up, but it looks, it's definitely not a RAID.
It looks it's definitely not a RAID, so I have to figure out how to make it.
disk1:
-sda1
--blocks from 1-13
---102MB
----/boot
-----Linux file system
-sda2
--blocks from 14-38527
---295GB
---- not used (I guess) It would be RAID, configured partly, but it looks it's a huge empty partition. (garbage)
-----Linux RAID
-sda3
--blocks from 38528-38913
---2.9GB
----Linux LVM
----- LogVol01 'swap'
disk2:
-sdb1
--blocks from 1-38913
---298GB
----Linux LVM
----- LogVol00 '/' 295GB AND LogVol01 'swap' 2.5 GB
-Can you recommand me some steps how to "move" LVM data from disk2 to disk1?
I'd like to free disk2 up, because empty disk2 is a precondition in my proper and tested "RAID-1 how to" procedure.
The used application isn't disk intensive, there's only 6GB used in '/'. I'm not sure that is relevant.
Thanks you.
Last edited by DragonFly2; 04-03-2011 at 06:48 PM.
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 38527 309363705 fd Linux raid autodetect
/dev/sda3 38528 38913 3100545 8e Linux LVM
Disk /dev/sdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 38913 312568641 8e Linux LVM
As you said in the first post that you have done RAID1 but it doesn't appear to be because RAID1 is for mirroring and I can only see 1 RAID partition that you have done on the first disk. Usually when you do mirroring you do it on different disk unless you are doing it on the test server and even then I should be seeing two RAID partitions.
Also I can see two lvm partition, one on each disk. Not sure if you are using them or to which directory you have mounted them.
One more information is required here. Can you please paste the output of the following command so that I can check on which devices/partitions your directories are currently mapping:
df -h
I hope after running the above command you will come to know which partitions you are using and which you are not :-)
Last edited by T3RM1NVT0R; 04-03-2011 at 08:25 PM.
I wish I would put more effort to focus on RAID1 at installation. I guess it's gonna be more painful to correct this issue, than doing it properly at the start.(during instalation) I don't know how to start doing this,this is why I'm asking...
So I'd like to move LVM from disk2 to disk1. I'd like to have an empty disk2 before my RAID procedure.
As I can see from the output of the df-h command I do not see any lvm partition mounted other than
/dev/mapper/VolGroup00-LogVol00
To get more information about the physical volumes in LVM: pvdisplay (please paste the out in the thread)
Also I do not see two RAID partition in the previous fdisk output that you have pasted.
/dev/sda2 14 38527 309363705 fd Linux raid autodetect
is the only RAID partition that I can see on device sda, so I am pretty sure that this paritition alone cannot be part of RAID. In short no RAID configured on the system. This partition is not even mounted otherwise it should have popped up in df -h output. So we can get rid of this partition as I am pretty sure that this partition is not in use.
/dev/sda3 38528 38913 3100545 8e Linux LVM
/dev/sdb1 * 1 38913 312568641 8e Linux LVM
/dev/sda1 * 1 13 104391 83 Linux ------- is the boot partition
/dev/sda3 38528 38913 3100545 8e Linux LVM --------- is the / partition pointing to /dev/mapper/VolGroup00-LogVol00
I am not sure if you have extended the logical volume created on sda to sdb. So can you please paste the out of the following commands in this thread:
[root@ck ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda3
VG Name VolGroup00
PV Size 2.96 GB / not usable 19.88 MB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 94
Free PE 0
Allocated PE 94
PV UUID dEIhmr-B0uo-yitk-W0ZP-1uVs-ZUz3-ZqU7Ia
--- Physical volume ---
PV Name /dev/sdb1
VG Name VolGroup00
PV Size 298.09 GB / not usable 26.81 MB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 9538
Free PE 0
Allocated PE 9538
PV UUID mBHQIW-ouGO-z6Ll-154H-sJpj-5hzW-l03134
[root@ck ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "VolGroup00" using metadata type lvm2
[root@ck ~]# lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [295.59 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [5.41 GB] inherit
[root@ck ~]# mdadm --detail
mdadm: No devices given.
Hmmm, It looks LogVol01 'swap' uses both disks. And it looks it don't have a working RAID. It's just garbage from an inperfect installation.
So, Can you recommend me some steps how to get my disk2 back ? Or should it be easier to make disk1 empty ? If there's a procedure to transfer '/boot' ? Sorry if I asked a wrong question, I'm just trying to get familiar with this whole thing.
Thanks,
ps: It's a CentOs5.4, I don't know if matters.
Last edited by DragonFly2; 04-05-2011 at 06:00 PM.
1. fdisk /dev/sda: This will take you to the fdisk utility to modify partitions on sda
2. Type p to print the the partition table.
3. It will show the result as follows (copying the output from your previous post):
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 38527 309363705 fd Linux raid autodetect
/dev/sda3 38528 38913 3100545 8e Linux LVM
4. Type d to delete the partition. It will prompt you to enter the partition number. Enter 2 as /dev/sda2 is the partition for Linux raid.
5. Type w to write the changes to the paritition table.
6. Again type fdisk /dev/sda. It will take you to fdisk utility. Type p to print the paritition table to confirm if the changes you made earlier are written to paritition table or not.
Before we go with the removing of lvm from /dev/sdb I need little bit more information (Sorry forgot to put these commands last time). Can you please type lvdisplay and vgdisplay and let me know the result. lvdisplay will let us know the size of each logical volume. vgdisplay will get the information regarding the total volume group size extend. This will help us to calculate by how much we can resize the logical vol to get one lv off from /dev/sdb.
Please go ahead with RAID partition removal and let me know the result.
Last edited by T3RM1NVT0R; 04-05-2011 at 06:53 PM.
[root@ck ~]# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID 7Ama5j-1QnT-uFlT-zGBY-zEYL-b8rL-1veLpu
LV Write Access read/write
LV Status available
# open 1
LV Size 295.59 GB
Current LE 9459
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID 15o2mD-rs37-18iK-tzaF-VIen-sI19-jp5d0C
LV Write Access read/write
LV Status available
# open 1
LV Size 5.41 GB
Current LE 173
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
[root@ck ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 2
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 2
Act PV 2
VG Size 301.00 GB
PE Size 32.00 MB
Total PE 9632
Alloc PE / Size 9632 / 301.00 GB
Free PE / Size 0 / 0
VG UUID wEmab2-dVsF-DWX2-0nqH-JDdU-VZ1g-2YC30T
Addinfo : There's no /etc/mdadm.conf and /etc/raidtab file. (seems no RAID)
I'm worrying about deleting sda2 with fdisk. There's a running service on that, spare server takes a 6-7 hours to put it into live. Can you confirm that supposedly we don't use sda2 at all ? I mean based on the logs I'm attached before...
Let me know if that is correct so that we can further proceed with getting your /dev/sdb back. I just want to be double sure before suggesting anything :-)
As far as /dev/sda2 (Linux RAID autodect) is concerned I would like to point the output of df -h that you have pasted:
As you can see from the above output that /dev/sda2 is not at all mapping on the system (Not sure if you are mapping it manually, very less chances of that)
Also if you will check the output of the command cat /etc/fstab which I mentioned earlier I am quite sure that you will not find any entry related to /dev/sda2 in that and that is the reason I can say that /dev/sda2 is not in use and it is safe to remove it from the system.
As mentioned earlier let me know whatever I said about the lvm configuration system above in this reply is correct or not so that we can proceed with further troubleshooting this issue.
Also paste the output of cat /etc/fstab in this thread so that I can also have a look at it.
I was quite busy to handle this problem. Anyway I have a question with that, are you sure that if I delete partition sda2, sda3 will work witout any problem? Should I see it still sda3 or should it be a new sda2 ?
If seems to be a dummy question, sorry for that.
Thanks,
As I mentioned in my previous post following are steps to delete the /dev/sda2 partition. During the deletion it will prompt you to enter the partition number that you want to delete.
Quote:
Originally Posted by T3RM1NVT0R
Hi DragonFly2,
Here is the way you can get your disk back:
1. fdisk /dev/sda: This will take you to the fdisk utility to modify partitions on sda
2. Type p to print the the partition table.
3. It will show the result as follows (copying the output from your previous post):
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 38527 309363705 fd Linux raid autodetect
/dev/sda3 38528 38913 3100545 8e Linux LVM
4. Type d to delete the partition. It will prompt you to enter the partition number. Enter 2 as /dev/sda2 is the partition for Linux raid.
5. Type w to write the changes to the paritition table.
6. Again type fdisk /dev/sda. It will take you to fdisk utility. Type p to print the paritition table to confirm if the changes you made earlier are written to paritition table or not.
Don't worry it will do nothing to your /dev/sda3 partition. Your /dev/sda3 partition will remain the same it will not become /dev/sda2. After deletion Linux will not show /dev/sda2 partition in the partition table thats it. Rest all will remain the same.
Also I would say it is always good to keep backup of your data when you are dealing with disk operations. Backup always give you a sense of security when you dealing with disk operations :-)
PS:-
If you are planning to create a new partition on /dev/sda after deleting /dev/sda2 I would like to mention one more thing. See the output of the fdisk command that you ran on /dev/sda:
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 38527 309363705 fd Linux raid autodetect
/dev/sda3 38528 38913 3100545 8e Linux LVM
Do you see that /dev/sda2 is starting at 14 and ending at 38527 the next time you create partition make sure that you start from 16 and end it at 38525 just to be sure that you are not overwriting any partition boundry.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.