Accessing different partitions

How do you access and copy files to different partitions?

I have a dual boot system, one harddrive for Windows and one for Linux (10 gig). I am using the KDE environment (Linux Mandrake 6.5).

I have different partitions, e.g. hdb1,hdb5, hdb6, hdb7, hdb8, hdb9

When I originally installed linux, I installed the following partitions:
/     1 gig
/home 3 gig
/var  2 gig
/usr  2 gig
/tmp  1 gig
swap 128k

Now I want to be able to install programs and data files where I have the most space but do not understand the system of directories. In Windows each partition is C:, D:, etc.
but in Linux it is alway /, /usr, /home, etc. and when you change to a different user it is /home/usr.

I need to understand how the /hdb1, /hdb5, etc partitions relate to these directories and how to control them so I put programs where they should go, data files where they should go, local user files where they should go, etc.

Have seen explanations of some of this but nothing tied together so I could understand it in terms of the above.
elmendorAsked:
Who is Participating?
 
vl9Connect With a Mentor Commented:
In UNIX, different partitions (even different disks)
appear as a part of the single file hierarchy starting
with /. After you're done with the installation, you
can forget about hdb1,hdb5,hdb6 etc. For example, to
copy a file from your current directory to the directory
/home/projects all you do is

$ cp <FILE> /home/projects

Your current directory may be on a different partition
than /home/projects, it doesn't matter.


 
0
 
EatEmAndSmileCommented:
You're confused because you're noit used to the "flat" UNIX filesystem. In UNIX, every device is a file or directory. There's no C: D: or whatever. Your partitions, like root (/), /home and /usr are all independent, but they fit in the yerarchy, being accessed just like they were located in the same partition. These are called filesystems.

 For a better visualization of the thing, you can try the "df" command. It will show you all mounted filesystems and their usage.
0
 
