Web Hosting Talk







View Full Version : Commands for mounting harddrive


Tazzman
06-07-2002, 08:30 PM
I had a tech mount my second harddrive in my server recently, but I had an OS restore and need to do it again. The tech was going to send me an email with the commands I had to use using SSH to mount it, but I never received this email. I'm in a bit of a hurry with this, so any help would be appreciated. The second drives contains site backups I need to reimplement.

Noldar
06-07-2002, 08:55 PM
First you'll need a directory to mount the filesystem on. If you don't already have one, you'll need to create it:

mkdir /drive2

Then you'll need to know the device. My guess would be either hdb or hdc. You can use the dmesg command to view the kernel output from boot and look for where it assigns devices to your drives or you just try each one :)

You may need to know the filesystem type. It can usually detect the filesystem type. It's probably ext2.

Then the mount command:

mount /dev/hdb /drive2

or

mount -t ext2 /dev/hdb /drive2

Hope that helps.

Richard

Tazzman
06-07-2002, 09:24 PM
Didn't realise it was that simple. I did try this myself, only I forgot to reference the directory to mount it to. Thanks for the help.

The Prohacker
06-07-2002, 09:28 PM
Also, you may want to add the drive to /etc/fstab....

Tazzman
06-07-2002, 09:41 PM
Would this look about right if I added it to fstab (haven't as yet as I'm in the process of installing Ensim LS 3.1)

LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
LABEL=/home /home ext3 defaults 1 2
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/usr /usr ext3 defaults 1 2
LABEL=/var /var ext3 defaults 1 2
/dev/hda3 swap swap defaults 0 0
/dev/hdb1 /backups ext3 defaults 1 2

Tazzman
06-07-2002, 10:36 PM
Well, I mounted the drive successfully, sort of. I can't seen to access the folder with the website backups on it, yet I can access the folder that has the database backups on it. Here's what I'm getting in SSH:

[root@core root]# mount -t ext2 /dev/hdb1 /BACKUP
mount: /dev/hdb1 already mounted or /BACKUP busy
mount: according to mtab, /dev/hdb1 is already mounted on /BACKUP
[root@core root]# cd /BACKUP
[root@core BACKUP]# dir
databases lost+found sites
[root@core BACKUP]# cd /BACKUP/sites
bash: cd: /BACKUP/sites: No such file or directory
[root@core BACKUP]#


There must be a way to get into the 'sites' folder. It is clearly on the disk, I just can't access it. Any suggentions?

Shyne
06-07-2002, 11:09 PM
You're suppose to create the filesystem for the hard drive.

mkfs I think is the command for linux.

Tazzman
06-08-2002, 05:43 PM
yes, that is the command, pitty it wiped the directory I couldn't access and I lost all the data *SIGH*

Guess I'm spending the next few days helping people reconstruct their sites. Lucky for me there's only 10 of them and I have the mySQL databases backed up. Am I glad I don't make these people pay me, or I would be in real trouble...