Why does gpart not work for me

dalpets

Member

Reaction score: 2
Messages: 58

When I use these 3 commands I get no response. Help please
Code:
*** Fatal error: open(show): No such file or directory.
[root@FreeBSD /home/brenton]# gpart show

*** Fatal error: open(show): No such file or directory.
[root@FreeBSD /]# gpart show

[root@FreeBSD /]# gpart show -l -v -p
Usage: gpart [options] device
Options: [-b <backup MBR>][-C c,h,s][-c][-d][-E][-e][-f][-g][-h][-i]
[-K <last sector>][-k <# of sectors>][-L][-l <log file>]
[-n <increment>][-q][-s <sector-size>][-t <module-name>]
[-V][-v][-W <device>][-w <module-name,weight>]
gpart v0.1h (c) 1999-2001 Michail Brzitwa <michail@brzitwa.de>.
Guess PC-type hard disk partitions.
 
Last edited by a moderator:

olli@

Well-Known Member
Developer

Reaction score: 361
Messages: 475

Use /sbin/gpart.
Obviously you have installed sysutils/gpart, and /usr/local/sbin precedes /sbin in your $PATH. That's not a good idea; /usr/local/{bin,sbin} should be last.
 

yuripv

Active Member

Reaction score: 87
Messages: 218

How do I accomplish that order? (sorry I'm a newcomer to unix)
Default PATH (as set in /etc/login.conf) is /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin.

Was it a fresh install? If yes, what did you modify?

Or did you adopt the system after someone else? If yes, check the dot files in your ~ directory for any PATH overrides.
 

olli@

Well-Known Member
Developer

Reaction score: 361
Messages: 475

How do I accomplish that order? (sorry I'm a newcomer to unix)
Ok, I thought you changed that in the first place … Didn't think it was default.

Here's some background information …

PATH is an environment variable that lists the directories that are searched for commands if you don't specify the directory explicitly. For example, when you type /sbin/gpart, your shell knows that it has to look for the command in the /sbin directory. But when you type just gpart (without the /sbin directory), the shell starts searching for that command in a number of directories. Those directories are listed in your PATH environent variable, separated by colons.

You can view the contents of that variable with echo $PATH.

Usually, that variable is set by your shell's profile. That's a script that is executed automatically when the shell starts up. The name of the profile depends on which kind of shell you are using.

So, first, find out which command shell you are using (sh, csh, bash, zsh, …). echo $SHELL or ps -p $$ should display it.

Then you might want to look at that shell's manual page: Type man sh if you're using sh, for example. You can also read the manual page online here: sh(1). In this case, it will tell you that the shell reads the file .profile in your home directory when you log in (other shells use different file names). So have a look at that file and try to find the line where it sets or changes the PATH variable.

As mentioned above, the local directories should be last. For example:
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

Note: When you work as the root user, you might have a different shell than as normal user, depending on how you invoked the root shell.
 
OP
OP
D

dalpets

Member

Reaction score: 2
Messages: 58

Default PATH (as set in /etc/login.conf) is /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin.

Was it a fresh install? If yes, what did you modify?

Or did you adopt the system after someone else? If yes, check the dot files in your ~ directory for any PATH overrides.
Yes it was. All I did was simply install the gpart pkg. The default PATH I have in the config file is the same as yours above. Does that then change any comments by you & other responders so far. if it does, where from here? Thanks.
 

olli@

Well-Known Member
Developer

Reaction score: 361
Messages: 475

All I did was simply install the gpart pkg.
Did you install it for a reason? Or did you confuse it with FreeBSD's gpart? Those two are not related. It's very unfortunate that they have the same name.
If you don't really need the gpart package, I recommend to remove it. FreeBSD's gpart command is part of the base system; you don't have to install any packages to be able to use it.
 
OP
OP
D

dalpets

Member

Reaction score: 2
Messages: 58

Ok, I thought you changed that in the first place … Didn't think it was default.

Here's some background information …

PATH is an environment variable that lists the directories that are searched for commands if you don't specify the directory explicitly. For example, when you type /sbin/gpart, your shell knows that it has to look for the command in the /sbin directory. But when you type just gpart (without the /sbin directory), the shell starts searching for that command in a number of directories. Those directories are listed in your PATH environent variable, separated by colons.

You can view the contents of that variable with echo $PATH.

Usually, that variable is set by your shell's profile. That's a script that is executed automatically when the shell starts up. The name of the profile depends on which kind of shell you are using.

So, first, find out which command shell you are using (sh, csh, bash, zsh, …). echo $SHELL or ps -p $$ should display it.

Then you might want to look at that shell's manual page: Type man sh if you're using sh, for example. You can also read the manual page online here: sh(1). In this case, it will tell you that the shell reads the file .profile in your home directory when you log in (other shells use different file names). So have a look at that file and try to find the line where it sets or changes the PATH variable.

As mentioned above, the local directories should be last. For example:
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

Note: When you work as the root user, you might have a different shell than as normal user, depending on how you invoked the root shell.
Code:
The config file shows the default as :path=/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin ~/bin:\ 
$ echo $PATH
/usr/local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
$ echo $SHELL
/bin/sh
$ su
Password:
[root@FreeBSD /home/brenton]# echo $PATH
/usr/local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
[root@FreeBSD /home/brenton]# echo $SHELL
/usr/local/bin/bash
Do these outcomes pose a problem. If they do how do I fix? Thanks .
 
Last edited by a moderator:
OP
OP
D

dalpets

Member

Reaction score: 2
Messages: 58

Did you install it for a reason? Or did you confuse it with FreeBSD's gpart? Those two are not related. It's very unfortunate that they have the same name.
If you don't really need the gpart package, I recommend to remove it. FreeBSD's gpart command is part of the base system; you don't have to install any packages to be able to use it.
Yes, I was aware of the subtle name difference but i didn't know gpart was part of the base system. The reason i was fixating on gpart was to get a utility program to view &, if necessary & to manipulate partitions, but initially for the purpose of introducing and formatting a new usb drive, for the purpose of system backups. All this to eliminate the possibility, in the process, of screwing up my existing system disk .
I particularly want to expedite backups so that I can effect minor version upgrades that might be lost to me if I dither doing so.

I come from a 25 years Windows background & would like, if possible, a GUI partition interface similar to that I used there. Any recommendations?
 

`Orum

Active Member

Reaction score: 20
Messages: 169

I come from a 25 years Windows background & would like, if possible, a GUI partition interface similar to that I used there. Any recommendations?
I don't know of one for FreeBSD, but if you've ever used diskpart on Windows (or even if you haven't), now might be a good time to learn gpart.

All this to eliminate the possibility, in the process, of screwing up my existing system disk. I particularly want to expedite backups...
The best way to not screw things up is two-fold. First, double and triple check any commands you run before you run them. Make sure you know exactly what everything you type does and make sure any arguments you give it are correct. Second, script any task you're going to do more than once, as this avoids you mistyping something down the line. Doing regular backups? Write a script, make sure to test it on a system you don't care about first (in case things go wrong), and then transfer it over to your main system. Alternatively, use one that was written by someone else, but again, test in a non-critical environment, make sure you know how to use it, etc.
 

Elazar

Member

Reaction score: 26
Messages: 49

bsdconfig has a GUI like partition Editor. You can call that directly, too, with sade. I dont think it has a backup feature though...
 
Top