[Durham] copying files from drive to drive
Richard Mortimer
richm at oldelvet.org.uk
Thu Jul 19 16:46:25 UTC 2012
On 19/07/2012 17:19, Andrew Glass wrote:
> Hi Richard
>
> Thank you for a wonderfully detailed reply :) Much appreciated.
>
> Just to confirm, Im copying about 600gig of data to a 1tb drive. so /dev/sdb1 to /dev/filerserver/share then im going to add sdb1 to the lvm group to make a 2tb pot.
If you have about 400 gig of free space then the rsync solution might be
the best option.
mkdir /tmp/oldcontents
mount -o ro /dev/sdb1 /tmp/oldcontents
mkdir /tmp/newcontents
mount /dev/filerserver/share /tmp/newcontents
rsync -vau /tmp/oldcontents/ /tmp/newcontents
when it has finished you may find that there is a subdirectory
newcontents called oldcontents. If so then you just need to move
everything back now a level. I think (untested) that the trailing slash
on /tmp/oldcontents/ should stop that extra level getting created but I
can never remember the rules for when you should put a trailing slash in
the rsync commandline.
Richard
P.S. Don't forget to Cc all.
>
> Once thats done my plan is to export the vg and install proxmox vm centre onto a seperate hard drive and attach the lvm store to proxmox.
>
> Im sorry if my description is not very clear however Im just running through my plan and wondered for your comments please?
>
> Cheers
>
> Andy
>
>
> On 19 Jul 2012, at 17:13, Richard Mortimer wrote:
>
>>
>>
>> On 19/07/2012 16:42, Andrew Glass wrote:
>>> Hey
>>>
>>> Could you help me please?
>>>
>>> Im in the process of building an LVM store however I need to copy every folder from a normal ext4 drive to the LV. What would you say would be the best way to do this? Never done it before.
>>
>> First off make sure that you don't overwrite the old drive. Double check your commandlines before you press return!
>>
>> Method 1
>> --------
>>
>> If you know that your new LVM is bigger than the original then you can do a full low-level copy of the filesystem.
>>
>> sudo dd if=/dev/sdorig1 of=/dev/sdnew1 bs=16M
>>
>> replace sdorig1 with the name of your old partition i.e. sda1
>> and sdnew1 with the new one i.e. /dev/mapper/blah-newdrive
>>
>> Once you have copied the whole lot across then use resize2fs (maybe with an fsck before you start) to ensure that the disk fills the whole partition.
>>
>> sudo resize2fs /dev/mapper/blah-newdrive
>>
>>
>> Method 2
>> --------
>>
>> Using rsync at a file by file level.
>>
>> First off mount both old and new filesystems.
>>
>> With this method you can mount the old filesystem readonly to stop it being mistakenly changed.
>>
>> Then use
>>
>> sudo rsync -vau /mnt/oldfs /mnt/newfs
>>
>> That will copy things across file by file. You can repeat the command as often as you like and it will only copy changed files.
>>
>> Richard
>>
>>
>>
>>
>>>
>>> Cheers
>>>
>>> Andy
>>> _______________________________________________
>>> Durham mailing list - Durham at mailman.lug.org.uk
>>> https://mailman.lug.org.uk/mailman/listinfo/durham
>>> http://www.nelug.org.uk/
>>>
>
More information about the Durham
mailing list