Cloning directories and files.

Well, now that I’ve gone over preparing the new 2TB /dev/sdc1, I will go over cloning the contents of the 1TB /dev/sdb1 to /dev/sdc1.  It is easy, since /dev/sdb1 (/mnt/storage/) has just one large partition.  So, I wish to copy those directories and files over to /dev/sdc1 (/mnt/disk1), while preserving ownership, permissions, and filestamps.

First you MUST become root user.

$ cp -rp /mnt/storage/* /mnt/disk1/

It means: copy everything recursively, while preserving file attributes from /mnt/storage/ to /mnt/disk1/.  😉

Since the 1TB drive is fairly full, this will take some time to complete, but the nice part is that the server’s operation isn’t interrupted.  After the task completes, I shall unmount both drives.  Then, remove the 1TB drive, move the 2TB drive from its present bay to the (now) empty  bay, and reinstall the backup drive into its original bay.  Remount the drives, and everything is back in order.  Since the stream is ‘using’ the 1TB drive, I’ll have to temporarily stop it, and restart it when the swap is complete, as well as send a broadcast message to any users that are on the system using ftp or shell processes.

$ wall The /mnt/storage/ drive will be unavailable in five minutes.

This will send the message listed after ‘wall’ to all terminals on the system.

If you have users that ignore the broadcast, you will have to kick them out, but I will cover that at a later date, if I remember.

Leave a Reply