Linux - Server This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-03-2011, 06:46 PM
|
#1
|
LQ Newbie
Registered: Apr 2011
Posts: 7
Rep:
|
Moving LVM from disk2 t o disk1
Hi folks,
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.
|sda1.|.............sda2....................|sda3..||...........................sdb1................ ...........|
|---------------------------------------------------------------------------------------|
|...................disk1................................||.......................disk2............. ..................|
|---------------------------------------------------------------------------------------|
|.....|..........garbage?...................|<------------------------LVM-VG00---------------->|
|/boot|........................................|'swap'||.........................'/'+'swap'........................|
..................................................LogVol01................LogVol00 + LogVol01..................|
|101MB|..............295GB.................|2.9GB||.........................298GB................... ........|
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.
|
|
|
04-03-2011, 06:59 PM
|
#2
|
Senior Member
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385
|
@ Reply
Hello there,
Please paste the output of the following commands:
1. fdisk /dev/sda: It will take you fdisk utility, just hit p to print the partition table.
2. fdisk /dev/sdb: do the same as step 1.
|
|
|
04-03-2011, 07:14 PM
|
#3
|
LQ Newbie
Registered: Apr 2011
Posts: 7
Original Poster
Rep:
|
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
Thanks,
|
|
|
04-03-2011, 07:57 PM
|
#4
|
Senior Member
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385
|
@ Reply
Hello there,
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.
|
|
|
04-04-2011, 11:46 AM
|
#5
|
LQ Newbie
Registered: Apr 2011
Posts: 7
Original Poster
Rep:
|
[root@ck ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
287G 12G 260G 5% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 1.8G 0 1.8G 0% /dev/shm
[root@ck ~]#
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.
Thanks you.
|
|
|
04-04-2011, 02:26 PM
|
#6
|
Senior Member
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385
|
@ Reply
Hi DragonFly2,
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:
1. pvdisplay
2. vgscan
3. lvscan
|
|
|
04-05-2011, 02:25 AM
|
#7
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,417
|
|
|
|
04-05-2011, 05:57 PM
|
#8
|
LQ Newbie
Registered: Apr 2011
Posts: 7
Original Poster
Rep:
|
[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.
|
|
|
04-05-2011, 06:50 PM
|
#9
|
Senior Member
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385
|
@ Reply
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.
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.
|
|
|
04-06-2011, 06:10 PM
|
#10
|
LQ Newbie
Registered: Apr 2011
Posts: 7
Original Poster
Rep:
|
[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...
Thank you,
|
|
|
04-06-2011, 07:13 PM
|
#11
|
Senior Member
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385
|
@ Reply
Hi DragonFly2,
I now got a clear picture. Your /dev/sdb1 partition is mounting to / and /dev/sda3 is mounting as swap.
Just do cat /etc/fstab and you will see it displaying a line /dev/VolGroup00/LogVol00 / ext3 defaults 1 1
Infact I am quite sure that your /etc/fstab will show pretty much the following output:
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
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:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
287G 12G 260G 5% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 1.8G 0 1.8G 0% /dev/shm
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.
|
|
|
04-07-2011, 02:43 AM
|
#12
|
LQ Newbie
Registered: Apr 2011
Posts: 7
Original Poster
Rep:
|
[root@ck ~]# more /etc/fstab
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
Okay, you just convinced me. I'm going for deleting sda2, coming back when it's done.
Thanks you for your help.
|
|
|
04-09-2011, 08:58 PM
|
#13
|
Senior Member
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385
|
@ Reply
Hi Dragonfly2,
You're welcome.
Let me know once you are done with the deletion task of /dev/sda2 so that we can continue with our next plan to getting your /dev/sdb back.
|
|
|
04-11-2011, 07:21 AM
|
#14
|
LQ Newbie
Registered: Apr 2011
Posts: 7
Original Poster
Rep:
|
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,
|
|
|
04-11-2011, 03:43 PM
|
#15
|
Senior Member
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385
|
@ Reply
Hi DragonFly2,
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.
|
|
|
All times are GMT -5. The time now is 10:33 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|