sâmbătă, 19 septembrie 2009

Mounting/ Unmounting hard drives and other in linux...

The situation is that you have a machine with a dual boot of Windows XP or Vista and Debian Etch, and you want to be able to access the Windows XP partition from the Debian partition. What you need to do are:

1) Find where the Windows XP or Vista partition is.

>su

>fdisk -l

You will see a list of partitions in your machine. Usually, the Windows partition will be the very first partition such as /dev/sda1.

2) Create a new directory in Debian that will be mounted to the Windows XP partition. For example, you create a new partition called windows in the /mnt directory. As root,

>cd /mnt

>mkdir windows

3) Mount the Windows XP partition to the /mnt/windows partition. As root,

>mount /dev/sda1 /mnt/windows -t ntfs -r

Now, you should be able to access the Windows XP partition (no write permission).

4) To unmount the Windows XP partition, as root,

>umount /mnt/windows

Note that using this method, you do not have “write” permission. So, you can only read and copy files from the Windows partition.

[Update: April 9, 2008] Now, I’d like to describe what I have done to gain a write access to an NTFS partition whether it is an internal or usb external harddrive.

1) Install ntfs-3g.

According to http://packages.debian.org/etch-backports/amd64/ntfs-3g/download, I first of all, edit /etc/apt/sources.list and add this site, backports.cisbg.com, to the file.

>su

enter root password

>vi /etc/apt/sources.list

Then, I add the following source url to the sources.list.

deb http://backports.cisbg.com/debian etch-backports main

Save the file and issue the following command.

>apt-get update

Then, I use Synaptic to install the ntfs-3g.

  • Desktop–>Administration–>Synaptic package manager
  • Enter root password
  • Search package using “ntfs-3g” as a key word
  • You will see three packages, ntfs-3g, libntfs-3g2 and libntfs-3gdev.
  • Select ntfs-3g package or all of them if you want.
  • After clicking “Apply” if you get errors about “cannot install some packages”, you have to change something in the Preferences as follows.
  • Still in the Synaptic Package Manager, click Settings–>Preferences–>Distribution tab.
  • Under the Package Upgrade Behavior, at the “Prefer versions from”, change “stable” to “etch-backports”
  • Click OK and then reload packages
  • If there is nothing wrong, ntfs-3g package and all its dependencies such as FUSE2 should be successfully installed.

2) Mount NTFS partition

Under root, issue the following command.

>fdisk -l

Locate the device name of the NTFS partition. For example, my usb external harddrive is /dev/sdb1, and internal harddrive is /dev/sda2.

To mount the usb exteral harddrive, I use this command

>mkdir /mnt/usb

>mount /dev/sdb1 /mnt/usb -t ntfs-3g -o force

Now, you should be able to both read and write the NTFS partition.

To unmount the partition, issue a command.

>umount /mnt/usb

Un comentariu: