Jump to content

Mounting a drive to a folder ubuntu


Recommended Posts

Posted

Hi

 

I had to hard drives on my ubuntu system. One was the main system drive and the other was mount to a folder on the system drive. I need to remount this drive to a folder on the system drive htdocs. How do I do this?

 

Mark

Posted

if its been setup in /etc/fstab you can just use

 

mount -a

 

to automatically remount it.

 

If it was just a manual mount, you would just type

 

mount /dev/sdb1 path/to/folder

 

Obvioulsy changing the name of the partition, and the location

  • 8 years later...
Posted (edited)

sometimes OS do not put the file system in /dev/example_partition

you need to forcefully format the using the following command.

mkfs.ext4 -F /dev/example_partition

sudo mkdir /test_folder

sudo mount /dev/example_partition /test_folder/

 

now the it will be mounted in your desired folder.

Edited by csnasir
Saved mistakenly, i was editing it
Posted

Talk about bringing back an old post!

 

Also don't run the commands above especially mkfs.ext4 unless you want to delete the data in the existing partition. This command will forcefully remove the filesystem from the disk partition and replace it with a blank ext4 filesystem!

 

If a known partition isn't appearing in the /dev filesystem, but you know it to be valid, it's likely to be either, LVM or needs the disk adapters rescanning (usually common on VMs).

 

The former LVM, run

 

pvscan

 

It will tell you if it has found any LVM volume groups, at that point you may need to enable the volume group with vgchange -ay VOLGROUPNAME. The same goes with the attached logical volumes, lvdisplay, to find current logical volumes and lvchange -ay LVNAME to enable. They should then be present in the /dev filesystem.

 

Regarding rescanning the SCSI bus run:

 

echo - - - > /sys/class/scsi_host/host0/scan

 

You may have to scan additional 'host' adapters so replace host0 as required

 

Disks and partitions should now be present in the /dev filesystem.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...