Jump to content

"Not a directory" . . . How to address through terminal?


BillD

Recommended Posts

When running live, how do you access specific directories (or files) on an existing installed partition in terminal mode? I can mount the desired partition, but then how do I address (cd to) a particular directory? In this case my partition of interest is /dev/hda6, but in terminal mode from the live CD, altho I can mount hda6 (I can see that it mounted by looking at all the partitions in Kde Storage Devices window), no matter how I word the cd command, I cannot seem to get beyond the fact that I cannot cd to /dev/hda6 . . . because in itself it is not a file or directory, and if I add the desired directory as " /dev/hda6/desired " it still will not work.The same thing happens while running in normal mode; I have experimented with trying to access stuff in my Windows partitions (/dev/hda1 and /dev/hda5) and I cannot do it thru the terminal because of the above mentioned problem; no matter what I attempt to access, I can not "cd" to it.Thank you,Bill

Link to comment
Share on other sites

You have to access it where it is mounted on. For an example:/dev/sda8 /mnt/storageYou mount the thing at /mnt/storage and access its contents with :

$ ls -al /mnt/storage

You can even use the cat command instead of the ls command just to have a peek.

Link to comment
Share on other sites

That ś right . . you can not access the /dev/hda6 directly . . you have to mount it first and can then cd to the directory on the mounted partition. So if you mount it on /mnt/storage like in Strikers example and you want to cd to the /boot directory on the /hda6 partition you "cd /mnt/storage/boot":) Bruno

Link to comment
Share on other sites

Hmm, well I cannot mount FAT32 partitions as "storage", it fails; I had to do this:

mount /dev/hda1[root@localhost windows]# ls -al /mnt/win_d/windows

Got me a list of stuff in windows. I can get a list of stuff on the second partition (data) with " /win_d ".I got the /win_c, etc., from looking at the window in the Kde Storage Devices. I'll try it next running live where I can do a Linux partition that does not already have a name like "win_x".Thanks, Bill

Edited by BillD
Link to comment
Share on other sites

Frank Golden
You have to access it where it is mounted on. For an example:/dev/sda8 /mnt/storageYou mount the thing at /mnt/storage and access its contents with :
$ ls -al /mnt/storage

You can even use the cat command instead of the ls command just to have a peek.

Hi Striker, is the above command a shorthand way of "mkdir" or do you have to
 mkdir /mnt/storage

first?On the Ubuntu live CD you have to preface most commands with "sudo" without the quotation marks of course.As far as mounting and accessing partitions/drives from a "normal mode" session. Using the example you show of accessing a Windows partition (/dev/hda1) you need to know the partition filesystem (either NTFS or Fat32).In Ubuntu you would first create a directory for your mountpoint. Say you wanted to call the directory windows in the folder /media.You would type

sudo mkdir /media/windows

You only need to do this once.Now lets say the partition you want to mount is fat32 and the partition is /dev/hda1 then the command would be

sudo mount /dev/hda1 /media/windows -t vfat -o umask=000

The above command will place an icon/shortcut on you desktop in Ubuntu. Clicking on it will allow read/write access.If NTFS

sudo mount /dev/hda1 /media/windows -t ntfs -o umask=0002,nls=utf8

.This time the access is read only, if you want to write to it open in root konqueror using the command

kdesu konqueror /media/windows

