Note, that all of these commands have to be run in a terminal as root user. To open a terminal (sometimes called a console), either press ALT+F2 and type xterm (alternatives could be konsole or terminal) or press CRTL+ALT+F1 to change to a terminal.
However the latter will take you away from your graphical environment (or your desktop), so to get back to that, use CRTL+ALT+F7 or CRTL+ALT+F5, depending on your system.
To switch to root user once a terminal window is open, type
Expand|Select|Wrap|Line Numbers
- su
Expand|Select|Wrap|Line Numbers
- exit
Expand|Select|Wrap|Line Numbers
- sudo
First of all, you can check what partitions your system recognises with
Expand|Select|Wrap|Line Numbers
- fdisk -l
The output will look something like this:
Expand|Select|Wrap|Line Numbers
- Disk /dev/hda: 40.0 GB, 40060403712 bytes
- 255 heads, 63 sectors/track, 4870 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Device Boot Start End Blocks Id System
- /dev/hda1 1 64 514048+ 82 Linux swap / Solaris
- /dev/hda2 * 65 1402 10747485 83 W95 FAT32
- /dev/hda3 1403 3978 20691720 83 Linux
- /dev/hda4 3979 4870 7164990 83 Linux
Expand|Select|Wrap|Line Numbers
- Disk /dev/sda: 40.0 GB, 40060403712 bytes
- 255 heads, 63 sectors/track, 4870 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Device Boot Start End Blocks Id System
- /dev/sda1 1 64 514048+ 82 Linux swap / Solaris
- /dev/sda2 * 65 1402 10747485 83 W95 FAT32
- /dev/sda3 1403 3978 20691720 83 Linux
- /dev/sda4 3979 4870 7164990 83 Linux
As you can see, in my case the partition hda1 or sda1 is a SWAP-Partition, hda3 and hda4 (sda3 and sda4) are Linux partitions of some kind (like ext2, ext3, reiserfs or xfs) and hda2 (sda2) is FAT32 (a windows filesystem). If you have an NTFS drive, make sure the correct drivers are installed!
Next, check which partitions are already mounted with
Expand|Select|Wrap|Line Numbers
- mount
Expand|Select|Wrap|Line Numbers
- /dev/hda4 on / type ext3 (rw,errors=remount-ro)
- proc on /proc type proc (rw,noexec,nosuid,nodev)
- /sys on /sys type sysfs (rw,noexec,nosuid,nodev)
- varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
- varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
- procbususb on /proc/bus/usb type usbfs (rw)
- udev on /dev type tmpfs (rw,mode=0755)
- devshm on /dev/shm type tmpfs (rw)
- devpts on /dev/pts type devpts (rw,gid=5,mode=620)
- lrm on /lib/modules/2.6.17-12-generic/volatile type tmpfs (rw)
- /dev/hda3 on /home type ext2 (rw)
Now, choose where the device is going to be mounted to. Normally, it's in a subdirectory of either /mnt or /media. Check, that the subdirectory exists (e.g. /mnt/c or /media/hdb2). If it doesn't, create it by using
Expand|Select|Wrap|Line Numbers
- cd /media
- mkdir hdb2
With the above information, you should be able to choose the right partition and use something like
Expand|Select|Wrap|Line Numbers
- mount /dev/hdb2 -t vfat /media/hdb2
The most commonly used partition formats are:
- autofs (automatically try to determine format)
- ext2
- ext3
- iso9660 (for CD-ROMs)
- ntfs
- reiserfs
- smbfs (for SAMBA drives)
- udf (for DVD-ROMs)
- usbfs (for some USB devices)
- vfat (for FAT16 and FAT32)
- xfs
Now, the drive will be accessible, however only root will have full access.
To make things easier, if you want to mount that drive more often, you can put it into /etc/fstab. Just open it in an editor (as root!) and add the following lines at the bottom:
Expand|Select|Wrap|Line Numbers
- # added manually
- /dev/hdb2 /media/hdb2 vfat defaults,users,noauto 0 0
If you want the drive to be mounted automatically on startup, change noauto to auto.
Then save the file and in future you'll just have to do
Expand|Select|Wrap|Line Numbers
- mount /dev/hdb2
Expand|Select|Wrap|Line Numbers
- mount /media/hdb2
More information about mounting can be found in the mount help
Expand|Select|Wrap|Line Numbers
- mount -h
Expand|Select|Wrap|Line Numbers
- man mount
Expand|Select|Wrap|Line Numbers
- info mount
Various File Systems
Here are some short descriptions of the most common file systems:
- ext2 is a file system, which was very common on linux systems for a long time. Nowadays, it is mostly replaced by ext3.
Use the format type ext2 to mount. - ext3 is a so called journaling file system. Other than that, there are very few differences to ext2.
Use the format type ext3 to mount. - ext4 is a file system, which is currently under development. It is supposed to replace ext3. As it is unfinished, I'll not go into any detail.
In future, you'll probably use the format type ext4 to mount. - XFS is one of the oldest journaling file systems available for UNIX and almost all Linux distributions, one of the few exceptions being Red Hat Enterprise Linux.
Use the format type xfs to mount. - JFS is a 64-bit journaling filesystem created by IBM. There are two generations of JFS filesystem that are called JFS (JFS1) and JFS2, however under most operating systems, such as OS/2 and Linux, only the second generation exists and is called simply JFS.
Use the format type jfs to mount. - ReiserFS (occasionally referred to as Reiser3) is a general-purpose, journaled computer file system and the first journaling file system to be included in the standard linux kernel.
Use the format type reiserfs to mount. - FAT12 / FAT16 / FAT32 are relatively straightforward file systems and are supported by virtually all existing operating systems for personal computers. They are no journaling filesystems and therefore affected by fragmentation at a much higher rate than those.
Use the format type vfat to mount. - NTFS is the standard file system of many newer Windows versions. It has several improvements over FAT, like the use of advanced data structures or it being a journaling filesystem. The support under Linux UNIX is good but not perfect, as the file system specification is a trade secret and the non-microsoft implementations are reverse engineered.
Use the format type ntfs to mount. You have to have NTFS-3G installed!