Home > Linux HOWTOs > Installing And Sharing HDD Partition via SSH

Installing And Sharing HDD Partition via SSH

Ever wondered how to install and share your new hard drive with ssh over the internet? Here’s how to do it on Ubuntu Server 10.04 LTS.

  • Format the drive to FAT32 or NTSC if you’re going to use it for files larger than 4GB.
  • Connect your hard drive to the server
    don’t forget to turn it off first when installing an internal drive, if it’s a usb just plug it in.
  • Next we need to check which device is the new hdd.

sudo fdisk -l

Disk /dev/sda: 82.3 GB, 82348277760 bytes
255 heads, 63 sectors/track, 10011 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000d57d

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        9921    79687680   83  Linux
/dev/sda2            9921       10012      728065    5  Extended
/dev/sda5            9921       10012      728064   82  Linux swap / Solaris

Disk /dev/sdc: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000413e2

Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1      182401  1465136001    7  HPFS/NTFS

In the list above we see that the device /dev/sdc1 is the one we want to mount.

Now that we know which device we’re going to use, we need to create the directory (mount location). After that we’re going to mount the /dev/sdc to that location. So when we enter the newly created dir it’s going to have the contents of the drive.

sudo mkdir /mnt/wd15
sudo vi /etc/fstab

add the following line in the fstab file

/dev/sdc1       /mnt/wd15       ntfs-3g defaults,locale=en_US.utf8      0       0

sudo mount /mnt/wd15

Now we’ve mounted /dev/sdc1 (our external drive) to /mnt/wd15. Every time system starts up the hdd will auto mount.

You’re about to be done, just mount the drive on your ubuntu desktop.
Just go to PLACES -> CONNECT TO SERVER -> service type=ssh, server=<<your_ip>>,port=22(default),folder=/mnt/wd15, name=<<username>>,BookmarkName=<<name_of_the_drive>>(optional)

Trouble shooting:
If you get the shared key error just delete it from ~/.ssh/known_hosts on the client machine or delete the file itself.

Advertisement
Categories: Linux HOWTOs
  1. May 16, 2011 at 1:00 pm | #1

    This is awesome but i would like connect to that server from a windows computer, do you know how to do that ?

    • vityobug
      May 16, 2011 at 1:09 pm | #2

      You need to install the samba daemon and add the partition to the configuration so you will see it as a windows share.

      • May 16, 2011 at 1:11 pm | #3

        But I would like to do it ower internet:p

      • vityobug
        May 16, 2011 at 1:24 pm | #4

        Sure you can. You can do it the same way you do it locally, by setting up a VPN server on the host. I use openvpn or just use filezilla to access files by ssh / more secure /

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.