Mount your widows Partitions and make it read/writable in ubuntu

本文介绍如何在Ubuntu系统中安装并配置NTFS-3G驱动,实现NTFS分区的安全读写及FAT分区的挂载。通过编辑源列表文件、导入GPG密钥等步骤,详细指导用户完成设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

This tutorial will show you how to mount NTFS and FAT partitions in ubuntu

For mounting TFS we are going to use one small tool called NTFS-3G this is very powerfull and simple tool.

The NTFS-3G driver is an open source, freely available NTFS driver for Linux with read and write support. It provides safe and fast handling of the Windows XP, Windows Server 2003 and Windows 2000 file systems. Most POSIX file system operations are supported, with the notable exception of file ownership and access right changes.

You need to edit the sources.list file using the following command

sudo gedit /etc/apt/sources.list

and add the following repositories which is suitable for you

If you are running Ubuntu Dapper enter the following lines save and exit the file

deb http://givre.cabspace.com/ubuntu/ dapper main main-all
deb http://ntfs-3g.sitesweetsite.info/ubuntu/ dapper main main-all
deb http://flomertens.keo.in/ubuntu/ dapper main main-all

If you are running Ubuntu Edgy enter the following lines save and exit the file

deb http://givre.cabspace.com/ubuntu/ edgy main
deb http://ntfs-3g.sitesweetsite.info/ubuntu/ edgy main
deb http://flomertens.keo.in/ubuntu/ edgy main

Now you need to import th GPG key for these repositories using the any one of the following command

wget http://flomertens.keo.in/ubuntu/givre_key.asc -O- | sudo apt-key add -

wget http://givre.cabspace.com/ubuntu/givre_key.asc -O- | sudo apt-key add -

Now you need to update the source list using the following command

sudo apt-get update

Install ntfs-3g in Ubuntu

If you want to install ntfs-3g run the following command from your terminal

sudo apt-get install ntfs-3g

Configuring ntfs-3g

Now you need to use the following command to determine all the available partitions

sudo fdisk -l

Now you need to configure your NTFS partitions in /etc/fstab file before doing any changes in /etc/fstab file we will take a backup of this file using the following command (Highly Recommended)

sudo cp /etc/fstab /etc/fstab.bak

Now you need to create a directory where do you mount your windows partitions in this example i ma creating windows directory

sudo mkdir /media/windows

If you want to mount /dev/hda1 is your windows partition you need to enter the following line in /etc/fstab file

/dev/ /media/ ntfs-3g defaults,locale=en_US.utf8 0 0

You need to replace your partition and mount point with your details

Example

/dev/hda3 /media/windows ntfs-3g defaults,locale=en_US.utf8 0 0

save and exit the file

If you want to mount as read only you need to enter the following line in /etc/fstabfile

/dev/hda3 /media/windows ntfs-3g ro,locale=en_US.utf8,uid=1000 0 0

If You want to change your locale option you need to run the following command in a terminal to know which one is supported by your system.

locale -a

Now if you want these new chnages to take effect there are two options one is you can simply reboot your machine and the second one is without rebooting you need to run the following commands

To unmount

sudo umount -a

To Mount

sudo mount -a

If you want to know more available options for ntfs-3g check man page

If you want to mount and unmount Windows partitions (FAT) manually, and allow all users to read and write

Follow the same procedure to get the list of your windows partitions,create a directory where do you want to mount and you do the following command from your teminal replace /dev/hda3,/media/windows/ to your environment

sudo mount /dev/hda3 /media/windows/ -t vfat -o iocharset=utf8,umask=000

If you want to mount FAT partitions on boot-up to allow users to read and write use the following command in your /etc/fstab file you can see the above procedure how to take backup of fstab file before you do any changes

/dev/hda3 /media/windows vfat iocharset=utf8,umask=000 0 0

 
在PowerShell中将Windows上的文件复制到Ubuntu可以通过多种方法实现。以下是几种常见的方法: ### 方法一:使用SCP命令 1. **安装OpenSSH客户端**:确保你的Windows系统上已经安装了OpenSSH客户端。可以通过“设置” -> “应用” -> “可选功能” -> “添加功能” -> “OpenSSH客户端”来安装。 2. **使用SCP命令**:打开PowerShell,使用以下命令将文件复制到Ubuntu: ```powershell scp -P [端口号] [本地文件路径] [用户名]@[Ubuntu主机IP]:[目标路径] ``` 例如: ```powershell scp -P 22 C:\Users\Username\Desktop\file.txt username@192.168.1.100:/home/username/ ``` ### 方法二:使用SMB共享 1. **在Ubuntu上设置SMB共享**: - 安装Samba: ```bash sudo apt update sudo apt install samba ``` - 配置Samba,编辑`/etc/samba/smb.conf`文件,添加共享目录: ```ini [shared] path = /home/username/shared available = yes valid users = username read only = no browsable = yes public = yes writable = yes ``` - 创建共享目录并设置权限: ```bash mkdir /home/username/shared sudo chown username:username /home/username/shared sudo smbpasswd -a username ``` - 重启Samba服务: ```bash sudo systemctl restart smbd ``` 2. **在Windows上映射网络驱动器**: - 打开“文件资源管理器”,右键点击“此电脑”,选择“映射网络驱动器”。 - 选择驱动器号,输入共享路径(例如:`\\192.168.1.100\shared`),点击“完成”。 - 输入Ubuntu用户的用户名和密码。 3. **复制文件**:在映射的网络驱动器中复制文件到Ubuntu。 ### 方法三:使用WinSCP工具 1. **下载并安装WinSCP**:[WinSCP官网](https://winscp.net/eng/download.php) 2. **配置WinSCP**: - 打开WinSCP,点击“新建会话”。 - 选择“SCP”作为文件协议,输入Ubuntu主机的IP地址、用户名和密码。 - 点击“登录”。 3. **复制文件**:在WinSCP界面中,将文件从Windows拖拽到Ubuntu。 ### 方法四:使用PowerShell的WSL(Windows Subsystem for Linux) 1. **启用WSL**:在PowerShell中运行以下命令: ```powershell wsl --install ``` 2. **安装Ubuntu**:从Microsoft Store安装Ubuntu。 3. **使用WSL复制文件**: - 打开PowerShell,使用以下命令将文件从Windows复制到Ubuntu: ```powershell wsl cp /mnt/c/Users/Username/Desktop/file.txt /home/username/ ``` 这些方法都可以有效地将Windows上的文件复制到Ubuntu。根据你的具体需求和环境选择最适合的方法。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值