I will visit a client's industry location for a few hours and have to copy the data from his mongoDB server. The data is currently above 800gb in size. I tried to replicate the data remotely but it is very slow, and hence I will visit the physical location to clone the data. Few options I found are LVM, mongodump, mongoexport, and until now LVM seems the best option. Is there a js query that can solve this situation or what might be the best course of action for this? Thanks.

  • What is the operating system? It seems to be Linux. – Mircea Vutcovici Oct 9 at 17:58
  • Yes it is Linux. – Rahul jyoti nath Oct 9 at 17:59
  • What distribution? and which version? – Mircea Vutcovici Oct 9 at 18:01
  • I am not sure. I will only get to know when I am there. Is there a generic solution where the distribution and version does not matter? – Rahul jyoti nath Oct 9 at 18:03
  • You need to know if the data is on LVM. Also you need to know if you need to copy the data online, or you can take the volume offline. – Mircea Vutcovici Oct 9 at 18:11

Make a mirror partition or disk as a LVM PV (physical volume) and make sure both are in sync. Then just take out one of the disks with you.

Before doing any changes in production, experiment with 2 VMs. One that is the "local VM" and another that is "client VM". Have a disk volume that you detach from the first VM with the mirror, then attach it to the 2nd VM. Document all steps and all troubleshooting steps.

By LVM I mean Linux device mapper based Logical Volume Manager

If the mongodb data is not on LVM, or speed is most important limiting factor and you can take the disks offline, you can:

  • stop all services using any partition/volume from the volume you want to mirror
  • unmount all partitions from the disk you need to copy or at least the mongodb one
  • copy using dd if=/dev/sdX of=/dev/sdY, where sdX is the source disk and sdY is the destination disk. Make sure you understand the dd command and what a block device is before using it blindly.
  • I have an external hard drive that I will take with me to the location. And I will have a few hours in my hand. Will this time be enough to make the mirror partition LVM ? – Rahul jyoti nath Oct 9 at 18:05
  • You need USB3.0 but, if possible, take the disk out of enclosure and attach it to a SATA interface. It should take be enough 2h, but depends on a lot of factors. Also check --minrecoveryrate option. – Mircea Vutcovici Oct 9 at 18:10
  • Thank you very much. – Rahul jyoti nath Oct 9 at 18:15
  • Yes we can take the disks offline during that time as it will be closed hours. I think unmounting and copying the data would be the best option. – Rahul jyoti nath Oct 9 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.