LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 567|回复: 1

[zz]创建linux与window的共享分区

[复制链接]
发表于 2005-5-10 15:17:28 | 显示全部楼层 |阅读模式

file come from:http://www.linuxquestions.org/qu ... rticle&artid=41
This is to help create a functioning FAT32 (vfat) partition to be shared between your linux and windows OS's. For simplicity, i'll assume that you're using hda1 for windows, hda2 as an extended partition for linux with hda5,6 and 7 for /, /usr, and swap contained as logical sub-partitions. That's a normal setup. Now you'll want to create a new partition using fdisk. Some people seem to be afraid of this, but i find it very easy to use. First, go to the command line and as root type:

telinit s

this will take you to single user mode, which means disks aren't usually mounted and stuff like that (it's not a good idea to try and format a disk that's already mounted and in use). type:

fdisk hda

this will take you into the menu-driven fdisk program. type:

p

to list your current partitions, and take a moment to familiarize yourself with the setup. an i.d. of 83 is an ext3 linux native partition, i.d. 82 means a linux swap partition.

Now you want to create a new primary partition, with a file system type FAT32 (this can be easily accessed by both OS's) to do this, type:

n <---- create new partition
p <---- primary
3 <---- label it hda3 (3rd primary)

At this point it'll ask for first and last sector, which will default to first available sector and last available sector (take up any free space left), if you want to control the size yourself, say create a 5 gigabyte partition, accept the first default, then type +5000M

Now change the fs type with

t
c <---- this specifies vfat filesystem

and review what you've done with 'p' to make sure everything is the way you want it. If you're satisfied, use 'w' to write the partition table to disk, and exit fdisk. (WARNING: this will write the partition table to disk, make sure you haven't changed any of your old partitions)

At this point you need to format the new parition, which can be done with mkfs, although i had to download dosfsutils because slackware didn't come with mkfs.vfat (FAT32) included. If you are missing this package, try the following link to download the rpm (i'm still looking for a good source package).

http://rpmfind.net/linux/RPM/ult ... g-0.3b-8.sparc.html

Either way, in the end the command should look something like this:

mkfs -t vfat /dev/hda3
OR
mkfs.vfat /dev/hda3

Assuming that works, there's just one thing left to do: edit your /etc/fstab to automatically mount the new partition on boot. Use emacs, vi or whatever editor you're familiar with, and add the following line:

/dev/hda3 /mnt/windows defaults,umask=000 0 0

There are actually several different sets of options you could use in place of defaults, but i have this setup and it so far it works extremely well for me. Type:

mount -a or mount /dev/hda3

and presto!, you should be able to read and write to this partion from linux or windows!

Well, there you go. I apologize if that's more detail than you wanted, but it's best to have the info and not need it, than the other way around.

If anything goes wrong, or you have questions, post up.
发表于 2005-5-10 15:24:25 | 显示全部楼层
-F FAT-size
    Specifies the type of file allocation tables used (12, 16 or 32 bit). If nothing is specified, mkdosfs will automatically select between 12 and 16 bit, whatever fits better for the filesystem size. 32 bit FAT (FAT32 format) must (still) be selected explicitly if you want it.


引自mkfs.vfat(8)
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表