How to add a second pre-formatted drive to your NAS to copy data from/to
Jump to navigation Jump to search
|This page aims to show you how to add a drive that has already been formatted elsewhere (in my case it was a RAID1 drive removed from a DS-207+ and installed in a CS-407). My reason for doing this was I wanted to copy the data from the DS-207+ onto a disk in the CS-407 ASAP. I could have copied it over ethernet (but that takes ages - 1TB), and I could have used external storage but I didn't have any big enough).|
- You know how to login as Admin on the NAS in which you are going to install the disk
- The Disk you are adding is already preformated with either ext2 or ext3 (Synology products format internal drives as ext3).
- The disks you already have installed are in logical sequence with no gaps. e.g. if you have a CS-407 (it has 4 disk bays) with two disks installed they are installed as Disk1 and Disk2, not Disk1 and Disk3 or Disk4. It may work if they are not in logical sequence but I don't know Linux well enough to know for sure.
- Turn off NAS and install the drive in an empty disk bay
- Power up the NAS and enable the Command Line Interface (Telnet or SSH)
- Login into the Command Line Interface as "root"
- Check what you already have mounted in the system by entering the command "df". Several things will be listed but we are only interested in the "/volume" entries in the very right hand column of the table that is displayed. Everyone should have "/volume1" and depending on how you have your current disks configured you could have "/volume2", "/volume3" etc etc. take note of the last volume number and hence the next free volume number. In my case I had a "/volume1" but NOT "/Volume2". Hence for me "/Volume2" was not being used and this is where this example will load the new drive. If you have "/volume2" or more in your system you need to use the next free volume for all commands given below.
- Now we check that the new drive is being recognised, enter the command "fdisk -l" thats a lower case L not a 1. You will see each installed disk listed and each partition on the disk listed, e.g. Disk1 will be shown as "/dev/sda", with disk2 as "/dev/sdb", disk3 (if you have one) as "/dev/sdc" etc. Disk1 being a synology formated disk will have 3 partions shown as "/dev/sda1", "/dev/sda2" and "/dev/sda3". In my case the disk I added was disk2, hence is shown as "/dev/sdb". The disk I added ("/dev/sdb") was also a synology formated disk and hence has partitions "/dev/sdb1", "/dev/sdb2" and "/dev/sdb3". On a synology formated disk the first two partitions are Synology System partions, the third partion is where the user data (shared folders) are held.
- Now we need to map the data partion to a directory on the NAS root "/". For windows users the Linux "mount" command makes data on the mounted partition appear in a directory in the operating system root directory. Before we can mount the drive we have to create the directory the mounted drive will be attached to. From the step above the next free volume number I had was "/volume2". Hence create the directory by entering the commands "cd /" and "mkdir volume2".
- Now we mount the required partition to directory "/volume2". However although the partition "/dev/sdb3" is the one we want to attach we represent it using "/dev/hdb3". Hence we now need to enter the command "mount -t ext3 /dev/hdb3 /volume2" (if your disk is ext2 formatted then use ext2 instead of ext3). Also note we are mounting "hdb3", not "sdb3".
- Finished, you can use the cp or other commands to copy/move data
- You only created a temporary mount so if you reboot the NAS you will need to re-use the same mount command again.
- If you want to mount the Disk permanently you need to modify the "/etc/fstab" file using vi using the command "vi /etc/fstab". For the example above, i.e. we want to mount disk2, you will need to add an entry like "/dev/hdb /volume2 ext3 defaults 0 0" where the "b" of "hdb" represents disk2, "hdc" would be disk3 and "hdd" disk4, etc. If you need help using vi see Basic commands for Linux VI Editor. Note in the fstab file we are describing the format and way we want the OS to handle the disk, so you don't specify the partition numbers. After modifying the fstab file. You use different options in the mount command, i.e. without the "-t" and "ext3" options. Hence enter something like "mount /dev/hdb3 /volume2" making sure you use the exact correct nomenclature for your circumstances as described previously.
To remove the Disk
- If you modified the "/etc/fstab" file to make a permanent mount re-edit it removing the line you added.
- Shutdown the NAS and remove the drive.
- When you reboot the NAS you can delete the directory you created for the mount point.