Thiết lập đọc ghi với các file của Windows

15 05 2008

1. Xác nhận các partition fat có thể sử dụng:

sử dụng quyền root và kiểm tra các partition:

$su
パスワード:
# /sbin/fdisk -l

Disk /dev/hda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1        2550    20482843+   7  HPFS/NTFS
/dev/hda2            2551        3825    10241437+   c  W95 FAT32 (LBA)
/dev/hda3            3826        4080     2048287+  82  Linux swap / Solaris
/dev/hda4   *        4081        6630    20482875   83  Linux
#

Trên hệ thống có W95 FAT32 là FAT,FAT32 partition và HPFS/NTFS là NTFS partition.

2. Mount fat, fat32 partition

$su             <-- rootユーザとなる
パスワード:
#mkdir /mnt/win       <-- マウント先ディレクトリを作成
# mount -t vfat /dev/hda2 /mnt/win -o umask=000

Nếu mount không có vấn đề gì thì có thể xem danh sách các file Windows bằng lệnh:

ls -la /mnt/win

Option -o umask=000 có nghĩa là tất cả các user đều có quyền đọc/ghi. Để tìm hiểu thêm bạn có thể dùng lệnh
$ man mount
Ví dụ chỉ cho phép đọc:
# mount -t vfat /dev/hda2 /mnt/win -o ro

3. Biểu thị trạng thái mount hiện tại:
# mount
/dev/hda4 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/hda2 on /mnt/win type vfat (rw)   <--今回マウントしたFAT32
#

4. Umount
# umount /mnt/win hoặc
# umount /dev/hda2

5. Thiết lập mount tự động khi máy khởi động:
$ su
パスワード:
#vim /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
devpts  /dev/pts        devpts  gid=5,mode=620  0       0
tmpfs   /dev/shm        tmpfs   defaults        0       0
proc    /proc   proc    defaults        0       0
sysfs   /sys    sysfs   defaults        0       0
#Entry for /dev/hda4 :
LABEL=/ /       ext3    defaults        1       1
/dev/hda2 /mnt/win vfat defaults,umask=000 0 0         <--今回の例
#Entry for /dev/hda3 :
LABEL=SWAP-hda3 swap    swap    defaults        0       0

Actions

Information

One response

15 05 2008
pclouds

Hơ lẽ ra phải dịch luôn mấy cái “<-ghi chú” bằng tiếng Nhật chớ :P

Leave a comment