[HOW TO] Access files on existing HDD w/out formatting

Share your awesome tips and tricks here.
Post Reply
phantasmnz
Posts: 54
youtube meble na wymiar Warszawa
Joined: Tue Dec 31, 2013 6:40 am

[HOW TO] Access files on existing HDD w/out formatting

Post by phantasmnz »

I own a 202-TE with only two slots. I set up one disk and had another 1T disk from a previous system with lots of my media on it. Plugged it in and, nothing.

It dawned on my that the only way to access the files would be backup, wipe, restore.... grrr....

Well, not actually. If you don't need RAID, the NAS can perfectly well see the disk (although storage manager will show it as uninitialised)

Step 1 - find the device name of the disk by running in a console session (SSH or SHellInABox log in as root with your admin password) the command fdisk - look for a disk matching the capacity and not its device name (it will be something like /dev/sda1)
Step 2 - create a mount point on an existing disk by simply creatng an empty folder (I used a folder called Disk2 in the shared folder "Media")
Step 3 - Create a custom startup script (I used the unix editor vi but any text editor hat saves unix friendly file will do) in the folder /usr/local/etc/ini.t

Call this file something like S99mount_disk2 and have it contain something like the following


##############################################################
#!/bin/sh
#
# Mounting Disk2 in /volume1/Media/Disk2....
#

case "$1" in
start)
echo "Starting mount (/dev/sda1 -> /volume1/Media/Disk2)..."
mount -o dmask=000,fmask=000,user /dev/sda1 /volume1/Media/Disk2/ &
;;
stop)
echo -n "Attempting to unmount /dev/sda1..."
umount /dev/sda1
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

exit $?
##############################################################


you will need to change the device name and mount point in the mount command to be whatever you need it to be. The mount options ensure that all users have full read/write access if this is a FAT or NTFS drive (no Unix permissions)

Note - it's worthwhile testing the mount command before writing the script by running this command in the console window directly. Also most of the script above is not really needed - but it's noce to be able to have a stop and start in a script

Step 4 make this file executable with chmod +x ./S99mount_disk2

Step 5 - test your script by running ./S99mount_disk2 from the command line (assuming you are in the /usr/local/etc/init.d folder

Step 6 if that works , reboot and your existing disk should be available in the subdiretory you set it to on reboot. you can then access it, use it and copy to/from this disk through ADM (and play content with XBMC)

TODO: a cleaner way would be to have the disk mounted in the fstab file - but this gets rewritten every boot - if anyone knows how to manipulate this then that would be a nicer fix rather than a scripted mount command

Hopefully I help someone else faced with a non-USB disk with content on it.
Post Reply

Return to “Tips & Tricks”