Quote:
Originally posted by katana
hello all!
i got another assignment from my lecturer...he asked me to do 3 partitions on the comp, that is linux, windows and another partition exclusively for files (data).He wants the other partitions (linux at least) to be able to read data in that data partition...
the question is, how????this is pretty weird..somebody help me out please! I know that you've got to use mounting to read non-linux files,but to read other partition's files??
do i even make sense here??help!
|
You again.
I can reccommend three items that require action.
1) Get another lecturer.
2) No. Just Kidding. It's actually a pretty common task that he has asked you to do and it's for a couple of good reasons - security, speed, redundancy are the more common benefits.[list=1][*]
security: a separate partition could be mounted ro (read only - good for static data) or append (good for log files, you can add to a file but not deleted it)[*]
speed: if you are running a web and database server and you have 3 physical devices you could use a partition on the second device for your web pages and a partition on your third device for for your database files. This way your drives to not become a bottleneck for your system performance. This won't do you much good if you are hanging a bunch of slave drives on an IDE system, but if you have a lot of IDE conrollers and channels, or bettter yet a fast/wide/ultra/etc... SCSI sysem there should be some gains seen.[*]
redundancy: you can duplicate a folder or filesystem to another directory. paraniod people like me do this when it's 3am and we need to backup a folder to a partition and unmount it to avoid tragedy.[/list=1]
But you want to know
how to do it. Since I bored you with some dry boring stuff, here's the goods. (Please read this through and understand what you are doing before you go ahead and commit to it. You can break stuff if you aren't careful and I have been known to make a mistake or two in documentation.)
Since you already have an installed system (you still do, don't you? With qpopper and stuff?) you can take one of your directories and 'move' it to another partition. You've gotta have some free space to work with. If you need to resize a partition you'll need to do some searching and reading.
The How[list=1][*]Take that free space and create a partition (i use fdisk, some folks like diskdruid). 'Mark' the partition type - we need to give the OS (linux) a clue about what kind of partition it will be. 'Linux' (type 83)might be a good choice here. Write your changes and exit fdisk.[*]format the partition. What data are you putting in the partition? Regular files in the kilobyte to megabyte and up? Lots of small files? Database records? ext2 is the old standby but many people (myself included) are using reiserfs, a journaling filesystem. Really excels when you are working with lots of small files or data uptdates. Saves space too. Read up on inode density to find out why. (You need to do
some research! readup on mk2fs and reiserfs)[*]Now we can mount the partition - i'll use /mnt for now. mount /dev/<your partition> /mnt. (I'll let the kernel sniff out which type of filesystem we used. You should readup on 'mount').[*]You can now see how much room you have on the mounted partition by using 'df -h' (free sisk space, show me in 'human' readable K/M/Gbytes)[*]Copy. [This copy routine works nice for me and I got it from the Linux RAID How To at linuxdoc.org or at the Author's web site). 'cd' to the directory you want to copy. Let's use your /home directory. 'cd /home'. 'find . -xdev | cpio -pm /mnt/' We're going to 'find' all the files from this directory down and pipe them to the 'cpio' command which will 'cp' them and keep permissions and attribues of the files the same. (Hey. Stop. When you think you know a lot just go and read the man pages for cpio. I dare you.)[*]'la /mnt' to see what stuff you've got there. Make sure all is well.[*]Now you can get out of the /home directory - 'cd /'. Log in as root (you probably already are). Unmout the /mnt folder 'umount /mnt' or 'umount /dev/<that partition you created>' Now try to mount that same partition to /home. Now let's say you made some changes to the data on this new partition which for all intents and purposes is your new home directory? What happens to your old /home directory? Mess with it, but treat everyhting you do as permanent.[*]If you haven't destroyed everything yet, you could probably go and change your /etc/fstab to mount this partition to /home every time you boot.[/list=1]
Do you need to read the Windows partition? Did you read the man pages for 'mount'?
Cheers,
mc9