can't use swap after switch to LVM

Joel Uckelman uckelman at nomic.net
Sun Apr 9 22:12:22 UTC 2006


Thus spake Joel Uckelman:
> Thus spake Jeff Vian:
> >  
> > The lv is not active.
> > Have you tried to activate it?
> > See the listing in man lvs for the identifying the state, and in man
> > lvchange for how to activate it.
> >   Something like "lvchange -a y LogVol01"  should make it active so you
> > can then use commands such as mkswap and mount with it.
> 
> Here's what happens:
> 
> [root at scylla test]# lvchange -v -a y VolGroup00/LogVol01
>     Using logical volume(s) on command line
>     Activating logical volume "LogVol01"
>     Found volume group "VolGroup00"
>     Loading VolGroup00-LogVol01 table
>   device-mapper: reload ioctl failed: Invalid argument
> 
> I checked around some more, and found that device-mapper doesn't have
> a table for LogVol01:
> 
> [root at scylla test]# dmsetup table
> VolGroup00-LogVol05: 0 63373312 linear 9:1 786816
> VolGroup00-LogVol04: 0 262144 linear 9:1 64160128
> VolGroup00-LogVol03: 0 1179648 linear 9:1 76677504
> VolGroup00-LogVol02: 0 12255232 linear 9:1 64422272
> VolGroup00-LogVol01:
> VolGroup00-LogVol00: 0 786432 linear 9:1 384
> 
> Er? How did that happen? How do I determine what the table entry it
> should be?
> 
> > I assume the volume group is activated.
> 
> Yes, the volume group is activated.

Finally the cause of my problem dawned on me: The two drives in my
software RAID are not exactly the same size (despite being the same
"model"). I created the volume group on the drive which is about 1GB
larger, and then put the two drives together as a software RAID.
Thus, my swap partition, which was coincindentally also 1GB, "fell off
the end" of the volume group when creating the RAID chopped off the
last 1GB of it. (Honestly, I'm a bit surprised that this didn't
result in disastrous data loss. Must be my lucky day.)

I solved this by:

1. Using resize2fs to reduce the size of the filesystem in one of my
logical volumes by 1GB.

2. Shrinking the logical volume by 1GB.

3. Creating another logical volume for my swap partition.

-- 
J.




More information about the users mailing list