Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ubuntu - mount internal hdd partitions 1

Status
Not open for further replies.

Kirsle

Programmer
Jan 21, 2006
1,179
US
I recently installed Ubuntu Linux and want to be able to access the other hard drive partitions on the internal drives.

Here's how they were set up from a Windows point of view:

Master Hard Drive
C:/ - 40 GB NTFS
unpartitioned 5 GB space

Slave Hard Drive
D:/ - 20 GB NTFS
E:/ - 10 GB NTFS
~50 GB space for Ubuntu

so I'm guessing that these three points would exist at
/dev/hda1
/dev/hdb1
/dev/hdb2
respectively.

I've searched around for information on mounting a hard drive, but all of them seem to assume you have root privileges: all the commands begin with "mount" whereas I must use "sudo mount"

If I run a command such as
Code:
sudo mount -t ntfs /dev/hda1 /mnt/windows

The folder /mnt/windows suddenly can not be accessed with my account. When the drive is not mounted, I can open the directory fine without error, but when mounted, it gets permissions set that only root can only read from it, and everyone else can't even do that.

I've tried sudo chmod commands to try to change the permissions but I always get access denied errors.

After mounting it, if I do "sudo dir /mnt/windows", it lists the files and directories within correctly, showing what would have been on my "C:" drive on Windows.

So, it seems that root is able to mount it for itself, and access it through the terminal, but I can't seem to make it available to my user account.

Anybody have any idea what's wrong?

-------------
Cuvou.com | The NEW Kirsle.net
 
*correction: the D and E drives are FAT32 format, not NTFS

-------------
Cuvou.com | The NEW Kirsle.net
 
If you want the partitions to be mounted each time you boot into Ubuntu, you should edit the /etc/fstab-file.
This file tells the system which partitions/devices to mount, where, and with what attributes.
Check out what's in your fstab-file now with
Code:
cat /etc/fstab
To learn more about fstab do
Code:
man fstab
:)
Paul Sheers book has more in chapter 19....
and here to:
Hope this helps :)
 
Just a couple of comments to add to geirendre's recommendation.

1) Using chmod on a FAT32 or NTFS filesystem will never work. It's not even supposed to. Windows filesystems simply don't support UNIX-style file permissions, so using commands like chmod and chown on them is meaningless.

2) When adding the lines to /etc/fstab, look up the umask, dmask, uid, and gid options. These will allow you to control the the permissions and ownership for the filesystem. For example, using the umask=000 option will make the drive readable and writable to everyone, while umask=022 will make it readable to everyone and writable only to the owner.
 
FAT32 should be safe, although I've never written to one (Years ago I was an AOL subscriber, so on my dual-boot box I used to download on Windows, and then boot into Linux to read the files from the Windows partition). NTFS read should work OK (i.e. safe) but the last I heard was that writing to NTFS partitions was 'experimental'. Caveat emptor...

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Thanks for all your help! I got it working. :)

-------------
Cuvou.com | The NEW Kirsle.net
 
NTFS is safe for read using the default NTFS modules. NTFS is safe for read and write with CaptiveNTFS, using the default NTFS drivers I know of people who have had problems. Captive uses NDIS wrapper's trick of using the Window's libraries. To mount the NTFS read/write you will also need the Fuse module which you probably already have.

[plug=shameless]
[/plug]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top