This will open it in root konqueror where you can read/write to the volume. This is of course if you are using a later version of Ubuntu/Kubuntuwhich supports NTFS writes.The above commands are for Ubuntu/Kubuntu.I believe for other distros (that use su) you would first su to root before issuing these commands.The commands with sudo, omit the sudo.I'm not sure if other distros would show a desktop icon though. PCLinuxOS 2008 gnome doesn't.Other distros may use /mnt/*** as a mount point instead of /media/***For more info than I can ever supply on this subject seehttp://users.bigpond.net.au/hermanzone/p10...mounting_basicsthis site is devoted to dual booting Ubuntu.the above link refers to a page on filesystem basics and is very informative.

Edited by Frank Golden
Link to comment
Share on other sites

Well, I am definitely missing something here because when I run live:

[root@localhost root]# mount /dev/hda6[root@localhost root]# /dev/hda6 /mnt/storagebash: /dev/hda6: Permission denied

So I tried

[root@localhost root]# mkdir /mnt/storage[root@localhost root]# cd /mnt/storagebash: cd: /mnt/storage: No such file or directory

And when I used Konqueror to look at what was in the live CD session, there iwas a folder "/mnt/storage" . . . in addition to all the other mount stuff including /mnt/c_windows, etc. But it obviously was not "connected" to /hda6 . . . which I guess it would not be because I am just creating it on the partition I am running live in the second code. So, what am I doing wrong?Thanks, guys,Bill

Edited by BillD
Link to comment
Share on other sites

Frank Golden
Well, I am definitely missing something here because when I run live:
[root@localhost root]# mount /dev/hda6[root@localhost root]# /dev/hda6 /mnt/storagebash: /dev/hda6: Permission denied

So I tried

[root@localhost root]# mkdir /mnt/storage[root@localhost root]# cd /mnt/storagebash: cd: /mnt/storage: No such file or directory

And when I used Konqueror to look at what was in the live CD session, there iwas a folder "/mnt/storage" . . . in addition to all the other mount stuff including /mnt/c_windows, etc. But it obviously was not "connected" to /hda6 . . . which I guess it would not be because I am just creating it on the partition I am running live in the second code. So, what am I doing wrong?Thanks, guys,Bill

Bill what distro live CD are we talking here? If it's Ubuntu/Kubuntu you have to preface all those commands with sudo.Looks like you are trying to mount from root, OK the command needs more info like what filesystem and where to mount /dev/hda6.The command for simply mounting read only would be from root, for a Fat32 partition.
mount -t vfat /dev/hda6 /mnt/storage

or

sudo mount -t vfat /dev/hda6 /mnt/storage

if you distro uses sudo.Substitute ntfs for vfat if the filesystem is NTFS.

Edited by Frank Golden
Link to comment
Share on other sites

[root@localhost root]# mount /dev/hda6[root@localhost root]# /dev/hda6 /mnt/storagebash: /dev/hda6: Permission denied

Here right at the start you make 2 vital mistakes . . there are flaws in both 2 commands you give.In the first command you do not tell the terminal WHERE to mount the /dev deviceIn the second command you do not tell the terminal WHAT to do with the /dev device and the /mnt mountpoint.So let us keep it simple in the next example ( I assume you use PCLos in this exercise ), forget all that has been said/done before, start with a clean sheet: The device = /dev/hda6The mountpoint = /mnt/hda6First, we have to create the mountpoint:
# mkdir /mnt/hda6

Second, we mount the device on the mountpoint:

# mount /dev/hda6 /mnt/hda6

Third, we can either access OR see what is on the mountpoint where we mounted the device:

# cd /mnt/hda6

OR

# ls /mnt/hda6

:thumbsup: Bruno

Link to comment
Share on other sites

OK, when I started, I got:

[root@localhost root]# mkdir /mnt/hda6mkdir: cannot create directory `/mnt/hda6': File exists

So I thought, OK if it already exists then what happens if I go ahead and mount it:

[root@localhost root]# mount /dev/hda6 /mnt/hda6[root@localhost root]# ls /mnt/hda6bin/   dev/  home/	lib/		 media/  opt/	  proc/  sbin/  tmp/  var/boot/  etc/  initrd/  lost+found/  mnt/	poweroff  root/  sys/   usr/

And indeed then I could cd to various places in it.Worked similarly on /dev/hda1 which is Windows, which also informed initially that the "file already exists".Yet, when I tried it on /dev/hda5 (Windows data partition), it worked exactly as Bruno said; I needed to mkdir mount point before I could mount it there. However, having accomplished this, I cd'd to /dev/hda5 and attempted to cp, rm, etc. stuff there and got nowhere . . . hmm?Thanks for all the input.Striker, you should never assume I know anything!Bill

Link to comment
Share on other sites

Okay Bill . . . so we did make some progress and have got the basics.One thing to remember though is that you always have to umount the partition you previously mounted once you are done with it.Now the next step:

I cd'd to /dev/hda5 and attempted to cp, rm, etc. stuff there and got nowhere . . . hmm?
I wish you could show me some examples of what you tried to do . . . because the above statement is a bit abstract. ( but I think you did try to manipulate files on /dev/hda5 and you should have done it on /mnt/hda5 )Anyway to give you an example of how I would do it:
# mount /dev/hda5 /mnt/hda5# cd /mnt/hda5# ls# cd example_directory# cp example_file example_file-BACKUP# ls# cd /home/bill# umount /mnt/hda5

Notes: the first "ls" command will show what files and folders are on /mnt/hda5 . . the second "ls" is to check if next to the "example_file" there now also is an "example_file-BACKUP".The "cd /home/bill" will place you back to where you came from so that in the next command you can umount the partitionB) Bruno

Link to comment
Share on other sites

( but I think you did try to manipulate files on /dev/hda5 and you should have done it on /mnt/hda5 )
Yes, that is exactly what I tried to do because I thought I could first cd to /mnt/hda5 and then when the prompt said hda5#, I attempted to do stuff, and it did not work. After thinking about it a bit and eating lunch, I came back, rebooted in live mode and using the "/mnt/hda5/xxxx , it worked great for cp, rm, etc.Thanks for all the good info; I really appreciate it. I had never tried it until last night from a live disk and clearly I needed your little tutorial above to get going :thumbsup: Also, I needed to review your tips which reminded me I needed the " -r " with " rm " for directories. But it was neat; I could rename stuff inside of directories, remove files inside of directories, remove directories, etc.Thanks,BillEdit: Uh, thats odd, I see you are suggesting immediately above what I was trying to do before . . . going back and look at this some more. No, I have done it again, and altho I can cd to /mnt/hda5 and when I do "ls", I can see what is in there, but in order to actually do anything there while running live, I have to do: [desired action] /mnt/hda5/xxxx ; it will not work if I cd to mnt/hda5 and then try to do it just as tho I were actually in the partition . . . I see "hda5#" at the end of the prompt, but not "mnt/hda5" and it simply will not work to perform any actions like cp, rm, etc. then. Edited by BillD
Link to comment
Share on other sites

Hi Bill . . . the thing I usually do when booting a LiveCD and do commandline stuff on a partition: I actually do not "cd" at all and just use the full path for the commands ( that way I do not have to cd back either, that saves me 2 commands to execute )So, in a nutshell:

# mount /dev/hda5 /mnt/hda5# cp /mnt/hda5/example_directory/example_file /mnt/hda5/example_directory/example_file-BACKUP# ls /mnt/hda5/example_directory# umount /mnt/hda5

( Tip: I use a lot of copy and paste to type the commands . . parts like "/mnt/hda5/example_directory" come from the clipboard :thumbsup: ):wacko: Bruno

Link to comment
Share on other sites

( Tip: I use a lot of copy and paste to type the commands . . parts like "/mnt/hda5/example_directory" come from the clipboard wink.gif )
Yes, that is what I was doing too :thumbsup: Thanks again for all the assistance; clearly I needed it!Bill
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...