侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 中国象棋ai
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

Ubuntu系统上挂载U盘和Windows分区问题的解决实例

Windows  /  管理员 发布于 7年前   258

Ubuntu挂载U盘问题
在终端(非图形界面)挂载U盘,遇到一系列问题:

复制代码代码如下:
flc@ubuntu:~$ sudo mount -t vfat -o iocharset=utf8 /dev/sdb1 /media/udisk
mount: special device /dev/sdb1 does not exist
flc@ubuntu:/$ sudo fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00082ba2
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 61868031 30932992 83 Linux
/dev/sda2 61870078 62912511 521217 5 Extended
/dev/sda5 61870080 62912511 521216 82 Linux swap / Solaris
Disk /dev/sdb: 8011 MB, 8011120640 bytes
247 heads, 62 sectors/track, 1021 cylinders, total 15646720 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x6f20736b
This doesn't look like a partition table
Probably you selected the wrong device.
Device Boot Start End Blocks Id System
/dev/sdb1 778135908 1919645538 570754815+ 72 Unknown
/dev/sdb2 ? 168689522 2104717761 968014120 65 Novell Netware 386
/dev/sdb3 ? 1869881465 3805909656 968014096 79 Unknown
/dev/sdb4 ? 2885681152 2885736650 27749+ d Unknown
Partition table entries are not in disk order

老是说special device /dev/sdb1 does not exist,无比郁闷
我以为是前几天量产优盘,优盘的分区表搞出问题了。
又发现:

复制代码代码如下:#fdisk /dev/sda
然后输入a,确定,再输入w,确定。
接着就可以mount了。
估计

复制代码代码如下:
Device Boot Start EndBlocks Id System
/dev/sdb1 778135908 1919645538 570754815+ 72 Unknown
/dev/sdb2 ? 168689522 2104717761 968014120 65 Novell Netware 386
/dev/sdb3 ? 1869881465 3805909656 968014096 79 Unknown
/dev/sdb4 ? 2885681152 2885736650 27749+ d Unknown

是有个?这个咚咚。。。。
量产优盘,优盘分区表问题大大的有了。我当时没备份分区表,把它量产成活动的,用来做启动盘,在windows下也没什么问题,就没想到它在linux很难识别该U盘。
如果大家想量产的话,建议先纪录量产前的u盘的信息,推荐用chip genius(查看vid、vid\\序列号之类)还有PowerQuest Partition Table Editor(查看修改分区表)还有Eisoo DiskGenius(磁盘管理修复) ,备份分区表和详细信息,否则想恢复的时候可能就很麻烦。
我装了autofs服务:


复制代码代码如下:
flc@ubuntu:~$ sudo apt-get install autofs
flc@ubuntu:~$ sudo fdisk /dev/sdb
Command (m for help): a
Partition number (1-4): 1
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.


最后:

复制代码代码如下:
flc@ubuntu:~$ sudo mount -t vfat -o iocharset=utf8 /dev/sdb /media/udisk

分区不要1  ?,挂载成功!

自动挂载windows分区
如果你的电脑装了Windows/Ubuntu双系统,你该有这样的体会:当登录Ubuntu时,系统不会自动挂载Windows下的各分区,只能手动挂载。这难免有些麻烦,并在一定意义上违背了Ubuntu追求简洁的宗旨。本文将介绍如何解决这个问题,以使在登录Ubuntu的同时自动挂载Windows分区。

1.查看电脑中所有硬盘的分区情况。
命令如下:

复制代码代码如下:
sudo fdisk -l

此命令将输出类似如下的信息:

复制代码代码如下:
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf0b1ebb0</p><p> Device Boot Start End Blocks Id System
/dev/sda1 * 1 3825 30724281 7 HPFS/NTFS
/dev/sda23826 60802 457661193 f W95 Ext'd (LBA)
/dev/sda53826 16574 102406311 7 HPFS/NTFS
/dev/sda6 16575 29323 102406311 7 HPFS/NTFS
/dev/sda7 29324 54427 201647848+ 7 HPFS/NTFS
/dev/sda8 54428 54552 999424 82 Linux swap / Solaris
/dev/sda9 54552 60802 50199552 83 Linux

注:上述列表中/dev/sda1、/dev/sda5、/dev/sda6、/dev/sda7分别代表Windows中的C、D、E、F分区,并记下各分区的文件系统类型。

2.修改/etc/fstab配置文件。
命令如下:

复制代码代码如下:
sudo vi /etc/fstab

编辑此配置文件,最终其内容类似如下:

复制代码代码如下:
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc/proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda7 during installation
UUID=ac4326f1-50ad-457f-8e99-63174b97bc88 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda6 during installation
UUID=9026c543-3172-4d21-bce0-dbe595a1425d noneswap sw 0 0
#auto mount windows fs
/dev/sda1 /media/win-C ntfs nls=utf8,umask=000 0 0
/dev/sda5 /media/win-D ntfs nls=utf8,umask=000 0 0
/dev/sda6 /media/win-E ntfs nls=utf8,umask=000 0 0
/dev/sda7 /media/win-F ntfs nls=utf8,umask=000 0 0

注:末尾的5行是添加的内容。其中/dev/sda1一行代表C盘分区将自动挂载到/media/win-C目录下,文件系统为NTFS(如果步骤1中查看分区的文件系统为FAT32时,此处请写vfat),字符编码为utf8。umask表示文件目录的权限,此参数以及之后的2个参数都为0即可。以下几行以此类推。此处可以选择性的添加需要自动挂载的分区,不想挂载的分区不用书写。

3.重启电脑。
编辑、保存上述配置文件之后,请重启电脑。你将会看到系统已成功挂载Windows各分区。


  • 上一条:
    Ubuntu系统下安装Wine来运行Windows程序的方法详解
    下一条:
    Ubuntu下挂载Win7下的NFS服务器失败的两种解决办法
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • Windows 10的告别:2025年10月14日,一段时代的终结(0个评论)
    • windows 11激活_Win11 KMS激活流程步骤(1个评论)
    • 安装Windows 11系统的注意了,看看你的cpu是否在微软兼容列表排除中(1个评论)
    • 微软将于2022年9月20日推送Windows11 22H2新版本,推测2024发布windows 12(0个评论)
    • windows11系统中可以关闭禁止的服务及介绍(1个评论)
    • 近期文章
    • 在go+gin中使用"github.com/skip2/go-qrcode"实现url转二维码功能(0个评论)
    • 在go语言中使用api.geonames.org接口实现根据国际邮政编码获取地址信息功能(1个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf分页文件功能(0个评论)
    • gmail发邮件报错:534 5.7.9 Application-specific password required...解决方案(0个评论)
    • 欧盟关于强迫劳动的规定的官方举报渠道及官方举报网站(0个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf文件功能(0个评论)
    • Laravel从Accel获得5700万美元A轮融资(0个评论)
    • 在go + gin中gorm实现指定搜索/区间搜索分页列表功能接口实例(0个评论)
    • 在go语言中实现IP/CIDR的ip和netmask互转及IP段形式互转及ip是否存在IP/CIDR(0个评论)
    • PHP 8.4 Alpha 1现已发布!(0个评论)
    • 近期评论
    • 122 在

      学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..
    • 123 在

      Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..
    • 原梓番博客 在

      在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
    • 博主 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..
    • 1111 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
    • 2018-01
    • 2018-06
    • 2020-06
    • 2021-06
    • 2021-07
    • 2022-01
    • 2022-04
    • 2022-08
    • 2023-08
    • 2023-10
    • 2024-04
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客