Debianhelp.co.uk

Mount and Umount in Debian

Mounting  and unmounting Hard disk, Floppy and CDROM Drive

Mounting Hard disk Under debian

Create a directory where you'll mount the new disk, for example /new-disk, and mount it there

#mkdir /new-disk

#mount -t ext2 /dev/hdb1 /new-disk

If the new disk will have more than one Linux partition, mount them all under /new-disk with the same organization they'll have later.

Example. The new disk will have four Linux partitions, as follows:

/dev/hdb1: /
/dev/hdb2: /home
/dev/hdb3: /var
/dev/hdb4: /var/spool

Mount the four partitions under /new-disk as follows:

/dev/hdb1: /new-disk
/dev/hdb2: /new-disk/home
/dev/hdb3: /new-disk/var
/dev/hdb4: /new-disk/var/spool

Unmount Hard Disk Under Debian

#umount /new-disk

Mounting Floppy Under Debian

Create a directory where you'll mount the new disk, for example /floppy, and mount it there

#mkdir /floppy

#mount -t vfat /dev/fd0 /floppy

Unmount Floppy Under Debian

#umount /floppy

Mounting CDROM Drive Under Debian

As a simple demonstration, we'll go through mounting a CD-ROM, such as the one you may have used to install Debian. You'll need to be root to do this, so be careful; whenever you're root you have the power to mess up the whole system, rather than just your own files. Also, these commands assume there's a CD in your drive; you should put one in the drive now.

 su

If you haven't already, you need to either log in as root or gain root privileges with the su (super user) command. If you use su, enter the root password when prompted.

 ls /cdrom

See what's in the /cdrom directory before you start. If you don't have a /cdrom directory, you may have to make one using

mkdir /cdrom.

 mount

Typing simply mount with no arguments lists the currently mounted filesystems.

 mount -t iso9660 CD device /cdrom

For this command, you should substitute the name of your CD-ROM device for CD device in the above command line. If you aren't sure, /dev/cdrom is a good guess since the install process should have created this symbolic link on the system. If that fails, try the different IDE devices: /dev/hdc, etc. You should see a message like:

mount: block device /dev/hdc is write-protected, mounting read-only

The -t option specifies the type of the filesystem, in this case iso9660. Most CDs are iso9660. The next argument is the name of the device to mount, and the final argument is the mount point. There are many other arguments to mount; see the manual page for details.

Unmount CDROM Drive in Debian

#umount /cdrom