If you get the message above when you try to create a PV with 'pvcreate' you don't (generally) need the '-ff' option. That's a sledgehammer, usually needed when you're in the unenviable position of having to string back together a busted up LVM group. (I've done this... it ain't pretty.)
Run 'pvs' to get a quick list of PVs on your system. (And yes, 'vgs' and 'lvs' give you a quick list of VGs and LVs on your system. One helpful form of the last command is
lvs -a -o +devices
which will not only list your LVs, but it will show you what PVs each LV is using. VERY useful info when you're moving your PEs from disk to disk.)
So if 'pvs' shows that your intended PV was previously a PV, you can enter
pvremove /dev/sdXY
to take it out, then put it back in again with 'pvcreate /dev/sdXY'. No need for sledgehammers.
It's most handy to use LVM with RAID, in which case you'll be creating PVs from RAID md's. It all works the same, you just use the form
pvcreate /dev/mdX
vgextend db_arch /dev/mdX
and you've added a RAID disk (typically a RAID-1 set) to your VG to create/extend LVs with.
Aside from the redundancy, it makes your LVM more bulletproof and gives you more flexibility to do things such as migrate to other disks and even split a RAID-1 array to move your entire FS to a new machine (or location) -- while still using the existing system (which stays in place on a degraded RAID-1 set. (You can add new mirrors later.)
Fun stuff... :^)
Discussion on:
Message 4 of 4

































