linux 开机自启动挂载windows
- 2023-02-17 05:13:55
- 来源:未知
- 在手机上看
扫一扫立即进入手机端
mount -t ntfs -o uft8 /dev/hda2 /mnt/c
mount -t vfat -o uft8 /dev/hda2 /mnt/c
手动挂载windows下的盘符 先修改文件/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).
#
#
proc /proc proc defaults 0 0
#manual-mount-add by tainy
/dev/sda5 /mnt/windows/D vfat rw,uid=1000,utf8 0 0 #要挂载的盘符
/dev/sda6 /mnt/windows/E ntfs rw,uid=1000,utf8 0 0 #要挂载的盘符
/dev/sda7 /mnt/windows/F ntfs rw,uid=1000,utf8 0 0 #要挂载的盘符
/dev/sda8 /mnt/windows/G ntfs rw,uid=1000,utf8 0 0 #要挂载的盘符
# / was on /dev/sda1 during installation
UUID=eb1d1f86-9c37-49cc-8ea0-b9e91f79542e / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=b2c7f250-627d-42ba-b6e9-e72ad17715fb none swap sw 0 0
/dev/scd1 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/scd0 /media/cdrom1 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
本次以开机自动挂载XP的分区为例:
在bash 键入fdisk -l
查看硬盘分区,如下是我的电脑分区:
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2432 19535008+ 7 HPFS/NTFS
/dev/sda2 2433 19457 136753312+ f W95 Ext'd (LBA)
/dev/sda5 2433 6688 34186288+ b W95 FAT32
/dev/sda6 6689 6934 1975963+ 82 Linux swap / Solaris
/dev/sda7 6935 8269 10723356 83 Linux
/dev/sda8 8270 10944 21486906 b W95 FAT32
/dev/sda9 10945 15200 34186288+ b W95 FAT32
/dev/sda10 15201 18980 30362818+ b W95 FAT32
/dev/sda11 18981 19457 3831471 b W95 FAT32
其后,我们编写一个shell脚本用来挂载xp的分区
#!/bin/sh
#rc.?d
sudo mount -o iocharset=utf8 /dev/sda5 /mnt/disk_D
sudo mount -o iocharset=utf8 /dev/sda8 /mnt/disk_E
sudo mount -o iocharset=utf8 /dev/sda9 /mnt/disk_F
sudo mount -o iocharset=utf8 /dev/sda10 /mnt/disk_G
sudo mount -o iocharset=utf8 /dev/sda11 /mnt/disk_H
exit 0
保存到/ect/rc0.d~rc5.d任何一个文件夹里面,这里的文件会在开机时自动运行。
就这样,一个在ubuntu下编写的开机自动运行的shell脚本就完成了!
其他编写的开机自动运行脚本都可以放在上面提到的文件夹里面!!
相关资讯
更多-
LINUX与UNIX SHELL编程指南
中文|19.1M
-
检疫镇手机版
中文|72.5M
-
国人健康馆
中文|102.4M
-
来趣拼购物app
中文|26.2M
-
决战平安京海外加速服
中文|1.92G
-
射击骑士团h5手游
中文|3.4M
-
全智能遥控管家最新版
中文|43.1M