个人工具

“UbuntuHelp:MountingWindowsPartitions”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(New page: {{From|https://help.ubuntu.com/community/MountingWindowsPartitions}} {{Languages|php5}} == Accessing the Files on Your Windows Partition == Ubuntu can read and write files on your Windo...)
 
 
(未显示3个用户的11个中间版本)
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/MountingWindowsPartitions}}
 
{{From|https://help.ubuntu.com/community/MountingWindowsPartitions}}
{{Languages|php5}}
+
{{Languages|UbuntuHelp:MountingWindowsPartitions}}
 
+
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconSambaShares.png Ubuntu is capable of reading and writing files stored on Windows formatted partitions. These partitions are normally formatted with NTFS, but are sometimes formatted with FAT32.  You will also see FAT16 on other devices.
 
+
== File System Differences ==
== Accessing the Files on Your Windows Partition ==
+
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=info.png For a more in depth analysis, see [[UbuntuHelp:LinuxFilesystemsExplained|LinuxFilesystemsExplained]], but here are some basics:
 
+
* Windows Vista, XP, 2000, older NT systems, and Windows Server 2003 and 2008 are formatted with NTFS.  
Ubuntu can read and write files on your Windows partition. Windows partitions are normally formatted as NTFS (the default for Windows Vista, XP and 2000) or, rarely, FAT32. If unsure, you can find out which format your Windows partition uses by right-clicking the partition in Windows Explorer and selecting '''Properties'''.  
+
* Older versions of Windows like Windows ME, 98, and 95 are formatted with FAT32.
 
+
* Flash drives, like your USB thumb drive or your camera's flash card are typically formatted as FAT16.
 
+
In Windows, you can check what your partition is formatted as by right-clicking the partition in Windows Explorer and selecting Properties. In Ubuntu, run from [[UbuntuHelp:UsingTheTerminal| terminal]]:
=== For NTFS partitions ===
+
 
+
Ubuntu '''7.04''' can read and write files on the NTFS drives commonly used by Windows. It is necessary to install the NTFS 3G driver [https://bugs.launchpad.net/ubuntu/+bug/108980 Reference]. Follow the steps below.
+
 
+
Ubuntu '''6.06 LTS''' and '''6.10''' came with older, beta versions of the NTFS 3G driver. These worked well for many users but were not guaranteed to be stable. Use Ubuntu 7.04 for stable access to NTFS partitions. Alternatively, a stable version of NTFS 3G for older versions of Ubuntu can be obtained from a third-party software repository - see [[UbuntuHelp:MountingWindowsPartitions/ThirdPartyNTFS3G|using a third-party NTFS 3G]].
+
 
+
'''Installing NTFS 3G Driver'''
+
* Enable the universe repository and install the '''ntfs-config''' package. See [[UbuntuHelp:InstallingSoftware|Installing Software]].
+
 
+
* Click '''Applications''' → '''System Tools''' → '''NTFS Configuration Tool'''
+
 
+
* The upcoming tool will detect NTFS partitions on your system. Check each partition you wish to access, and, if you wish to, click the mount directory to change it.  When finished, click '''Apply'''.  
+
 
+
* On the next screen '''Enable write support for internal device''' will be selected by default. Click '''OK'''.
+
 
+
Your NTFS drive will be now be available in the mount point you selected.
+
 
+
=== For FAT32 partitions ===
+
Linux uses a driver called 'vfat' to support FAT32 partitions.
+
 
+
* Create a folder where the partition will be accessed (or mounted). Default for Ubuntu is to create all filesystem mount points in the /media directory.<pre><nowiki>
+
mkdir /media/windows</nowiki></code>
+
* To automatically mount partitions at boot-up, you will need to edit the filesystem table, /etc/fstab. This is a configuration file that contains the information about all filesystems on your computer. Open the file with this command:  
+
 
+
 
<pre><nowiki>
 
<pre><nowiki>
gksudo gedit /etc/fstab
+
sudo fdisk -l</nowiki></pre>
</nowiki></code>
+
== NTFS Partitions ==
 
+
The '''ntfs-3g''' driver is used in linux to read and write NTFS partitions.
and add the following line for each FAT32 partition:
+
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconDisks.png NTFS (New Technology File System) is a file system developed by Microsoft and used by Windows computers (Windows 2000 and later).  Until 2007, linux was not able to write to this type of filesystem, it could only read from it.  The stable ntfs-3g driver now allows linux systems to read ''and'' write NTFS formatted partitions.
** <pre><nowiki>
+
The ntfs-3g packages comes pre-installed in currently supported versions of Ubuntu and most NTFS devices should work out of the box without further configuration.
/dev/hda1      /media/windows  vfat    iocharset=utf8,umask=000  0      0</nowiki></code>  
+
=== Automatic Configuration ===
* Two additional parameters are "shortname=mixed" and "user=user,group=group". The first will take care that all-caps short filenames show up in all-caps instead of in small characters. The second will take care that you are the owner of all files on the vfat partition, this will allow you to maintain file modification date/time when copying files to the FAT32 partition.
+
The <code><nowiki>ntfs-config</nowiki></code> application is a simple GUI configuration tool for those that find they need to enable/disable NTFS capabilities.
* Then run
+
==== Installing ntfs-config ====
 +
[[UbuntuHelp:apt:ntfs-config|Click here to install the ''ntfs-config'' package]] (the Universe [[UbuntuHelp:Repositories/Ubuntu|repository]] must be enabled). Alternatively, you can search for "ntfs-config" in [[UbuntuHelp:SynapticHowto| Synaptic]] or install via terminal:
 
<pre><nowiki>
 
<pre><nowiki>
sudo mount -a
+
sudo apt-get install ntfs-config
</nowiki></code> to mount all the partitions.
+
</nowiki></pre>
 
+
==== Using ntfs-config ====
Your FAT32 drive will be now be available in the mount point you selected.  
+
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=navigate.png Launch '''NTFS Configuration Tool''' from Applications->System Tools, or via the terminal:
 +
<pre><nowiki>
 +
gksudo ntfs-config</nowiki></pre>
 +
https://help.ubuntu.com/community/MountingWindowsPartitions?action=AttachFile&do=get&target=ntfs-config.png
 +
If you have at least one internal NTFS partition, it will allow you to check both boxes, otherwise you can only check the box for external devices.
 +
If your NTFS partition(s) are not yet configured, it will ask you to choose a name that will be used as the mount point (please no spaces).  Then enable write support for internal and/or external devices.
 +
=== Manual Configuration ===
 +
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconGNOMETerminal.png First you need to find the device location of the NTFS partition(s) you want to mount.  In terminal, run:
 +
<pre><nowiki>
 +
sudo fdisk -l | grep NTFS | awk '{print $1}'</nowiki></pre>
 +
The name of each partition should be something like /dev/hd'''xn''' or /dev/sd'''xn''', where '''x''' is an alphabetical letter (ranges from a to z) and '''n''' is a number (e.g. /dev/hda1).
 +
If the drive is internal, you will now need to edit your [[UbuntuHelp:Fstab| file systems table]] configuration file, <code><nowiki>/etc/fstab</nowiki></code>.  If the drive is an external USB or firewire drive, hal should automount it.  Now, be sure to save a backup of fstab first, then open the file for editing:
 +
<pre><nowiki>
 +
sudo cp /etc/fstab /etc/fstab.orig
 +
gksudo gedit /etc/fstab</nowiki></pre>
 +
After entering your password, find the line that matches the device location you just found and change it to the following. If there is no entry yet, add a new line like the following:
 +
<pre><nowiki>
 +
<your partition> /media/<mount point> ntfs-3g defaults,locale=en_US.utf8 0 0</nowiki></pre>
 +
NOTE: If it displays your NTFS partition with a [[UbuntuHelp:UsingUUID| UUID]], you can check the relevant device location by running one of the following commands.  It is OK (and even advisable) to keep the UUID setup if that is what already exists.
 +
<pre><nowiki>
 +
sudo blkid
 +
ls -l /dev/disk/by-uuid/</nowiki></pre>
 +
Replace <your partition> with the name of the partition you identified earlier. Replace <mount point> with the location you would like the partition to be mounted at, so you have something like <code><nowiki>/media/windows</nowiki></code> or <code><nowiki>/media/documents</nowiki></code> for that column.
 +
Note: you can also change your locale option (ex: locale=fr_FR.utf8). Execute <code><nowiki>locale -a</nowiki></code> in a terminal to know which ones are supported on your system.
 +
Save and close the file.  You will now need to create the mount point for each NTFS partition before you can actually mount them:
 +
<pre><nowiki>
 +
sudo mkdir -p /media/<mount point></nowiki></pre>
 +
Now remount each partition with
 +
<pre><nowiki>
 +
sudo umount <your partition>
 +
sudo mount -a</nowiki></pre>
 +
If you want to revert to your previous configuration, run:
 +
<pre><nowiki>
 +
sudo mv /etc/fstab.orig /etc/fstab
 +
sudo umount /media/<mount point></nowiki></pre>
 +
=== Known Issues ===
 +
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=stop.png The present limitations of this driver are:
 +
* writing files encrypted or compressed at the filesystem level (does not include .zip, .gz, .rar files since they are compressed on the file, not the file system level)
 +
* changing NTFS file ownership and access rights
 +
==== Custom Kernel ====
 +
'''''It is unknown if this issue still exists.  Please remove this line if you can confirm that it does.'''''
 +
If you compiled your own kernel, you probably will not have '''fuse''' installed. You can get the source with
 +
<pre><nowiki>
 +
sudo apt-get install fuse-source</nowiki></pre>
 +
and have a look at '''/usr/share/doc/fuse-source/README.Debian''' for instructions on how to compile it.
 +
== FAT32 and FAT16 Partitions ==
 +
The '''vfat''' driver is used in linux to read and write FAT32 and FAT16 partitions.
 +
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=terminal.png To mount a FAT partition from terminal, first locate the device you want to mount using the <code><nowiki>fdisk</nowiki></code> command above, create the mount point, then use the <code><nowiki>mount</nowiki></code> command.
 +
==== Generic Template ====
 +
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=example.png Here is the format for mounting a FAT formatted device:
 +
<pre><nowiki>
 +
sudo mkdir <mount_point>
 +
sudo mount -t vfat -o defaults,user,exec,uid=1000,gid=100,umask=000 <device> <mount_point></nowiki></pre>
 +
==== Solid Example ====
 +
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconExample48.png Let's say that using the <code><nowiki>fdisk</nowiki></code> command reveals that you want to mount '''/dev/sdb1''' - run:
 +
<pre><nowiki>
 +
sudo mkdir /media/fat_partition
 +
sudo mount -t vfat -o defaults,user,exec,uid=1000,gid=100,umask=000 /dev/sdb1 /media/fat_partition</nowiki></pre>
 +
=== Mounting at Boot ===
 +
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconComputer.png To mount a partition automatically at boot time, you will need to add an entry to <code><nowiki>/etc/fstab</nowiki></code> - for more information on that, see [[UbuntuHelp:Fstab|Fstab]].  For an example of adding a FAT partition, see '''Section 2.1: "More Examples of Entries"''' on that page.  The first example there uses the same options as above, and tends to work best for most users.  That page has information on '''Editing fstab''', so you just want to add a new line for your FAT partition if an entry does not already exist.
 +
Don't forget to mount all the entries in <code><nowiki>/etc/fstab</nowiki></code> after you edit the file, save and close it.  This can be achieved simply by running:
 +
<pre><nowiki>
 +
sudo mount -a</nowiki></pre>
 +
== Other Resources ==
 +
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconBook-small.png
 +
* [http://ntfs-3g.org/releases.html ntfs-3g homepage]
 +
* [[UbuntuHelp:Fstab|Fstab]]
 +
* [[UbuntuHelp:LinuxFilesystemsExplained|LinuxFilesystemsExplained]]
 +
* [http://ubuntuforums.org/showthread.php?t=283131 How to fstab]
 
----
 
----
CategoryDocumentation CategoryCleanup
+
[[category:CategoryBootAndPartition]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2010年5月19日 (三) 23:27的最新版本


IconsPage?action=AttachFile&do=get&target=IconSambaShares.png Ubuntu is capable of reading and writing files stored on Windows formatted partitions. These partitions are normally formatted with NTFS, but are sometimes formatted with FAT32. You will also see FAT16 on other devices.

File System Differences

IconsPage?action=AttachFile&do=get&target=info.png For a more in depth analysis, see LinuxFilesystemsExplained, but here are some basics:

  • Windows Vista, XP, 2000, older NT systems, and Windows Server 2003 and 2008 are formatted with NTFS.
  • Older versions of Windows like Windows ME, 98, and 95 are formatted with FAT32.
  • Flash drives, like your USB thumb drive or your camera's flash card are typically formatted as FAT16.

In Windows, you can check what your partition is formatted as by right-clicking the partition in Windows Explorer and selecting Properties. In Ubuntu, run from terminal:

sudo fdisk -l

NTFS Partitions

The ntfs-3g driver is used in linux to read and write NTFS partitions. IconsPage?action=AttachFile&do=get&target=IconDisks.png NTFS (New Technology File System) is a file system developed by Microsoft and used by Windows computers (Windows 2000 and later). Until 2007, linux was not able to write to this type of filesystem, it could only read from it. The stable ntfs-3g driver now allows linux systems to read and write NTFS formatted partitions. The ntfs-3g packages comes pre-installed in currently supported versions of Ubuntu and most NTFS devices should work out of the box without further configuration.

Automatic Configuration

The ntfs-config application is a simple GUI configuration tool for those that find they need to enable/disable NTFS capabilities.

Installing ntfs-config

Click here to install the ntfs-config package (the Universe repository must be enabled). Alternatively, you can search for "ntfs-config" in Synaptic or install via terminal:

sudo apt-get install ntfs-config

Using ntfs-config

IconsPage?action=AttachFile&do=get&target=navigate.png Launch NTFS Configuration Tool from Applications->System Tools, or via the terminal:

gksudo ntfs-config

MountingWindowsPartitions?action=AttachFile&do=get&target=ntfs-config.png If you have at least one internal NTFS partition, it will allow you to check both boxes, otherwise you can only check the box for external devices. If your NTFS partition(s) are not yet configured, it will ask you to choose a name that will be used as the mount point (please no spaces). Then enable write support for internal and/or external devices.

Manual Configuration

IconsPage?action=AttachFile&do=get&target=IconGNOMETerminal.png First you need to find the device location of the NTFS partition(s) you want to mount. In terminal, run:

sudo fdisk -l | grep NTFS | awk '{print $1}'

The name of each partition should be something like /dev/hdxn or /dev/sdxn, where x is an alphabetical letter (ranges from a to z) and n is a number (e.g. /dev/hda1). If the drive is internal, you will now need to edit your file systems table configuration file, /etc/fstab. If the drive is an external USB or firewire drive, hal should automount it. Now, be sure to save a backup of fstab first, then open the file for editing:

sudo cp /etc/fstab /etc/fstab.orig
gksudo gedit /etc/fstab

After entering your password, find the line that matches the device location you just found and change it to the following. If there is no entry yet, add a new line like the following:

<your partition> /media/<mount point> ntfs-3g defaults,locale=en_US.utf8 0 0

NOTE: If it displays your NTFS partition with a UUID, you can check the relevant device location by running one of the following commands. It is OK (and even advisable) to keep the UUID setup if that is what already exists.

sudo blkid
ls -l /dev/disk/by-uuid/

Replace <your partition> with the name of the partition you identified earlier. Replace <mount point> with the location you would like the partition to be mounted at, so you have something like /media/windows or /media/documents for that column. Note: you can also change your locale option (ex: locale=fr_FR.utf8). Execute locale -a in a terminal to know which ones are supported on your system. Save and close the file. You will now need to create the mount point for each NTFS partition before you can actually mount them:

sudo mkdir -p /media/<mount point>

Now remount each partition with

sudo umount <your partition>
sudo mount -a

If you want to revert to your previous configuration, run:

sudo mv /etc/fstab.orig /etc/fstab
sudo umount /media/<mount point>

Known Issues

IconsPage?action=AttachFile&do=get&target=stop.png The present limitations of this driver are:

  • writing files encrypted or compressed at the filesystem level (does not include .zip, .gz, .rar files since they are compressed on the file, not the file system level)
  • changing NTFS file ownership and access rights

Custom Kernel

It is unknown if this issue still exists. Please remove this line if you can confirm that it does. If you compiled your own kernel, you probably will not have fuse installed. You can get the source with

sudo apt-get install fuse-source

and have a look at /usr/share/doc/fuse-source/README.Debian for instructions on how to compile it.

FAT32 and FAT16 Partitions

The vfat driver is used in linux to read and write FAT32 and FAT16 partitions. IconsPage?action=AttachFile&do=get&target=terminal.png To mount a FAT partition from terminal, first locate the device you want to mount using the fdisk command above, create the mount point, then use the mount command.

Generic Template

IconsPage?action=AttachFile&do=get&target=example.png Here is the format for mounting a FAT formatted device:

sudo mkdir <mount_point>
sudo mount -t vfat -o defaults,user,exec,uid=1000,gid=100,umask=000 <device> <mount_point>

Solid Example

IconsPage?action=AttachFile&do=get&target=IconExample48.png Let's say that using the fdisk command reveals that you want to mount /dev/sdb1 - run:

sudo mkdir /media/fat_partition
sudo mount -t vfat -o defaults,user,exec,uid=1000,gid=100,umask=000 /dev/sdb1 /media/fat_partition

Mounting at Boot

IconsPage?action=AttachFile&do=get&target=IconComputer.png To mount a partition automatically at boot time, you will need to add an entry to /etc/fstab - for more information on that, see Fstab. For an example of adding a FAT partition, see Section 2.1: "More Examples of Entries" on that page. The first example there uses the same options as above, and tends to work best for most users. That page has information on Editing fstab, so you just want to add a new line for your FAT partition if an entry does not already exist. Don't forget to mount all the entries in /etc/fstab after you edit the file, save and close it. This can be achieved simply by running:

sudo mount -a

Other Resources

IconsPage?action=AttachFile&do=get&target=IconBook-small.png