cancel
Showing results for 
Search instead for 
Did you mean: 

Move a filesystem

SOLVED
Go to solution
Falco_1
Occasional Visitor

Move a filesystem

I would like to move a filesystem in my VG04 into VG00. How to do it? Do you know what actions are needed? Thanks in advance!
12 REPLIES
Robert-Jan Goossens
Honored Contributor
Solution

Re: Move a filesystem

Hi,

Simple answer, you can not move a filesystem. You will have to recreate it.

# lvcreate
# newfs
# cd /old-filesystem
# find . | cpio -pcmudv /new-filesystem
# lvremove old-filesystem.

Robert-Jan.
Fabio Ettore
Honored Contributor

Re: Move a filesystem

Hi Falco,

just create a new filesystem on VG00, almost with the same size of used space (and anything more!) and copy contents of the filesystem from VG04 to VG00 by cpio command. You can see a procedure in doc

ULVMKBRC00013032 - Moving /opt from vg00 to a new disk/volume group

I hope this helps you.

Best regards,
Ettore
WISH? IMPROVEMENT!
Stanimir
Trusted Contributor

Re: Move a filesystem

Hi!
Here is the example of moving FS with
keeping its name:

#newfs -F vxfs /dev/vg00/rlvol_X
#mkdir /filesystem_new
#mount /dev/vg00/lvol_X /filesystem_new
#cd /filesystem_old
#find . | cpio -pdumv /filesystem_new
#cd /
#rm -rf /filesystem_old/*
#umount /home_new
#mount /dev/vg00/lvol_X /filesystem_old
rmdir /filesystem_new

Regards,Stan

RAC_1
Honored Contributor

Re: Move a filesystem

As said by Robert, you can not move it.

You will have to create new one transfer your data and remove the old one.

Also exclude v option in cpio to heve a bit better performance.
There is no substitute to HARDWORK
Pete Randall
Outstanding Contributor

Re: Move a filesystem

I would suggest that you reconsider moving a file system into vg00, which should be reserved for strictly Operating System file systems. For ease of backup and recovery, your data file systems should be kept separate from your OS file systems in vg00.


Pete

Pete
Falco_1
Occasional Visitor

Re: Move a filesystem

I have executed cpio command, it seems to be succeeded but I see a difference on space used by bdf command:

# bdf | grep /data*

/dev/vg00/ldata 512000 445705 62191 88% /data.new
/dev/vg04/ldata 2097152 446099 1547902 22% /fw24

445705 for data.new
446099 for data

Then I think that something was not copied.
Anyway diff command doesn't report differences.
According to you, is it normal? Should I worry about that difference? What is causing that little gap?

Falco_1
Occasional Visitor

Re: Move a filesystem

sorry...

445705 for data.new
446099 for fw24

Re: Move a filesystem

Hi,

I believe that the reduction in size between the new and old filesystem is related to a reduction of the directory size. This occurs when you have stored a lot of files in a dir in the "old" filesystem, causing the size of the directory to increase. Later files are removed and but the directory still retains its larger size. When the directory is recreated via cpio the directory is "created from scratch" and thus "optimal" in its allocation.

Do a dircmp between the old and new to see if the two dirs are identical.

Re: Move a filesystem

You cannot move a file system. You can only create a new file system and move the contents of the old file system to the new one.

If that old file system which you want to move to vg00 is not Operating system files [accidentally created by someone], DON'T move those into vg00. Keep only OS specific file systems under vg00, which will make life easier in creating make_tape_recovery(Ignite-UX) and in a diaster recovery scenario. etc.

Thanks
Raju

Re: Move a filesystem

Hi (again...),

Just out of curiosity... Does anyone know if the following would work?:
# lvcreate -n newfs_vol /dev/vg00
# lvextend ... (same size as oldfs_vol)
# umount /oldfs
# dd if=/dev/vg04/roldfs_vol of=/dev/vg00/rnewfs_vol bs=64k
# fsck /dev/vg00/rnewfs_vol
# mount /newfs

That way it would be consistent since the source filesystem is unmounted during copy.
Robert-Jan Goossens
Honored Contributor

Re: Move a filesystem

Hi Hendrik,

Yes that would work ( small adjustement newfs and not extendfs :-)

Falco,

use dircmp to check if both filesystems are the same as in Hendrik's answer.

Regards,
Robert-Jan
Falco_1
Occasional Visitor

Re: Move a filesystem

Thanks Henrik for your explaination about the size difference between two filesystems, thanks at all....
I executed dircmp and nothing is different, then I think there are no problems.

As soon as possible I will do a reboot.

Thanks again!