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).
#
# <file system><mount point><type><options><dump><pass>
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腳本就完成了!
其他編寫的開機自動運行腳本都可以放在上面提到的文件夾裡面!!