psimationCommented:
Like EatEmAndSmile said, Linux partitions created at setup will be accessed via the directories you allocated to them.
If we look at your case, hdb1 etc, the naming works like this:
in DOS you have A,B, C D etc. for drives, Normally your primary master IDE device is called C:, your primary slave is called D, etc.
With Linux, your primary master IDE device is hda, primary slave is hdb, secondary master is hdc and secondary slave hdd.
The numbers, as in hdb1, hdb5 etc, shows to the different partitions on that one physical drive, therefore, on your 10G harddrive, which is by its name connected as your primary slave drive, has 6 partitions, all except the partition that you created as a swap partition, will be accessable in Linux via their respective MOUNT POINTS, being /, /home, /usr etc.
You can even allocate one entire disk, say your secondary master(hdc with 0ne partition, hdc1) as a single mount point (directory), say, /personal.
You didn't ask this in your question, but i will list here how to access your Windows files under linux.
From your data (hdb), I would deduct that you have another hard drive(hda) on your system for Windows. If you have only one partition on that disk, that partition will be called hda1 under linux, subsecuent partitions will be hda2, hda3 etc.
Linux will not automatically MOUNT this drive, you will have to do it manually each time, or add it to the /etc/fstab file to do so each time you boot.
To do it manually, first create a new mount point for the disk( thus create a directory somewhere on your drive (in Linux of course), I usually create one called windows in the /mnt directory.
Now, from the terminal window, type the following, all in lower case.
mount /dev/hda1 -t vfat /mnt/windows
when you brows to that directory, your windows drive's files will all be visible. To unmount the drive,
umount /mnt/windows
(NB, umount, not unmount)
if you would like your windows drive to automatically be mounted everytime you start linux, go to the /etc directory, open the file fstab with your editor of choice.
There will already be a couple of entries.
this is a simple example ...
/dev/hda6 /      ext2 defaults 11
/dev/hda1 /boot      ext2 defaults 11
/dev/fd0  /mnt.floppy ext2 noauto,owner 0 0
now add
/dev/hda1 /mnt/windows vfat defaults 1 1
(space your entry to fit with the layout...)
If you have 2 CD-Roms, Linux won't automatically create a mount point for it. If your 2nd CD-ROM is your secondary Master device, it will be /dev/hdc, note, you will not say hdc1, for the cdrom won't have a partition.
then you will again create a mount point, say, /mnt/cdrom2
then add
/dev/hdc /mnt/cdrom2 iso9660 noauto,owner,ro 00
what this file does is to create a link between a device (/dev/hdc---> cdrom) and a mount point on your file system, telling linux what type of file system it should use, ext2 = Linux file system, not readable by windows.
vfat = fat16/32 (normal windows file system)
iso9660= most widely used cd-rom file system.

Another handy thing to do ( if you transfer file to and from a windows PC regularly, is to change the file system type for your floppy (/dev/fd0) to msdos.
You will notice that your cdrom and floppy device says noauto, that is to prevent Linux from mounting a disk at startup, mainly because you normally won't have any media in the drives at start up.Don't change this except if you have a good reason, like always using one particular cd-rom on your system/network, and never really remove it.
You should also make a note of unmounting devices. You will see that when you mount a cdrom, the tray won't eject when you press the eject button, you MUST unmont it first (umount /*mountpoint* )
This is very important to remember, specially when working with floppies, floppy drives don't have a software lock function, so if you just remove a floppy and you suddenly get strange error messages, try the umount /mnt/floppy command first before calling for help:)
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
elmendorAuthor Commented:
According to v19@lc's answer every device is a file or directory. Partitions are all independent but they fit in the hierarchy. Later it is stated, that after installation, you can forget about hdb1, hdb5, etc.

psimation however says that these will be accessable vis the respective Mount Points /, /home, /usr, etc.

It seems v19@1c is saying you can put files anywhere and they will act as e.g., C: in windows and won't fill up any one linux partition because the linux partitions all together act automatically as one partition.

psimation however seems to be saying that these mount points are visible at /, /home, /user, etc. according to the amounts of space alloted to them when they were created as hdb1, hdb5, etc.

I don't know which is right not having a lot of experience with linux file systems. Obviously if y19@1c is right it doesn't matter where you install. But if psimation is right, then it does matter where you install.

Which is it. The one who was right should get credit for the answer if that is how this works.

The original question was how do you access and copy files to different partitions? According to y19@1c, everything is 1 partion. According to psimation there are several partitions.

Please clarify.
0
 
vl9Commented:
In the example I assumed that you have enough space
on /home/project to store the file you wish to copy there.
However, if you don't have enough space on that partition,
cp command will will fail with the message "no space
left on device" or alike. In conclusion, to you as
a user files appear organized as a single logical hierarchy
starting with /, and you don't need to worry about the
partitions as long as you have enough space on them.
However, once in a while you may run out of space on some
partition, so it is wise occasionally to check the space
on your partitions with 'df -h'.
0
 
dbenfellCommented:
I would disagree with the statement that you can forget about /dev/hda1 etc after installation.  But looking at /etc/fstab is an easy way to link them up with the mount points.  By editing /etc/fstab, you can change what partitions and disks are mounted automatically and what defaults are used when they are.

If you're low on space in some partitions and have plenty in others, you can 1) do some badly needed housekeeping, and 2) move some directories from the crowded partitions to the less crowded ones, and, as root, set symbolic links back to their old locations.

Be very careful about what you put on what partitions.  Some things must be on the root partition so they're available right away when the kernel boots.  In general, this is what /etc, /bin, /sbin, and, maybe a few others I'm not thinking of, are for.  The other partitions don't get mounted until the initialization process reaches the mount -a command.

To copy entire directories use cp -a <original directory> <destination>  Make sure you have your paths straight.
0
 
elmendorAuthor Commented:
v19@1c's answer was really wrong in comparison to that of psimation's. It is a shame that you can not award to the best answer. This might be the best format except it might lead to pulling hairs, hence probably the wisdom of the way it is done.

Really there are different mount points and different amounts of space which you have to know about and keep track of and the original question was pretty explicit in explaining the ramifications of the question. When v19@1c stated, "I assumed that you have enough space on /home/project to store the file you wish to copy there" this was in no way assumed in the original question and it was pretty clear the reason for asking the question was to know how to judge space, and be aware of any restrictions and how to handle them.

And as dbenfell@lc said, you do have to be able to do housekeeping.

However the effort is appreciated and since there has been contributions from others that seem to cover the matter, it does not seem worth beating a dead horse and going through it all over again.
0
 
vl9Commented:
I agree with you elmendor, it would be nice to grade the
answer you feel was the best. On my part, I tried to
tailor the answer for the level of the question.
0
All Courses

From novice to tech pro — start learning today.