[CentOS] concat mount

Tue Oct 16 21:17:38 UTC 2007
Michael Kress <kress at hal.saar.de>

Shawn Everett wrote:
> On Sunday 14 October 2007, Michael Kress wrote:
>   
>> I can mount them and work with them, no prob. Now I'd like to have my 25
>> files of 4GB file size each coherently mounted as one 100G drive. Is
>> this possible? Must be something like Raid 0.
>> TIA Michael
>>     
>
> You might try something like this:
> http://osdir.com/ml/linux.lvm.general/2003-10/msg00096.html
>
> Personally I think it's a bad idea. :)
>
> Shawn
>   

Hi, I dont't like it either, but I have to adopt to the given facts. :-( 
Your proposed method seems to be yet elegant.
Anyways, I got a problem with it.

This is what I do:
-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----
dd if=/dev/zero of=fake-disk-1.img bs=1M count=10
dd if=/dev/zero of=fake-disk-2.img bs=1M count=10
losetup /dev/loop0 fake-disk-1.img
losetup /dev/loop1 fake-disk-2.img
pvcreate /dev/loop0
pvcreate /dev/loop1
vgcreate /dev/vgtest /dev/loop0 /dev/loop1

root at x05:/root [0] > vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  vgtest   2   0   0 wz--n- 16.00M 16.00M

lvcreate --size=16M --name=lvtest /dev/vgtest
mkfs /dev/vgtest/lvtest
mkdir /mnt/lvtest
mount /dev/vgtest/lvtest /mnt/lvtest/

root at x05:/root [0] > df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             3.0G  2.4G  617M  80% /
none                  256M     0  256M   0% /dev/shm
/dev/mapper/vgtest-lvtest
                       16M  140K   15M   1% /mnt/lvtest

umount /mnt/lvtest/
shutdown -r now
-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----

So far so good.
After reboot I found this:

-----8<-----8<-----8<-----
root at x05:/root [0] > lvs
  No volume groups found
root at x05:/root [0] > vgs
  No volume groups found
root at x05:/root [0] > pvs
(no output)
-----8<-----8<-----8<-----

So I tried to recover the 2 files: I had to 'losetup' the files again, 
but pvcreate hangs here:
-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----
root at x05:/root [0] > pvcreate /dev/loop0
  Can't initialize physical volume "/dev/loop0" of volume group "vgtest" 
without -ff
root at x05:/root [5] >
-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----

So I did:
-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----
root at x05:/root [5] > pvcreate -ff /dev/loop0
Really INITIALIZE physical volume "/dev/loop0" of volume group "vgtest" 
[y/n]? y
  WARNING: Forcing physical volume creation on /dev/loop0 of volume 
group "vgtest"
  Physical volume "/dev/loop0" successfully created
root at x05:/root [0] > pvcreate -ff /dev/loop1
  Couldn't find device with uuid 'Z4Dr2Q-CBeM-QDHP-26d2-O1GV-DgZh-C7Z6pK'.
  Couldn't find all physical volumes for volume group vgtest.
  Couldn't find device with uuid 'Z4Dr2Q-CBeM-QDHP-26d2-O1GV-DgZh-C7Z6pK'.
  Couldn't find all physical volumes for volume group vgtest.
  get_pv_from_vg_by_id: vg_read failed to read VG vgtest
  Physical volume "/dev/loop1" successfully created
root at x05:/root [0] > vgcreate /dev/vgtest /dev/loop0 /dev/loop1
  Volume group "vgtest" successfully created
root at x05:/root [0] > lvcreate --size=16M --name=lvtest /dev/vgtest
  Logical volume "lvtest" created
root at x05:/root [0] > mount /dev/vgtest/lvtest /mnt/lvtest/
mount: you must specify the filesystem type
root at x05:/root [32] > fsck /dev/vgtest/lvtest
fsck 1.35 (28-Feb-2004)
e2fsck 1.35 (28-Feb-2004)
Couldn't find ext2 superblock, trying backup blocks...
Resize inode not valid.  Recreate<y>? yes

/dev/vgtest/lvtest was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong for group #0 (7854, counted=7855).
Fix<y>? yes

Free blocks count wrong (15722, counted=15723).
Fix<y>? yes


/dev/vgtest/lvtest: ***** FILE SYSTEM WAS MODIFIED *****
/dev/vgtest/lvtest: 11/4096 files (0.0% non-contiguous), 661/16384 blocks
root at x05:/root [1] > mount /dev/vgtest/lvtest /mnt/lvtest/
root at x05:/root [0] >
-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----

Ok, this works, but I can't rely on such a file system. Any idea on how 
I could get back the original logical volume lvtest without the indeed 
ugly file system check and without endangering the data contained in the lv?
TIA
Michael

-- 
Michael Kress, kress at hal.saar.de
http://www.michael-kress.de / http://kress.net
P E N G U I N S   A R E   C O O L