terminal command for switching partition

Discussion in 'Mac Programming' started by bearbo, Aug 31, 2006.

  1. macrumors 68000

    bearbo

    Joined:
    Jul 20, 2006
    #1
    okay, first of all, forgive me for my ignorance

    alright, so when i start terminal, i'm in /User/MyUserName/
    and after i go <code> cd ../.. </code>, i get to the root

    now, i have a few other partitions (ext. hdd, windows, etc), how do i get to the root of other partitions?

    thanks
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    In Unix all drives are mounted into the same filesystem so there is nothing like A:, C:, D: etc in Windows. The root of the filesystem is / so a cd / changes you to the root. A mounted partition or drive will simply look like a directory you can cd into it.

    You can found out where drives or partitions are mounted to with the mount command. OSX tends to mount everything apart from startup disk/partition in /Volumes
     
  3. thread starter macrumors 68000

    bearbo

    Joined:
    Jul 20, 2006
    #3
    i tried the <code>mount</code>, it tells me i have stuff such as /disk1s3 or something, but when i do <code>mount /disk1s3 </code> or <code> mount /Volumes/disk1s3 </code>, it doesnt work either

    can you suggest a format that i should use?

    edit: wait, did you mean everything is in /Volumes, as in i can <code> cd /Volumes </code> and get to things? i'll try that
     
  4. macrumors 68040

    plinden

    Joined:
    Apr 8, 2004
    #4
    All partitions and disk drives are mounted under Volumes. To get to these you use:
    Code:
    cd /Volumes/<name>
    Edit:
    Yes
     
  5. macrumors 6502a

    Joined:
    Jun 17, 2003
    #5
    If the partitions are showing up on your desktop then they are already mounted and you do not need to bother about using the mount command to mount them. If you just enter the command mount at the terminal then you will be shown a list of currently mounted filesystems. The only lines of the output from mount that you need to look at are the lines starting with /dev/disk such as:

    Code:
    /dev/disk0s3 on /Volumes/data (local, journaled)
    /dev/disk1s3 on /Volumes/musicdata (local, journaled)
    
    The two lines above show a partition named "data" mounted at /Volumes/data and another partition (on a seperate disk) named "musicdata" mounted at /Volumnes/musicdata.

    To access the contents of the "musicdata" partition via the terminal you use the command cd /Volumes/musicdata.
     
  6. macrumors 68000

    savar

    Joined:
    Jun 6, 2003
    Location:
    District of Columbia
    #6
    by the way, its not <code></code>, its [ code][/code] without the space in front of the first "code".
     
  7. thread starter macrumors 68000

    bearbo

    Joined:
    Jul 20, 2006
    #7
    haha, why thank you... i wasn't quite trying to get that little-window effect, but rather just something i do across many forums... but appreciate it either way
     
  8. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #8
    If you want to put vB code in your post you can use the noparse tags like:

    [plain][code][/code][/plain]

    Which gives you:

    [code][/code]

    No need for extra spaces

    :D
     
  9. 4np
    macrumors 6502a

    4np

    Joined:
    Feb 23, 2005
    Location:
    The Netherlands
    #9
    In a UNIX environment you mount filesystems (eg. partitions on a particular disk or external filesystem) in order to gain access to them, and you unmount them when you're done with them (especially for detachable devices like a firewire harddisk, usb drive, etc). In fact, upon shutdown a UNIX system unmounts all mounted filesystems...

    If you type

    Code:
    mount
    You see a list of mounted filesystems (either local -/dev/hdXY- or remote like smbfs) and their mountpoints. In a normal unix environment mountpoints are generally stored in /mnt; in Darwin this works a bit differently. Whenever you cd into a mountpoint you are in the root of that particular filesystem. A mountpoint is nothing more than an empty directory which is referenced to some filesystem.

    Also, you wrote you changed to the root directory by typing:

    Code:
    cd ../..
    
    You could have done that with less typing like this:

    Code:
    cd /
    
    In unix ., .. and ~ have special meanings:

    . = the current directory (for example, execute file bla.pl in the current directory: ./bla.pl)
    .. = the parent directory of the one you're in right now
    ~ = your user directory (cd ~)
    / = the root directory and/or path seperator (cd /)

    For the rest I would recommend some Unix for dummies guide, or better, Darwin for dummies as Darwin is a bit different compared to regular unixes / linux environments.
     
  10. macrumors 68020

    pdpfilms

    Joined:
    Jun 29, 2004
    Location:
    Vermontana
    #10
    Can someone post a simple guide to mounting an external drive through single user mode? All i need to do is move a file from a volume to an external drive, and I can't make the computer see that external drive. After reading through the above, i feel there is a lot being skipped over, that noob Uinx users such as myself aren't so quick to fill in.

    Thanks.
     

Share This Page