How to manually mount a USB Hard Disk, including a disk that was part of a RAID1 array

From SynologyWiki
Jump to: navigation, search

This wiki shows you how to manually mount a USB Drive enclosure containing a Hard Disk. The term "mount" is the Linux term for adding a data device to a system so that its contents are navigatable. The procedure also describes the steps necessary if the Hard Drive in the USB enclosure was previously part of a working RAID 1 configuration (e.g. removed from another Synology Server). The same procedure will also probably work for RAID 0 drives, but I have not tested that.

Contents

Please Note

You will not normally need to use this wiki as the Synology Server automatically mounts USB drives when they are connected. However in some cases (such as the USB Hard Disk being from a RAID array) the Synology Server firmware will not mount the drive and state the drive format is not supported. In this instance you will need to mount the USB drive enclosure manually. This wiki was written based on my experience of removing a working RAID1 drive from a CS407 (fw 722) and placing it in a SATA USB enclosure and then connecting to a DS207+ (fw 722), but the procedure should be the same for all synology multi-bay servers and firmwares.

Assumptions

  • You know how to login as Admin on the NAS to which you are going to connect the USB disk
  • The USB Disk you are adding is already preformatted with either ext2 or ext3 (Synology products format internal drives as ext3). If the drive is not formatted or formatted as NTFS the procedure should be similar but you may need to vary some of the commands.
  • The Synology NAS to which you are connecting the USB Disk is working normally.

Procedure

  1. Ensure the NAS is powered up and running normally
  2. Connect the USB enclosure containing the Hard Disk to the NAS
  3. Enable the Command Line Interface (Telnet or SSH)
  4. Login into the Command Line Interface as "root"
  5. Check what you already have mounted in the system by entering the command "df".
  6. 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 (installed internally and via USB) listed and each partition on the disk listed. For instance your internal hard disks on a multi-bay NAS will be listed as "Disk /dev/sda" for internal disk 1 and "Disk /dev/sdb" for internal disk 2 etc. At the bottom of the list will be any externally mounted disks (e.g. via USB). On my system the UsB disk was listed as "/dev/sdk". As the disk was from another Synology NAS it had the three synology created partitions on it: sdk1, sdk2 and sdk3. But most disks will probably only have one partition "/dev/sdk1".
  7. Now we need to map the required partition of the USB disk 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, Linux doesn't use drive letters, disk are mounted as a directory instead. Before we can mount the drive we have to create the directory the mounted drive will be attached to. For temporary mounts we can create a directory under the "/mnt" directory. Hence create the directory "/mnt/usb" by entering the command "cd /mnt" and "mkdir usb".
  8. Now we mount the required partition on the USB disk (for most people it will be "/dev/sdk1") to the directory "/mnt/usb". Enter the command "mount -t ext3 /dev/sdk3 /mnt/usb" (if your disk is ext2 formatted then use ext2 instead of ext3). If your USB disk is from a working RAID1 configuration see the section "How to mount a USB enclosure containing a RAID1 disk" below.
  9. Finished, you can now use the cp or other commands to copy/move data
  10. You only created a temporary mount so if you reboot the NAS you will need to re-use the same mount command again.
  11. 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 the usb disk you will need to add an entry like "/dev/sdk /mnt/usb ext3 defaults 0 0". 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/sdk1 /mnt/usb" making sure you use the exact correct nomenclature for your circumstances as described previously.

How to mount a USB enclosure containing a RAID1 disk

If the disk in the USB enclosure was from a working RAID1 configuration you will need to use the mdadm command to attach the USB drive to an available md array before your can mount the md array.

  1. Follow the procedure above up to the point where it says to come to this section
  2. Check md identifiers of the partition you want on the USB disk are intact, e.g. enter the command "mdadm --examine --scan /dev/sdk3". mdadm should report back a single line, something like "ARRAY /dev/md2 level=raid1 num-devices=2 UUID=db7c8f07:6f0f4570:852c2e22:a378fec9". Don't worry about the "/dev/md2" this is just where it was last used. If you get an error message and are certain the disk was from a RAID1 array you won't be able to use this procedure untill you repair the partitions md identifiers. You will have to search elsewhere for how to repair identifiers.
  3. Check what md arrays are already defined using the command "mdadm --detail --scan". Alternatively for a bit more info use "cat /proc/mdstat". All multi-bay synology servers will have md0 (the OS), md1 (the swap file space), md2 (/volume1). If you have other volumes you may also have md3 (/volume2) etc.
  4. We will use the next available md array number, e.g. if the last one on the list produced in the previous step was md2 then we will attach your usb disk to "md3". Use the command "mdadm -A --verbose --run /dev/md3 /dev/sdk3". The --run option forces the making of the attaching of the array when only 1 of the original 2 RAID1 disks are available.
  5. You can now mount the "md3" array to "/mnt/usb" using the command "mount /dev/md3 /mnt/usb".

To remove the USB Disk

  1. If you modified the "/etc/fstab" file to make a permanent mount re-edit it removing the line you added.
  2. Use the command "umount /mnt/usb" where "/mnt/usb" is the directory you created above.
  3. If you attached a RAID1 USB disk use the mdadm command to stop and then remove the array, e.g. "mdadm -S /dev/md3" followed by "mdadm -r /dev/md3"
  4. Disconnect the USB drive.
  5. Delete the directory you created for the mount point, e.g. enter the command "rm /mnt/usb"
Personal tools
Community Resources