PDA

View Full Version : LVM snapsot merge coming.


SlowJet
2008-08-12, 04:28 PM CDT
http://kerneltrap/.org/Linux/LVM_Snapshot_Merging

The LVM2 and device-mapper are at the correct version in F10 but
the Kernel 27 must not have it yet.

Here is an example to set up a test but stops at the actual merge CAPITAL -M.

]# lvcreate --size 4G --name LogVol10x4 /dev/mapper/VolGroup10
Logical volume "LogVol10x4" created
[root@Tasha-19 log]# mkfs.ext3 /dev/mapper/VolGroup10-LogVol10x4
mke2fs 1.41.0 (10-Jul-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
262144 inodes, 1048576 blocks
52428 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1073741824
32 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@Tasha-19 log]# e2fsck /dev/mapper/VolGroup10-LogVol10x4
e2fsck 1.41.0 (10-Jul-2008)
/dev/mapper/VolGroup10-LogVol10x4: clean, 11/262144 files, 51312/1048576 blocks
[root@Tasha-19 log]# cd /mnt
[root@Tasha-19 mnt]# ls
x4
[root@Tasha-19 mnt]# mount /dev/mapper/VolGroup10-LogVol10x4 /mnt/x4
mount: /mnt/x4 does not contain SELinux labels.
You just mounted an file system that supports labels which does not
contain labels, onto an SELinux box. It is likely that confined
applications will generate AVC messages and not be allowed access to
this file system. You can add labels to this file system by executing
restorecon(8). If you do not want to add labels to this file system,
you should mount the file system using one of the "context" mount
option.[root@Tasha-19 mnt]# cd
[root@Tasha-19 ~]# mkdir /mnt/x4/vipdata
[root@Tasha-19 ~]# chown _r darwinhwebb:darwinhwebb /mnt/x4/vipdata
chown: invalid user: `_r'
[root@Tasha-19 ~]# chown -R darwinhwebb:darwinhwebb /mnt/x4/vipdata
[root@Tasha-19 ~]# cd /mnt/x4/vipdata
[root@Tasha-19 vipdata]# ls -halZ
drwxr-xr-x darwinhwebb darwinhwebb unconfined_u:object_r:file_t:s0 .
drwxr-xr-x root root system_u:object_r:file_t:s0 ..
drwxr-xr-x darwinhwebb darwinhwebb unconfined_u:object_r:file_t:s0 bin
[root@Tasha-19 vipdata]# cd bin
[root@Tasha-19 bin]# ls -halZ
drwxr-xr-x darwinhwebb darwinhwebb unconfined_u:object_r:file_t:s0 .
drwxr-xr-x darwinhwebb darwinhwebb unconfined_u:object_r:file_t:s0 ..
-rwxr-xr-x darwinhwebb darwinhwebb unconfined_u:object_r:file_t:s0 alsacard
-rwxr-xr-x darwinhwebb darwinhwebb unconfined_u:object_r:file_t:s0 alsaunmute
-rwxr-xr-x darwinhwebb darwinhwebb unconfined_u:object_r:file_t:s0 arch
lrwxrwxrwx darwinhwebb darwinhwebb unconfined_u:object_r:file_t:s0 awk -> gawk
-rwxr-xr-x darwinhwebb darwinhwebb unconfined_u:object_r:file_t:s0 basename
-rwxr-xr-x darwinhwebb darwinhwebb unconfined_u:object_r:file_t:s0 bash
-rwxr-xr-x darwinhwebb darwinhwebb unconfined_u:object_r:file_t:s0 cat

<snip>

# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol10home VolGroup10 -wi-ao 7.81G
LogVol10slash VolGroup10 -wi-ao 3.12G
LogVol10swap VolGroup10 -wi-ao 2.00G
LogVol10tmp VolGroup10 -wi-ao 960.00M
LogVol10usr VolGroup10 -wi-ao 4.69G
LogVol10var VolGroup10 -wi-ao 2.34G
LogVol10x4 VolGroup10 -wi-ao 4.00G

# df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup10-LogVol10slash
3225352 440896 2784456 14% /
/dev/mapper/VolGroup10-LogVol10home
8063408 150100 7503708 2% /home
/dev/mapper/VolGroup10-LogVol10var
2418944 158792 2137272 7% /var
/dev/mapper/VolGroup10-LogVol10tmp
967576 17728 900696 2% /tmp
/dev/mapper/VolGroup10-LogVol10usr
4837920 2080164 2511996 46% /usr
/dev/sdb1 318902 25007 277430 9% /boot
tmpfs 510496 76 510420 1% /dev/shm
/dev/mapper/VolGroup10-LogVol10x4
4128448 146028 3772708 4% /mnt/x4
[root@Tasha-19 bin]# man lvcreate
[root@Tasha-19 bin]# lvcreate --size 300M --snapshot --name snap10x4orig /dev/mapper/VolGroup10
Volume group "mapper" not found
[root@Tasha-19 bin]# lvcreate --size 300M --snapshot --name snap10x4orig /dev/VolGroup10/LogVol10x4
Rounding up size to full physical extent 320.00 MB
Logical volume "snap10x4orig" created
[root@Tasha-19 bin]# df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup10-LogVol10slash
3225352 440900 2784452 14% /
/dev/mapper/VolGroup10-LogVol10home
8063408 150136 7503672 2% /home
/dev/mapper/VolGroup10-LogVol10var
2418944 158792 2137272 7% /var
/dev/mapper/VolGroup10-LogVol10tmp
967576 17732 900692 2% /tmp
/dev/mapper/VolGroup10-LogVol10usr
4837920 2080164 2511996 46% /usr
/dev/sdb1 318902 25007 277430 9% /boot
tmpfs 510496 76 510420 1% /dev/shm
/dev/mapper/VolGroup10-LogVol10x4
4128448 146028 3772708 4% /mnt/x4
[root@Tasha-19 bin]# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol10home VolGroup10 -wi-ao 7.81G
LogVol10slash VolGroup10 -wi-ao 3.12G
LogVol10swap VolGroup10 -wi-ao 2.00G
LogVol10tmp VolGroup10 -wi-ao 960.00M
LogVol10usr VolGroup10 -wi-ao 4.69G
LogVol10var VolGroup10 -wi-ao 2.34G
LogVol10x4 VolGroup10 owi-ao 4.00G
snap10x4orig VolGroup10 swi-a- 320.00M LogVol10x4 0.00


###Copied some more files into the orginal
### snapshot uses a few blocks.
# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol10home VolGroup10 -wi-ao 7.81G
LogVol10slash VolGroup10 -wi-ao 3.12G
LogVol10swap VolGroup10 -wi-ao 2.00G
LogVol10tmp VolGroup10 -wi-ao 960.00M
LogVol10usr VolGroup10 -wi-ao 4.69G
LogVol10var VolGroup10 -wi-ao 2.34G
LogVol10x4 VolGroup10 owi-ao 4.00G
snap10x4orig VolGroup10 swi-a- 320.00M LogVol10x4 0.05
# df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup10-LogVol10slash
3225352 440900 2784452 14% /
/dev/mapper/VolGroup10-LogVol10home
8063408 150144 7503664 2% /home
/dev/mapper/VolGroup10-LogVol10var
2418944 158792 2137272 7% /var
/dev/mapper/VolGroup10-LogVol10tmp
967576 17732 900692 2% /tmp
/dev/mapper/VolGroup10-LogVol10usr
4837920 2080164 2511996 46% /usr
/dev/sdb1 318902 25007 277430 9% /boot
tmpfs 510496 76 510420 1% /dev/shm
/dev/mapper/VolGroup10-LogVol10x4
4128448 146040 3772696 4% /mnt/x4

###Get out of the mount and umount original lv
[root@Tasha-19 bin]# cd ..
[root@Tasha-19 vipdata]# ls
bin lvconvert
[root@Tasha-19 vipdata]# dir -a
. .. .bash_history bin lvconvert .pulse-cookie .recently-used.xbel
[root@Tasha-19 vipdata]# cd /mnt
[root@Tasha-19 mnt]# umount /mnt/x4


[root@Tasha-19 mnt]# #######here does the merge
[root@Tasha-19 mnt]# lvconvert -M --nameorigin /dev/mapper/VolGroup10-snap10x4orig
lvconvert: invalid option -- 'M'
Error during parsing of command line.

SJ