"fdisk -l" gives error: "unable to resolve host kwam-desktop"

Asked by kjerryn

kwam@kwam-desktop:~$ sudo fdisk -l
sudo: unable to resolve host kwam-desktop

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xaa99f763

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 2550 20482843+ 7 HPFS/NTFS
/dev/sda2 2551 2793 1951897+ 82 Linux swap / Solaris
/dev/sda3 2794 5468 21486937+ 83 Linux
/dev/sda4 5469 30400 200266290 f W95 Ext'd (LBA)
/dev/sda5 5469 9179 29808576 7 HPFS/NTFS
/dev/sda6 9180 16828 61440561 7 HPFS/NTFS
/dev/sda7 16829 24477 61440561 7 HPFS/NTFS
/dev/sda8 24478 30400 47576466 7 HPFS/NTFS

hello, the above is the nature of my hard disk.
please what commands would i use to mount them.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Elfy
Solved:
Last query:
Last reply:
Revision history for this message
Philipp Bönhof (phboe-launchpad) said :
#1

If for all /dev/sda* which are HPFS/NTFS are really ntfs you should be able to mount them with

sudo mount -t ntfs -o defaults,umask=007,gid=46 /dev/sda* /path/to/where/you/want/to/access/it

The star you should replace by an according number. You should also make sure that the mount-point-path is an existing empty directory.

/dev/sda2 should be your swap partition and already mounted as such.

For /dev/sda3 you can use
sudo mount -t ext3 -o relatime,errors=remount-ro /dev/sda3 /path/to/partition

And for /dev/sda4 I would use
sudo mount -t vfat -o utf8,umask=007,gid=46 /dev/sda4 /path/to/partition

If you want to always mount these partitions automatically you should consider writing the configurations of these partitions into /etc/fstab. See "man fstab" for more information.

Hope this helped.

Revision history for this message
Elfy (elfy) said :
#2

If the name of you pc is not the same in these two files you need to change one. Open a terminal run these commands seperately -

cat /etc/hosts
cat /etc/hostname

For example these are mine

cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 kevin-desktop

cat /etc/hostname
kevin-desktop

If they are not the same you can try editing the file within ubuntu using gksudo instead of sudo with gedit

gksudo gedit /etc/hosts

If you are able to open the file with that command - edit it so that the names match in both files, then reboot

If you are not able to do that - reboot into recovery mode - you will end up at a command prompt. You can use nano to edit the file here, in nano to save changes Ctrl+O then enter, to exit Ctrl+X

nano /etc/hosts

make changes then Ctrl+O, enter, Ctrl+X

type reboot and then enter

Revision history for this message
Elfy (elfy) said :
#3

What I meant to say first is that your "sudo: unable to resolve host kwam-desktop" error is something else which you will need to resolve before you can use sudo

Revision history for this message
kjerryn (kjerryn) said :
#4

hi
kwam@kwam-desktop:~$ /etc/fstab
bash: /etc/fstab: Permission denied
kwam@kwam-desktop:~$ sudo /etc/fstab
[sudo] password for kwam:
sudo: /etc/fstab: command not found
kwam@kwam-desktop:~$

and i don't understand exactly what
/path/to/where/you/want/to/access/it
should be

Revision history for this message
kjerryn (kjerryn) said :
#5

thank you forestpixie

problem with hostname is resolved

Revision history for this message
Elfy (elfy) said :
#6

Glad I could help - have you still got another problem?

Revision history for this message
kjerryn (kjerryn) said :
#7

hi forestpixie

still cannot mount volume

Revision history for this message
Best Elfy (elfy) said :
#8

There are 2 ways to do so one of which is what Philipp Bönhof proposes above. You could also try installing ntfs tools in Ubuntu, there is then a menu item in System Tools I think - it's a long time since I used ntfs, open a terminal and

sudo apt-get install ntfs-config ntfs-3g

Let them install and the tool will give you the option of which drives you want to read and write to I just remember.

When you installed did the partitions not get added to fstab? Further which do you actually want to mount - you can find out which have mounted by running this in a terminal

mount

Revision history for this message
kjerryn (kjerryn) said :
#9

hi
the drives do get mounted but become unmounted after reboot

Revision history for this message
Elfy (elfy) said :
#10

"the drives do get mounted but become unmounted after reboot"

what have you done to get them to mount - are they now in fstab or not - if they are not in fstab they will not remount

You need to give a bit more information really - perhaps you could post fstab

cat /etc/fstab

You've had a couple of ideas here - what have you followed - apart from the hosts thing because that is a different issue

Revision history for this message
kjerryn (kjerryn) said :
#11

wam@kwam-desktop:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# -- This file has been automaticly generated by ntfs-config --
#
# <file system> <mount point> <type> <options> <dump> <pass>

proc /proc proc defaults 0 0
# Entry for /dev/sda3 :
UUID=fb8082e1-43c3-46a2-9a2f-79760d2ef954 / ext3 defaults,errors=remount-ro 0 1
# Entry for /dev/sda1 :
UUID=2850736850733C1E /media/sda1 ntfs-3g defaults,locale=en_US.UTF-8 0 1
# Entry for /dev/sda5 :
UUID=1408F43F54EC8AC9 /media/sda5 ntfs-3g defaults,locale=en_US.UTF-8 0 1
# Entry for /dev/sda6 :
UUID=1408F4B94DD0B409 /media/sda6 ntfs-3g defaults,locale=en_US.UTF-8 0 1
# Entry for /dev/sda2 :
UUID=b73caa2d-9438-4830-8daf-164776f4310f none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec 0 0
/dev/sda8 /media/data3 ntfs-3g defaults,locale=en_US.UTF-8 0 0
/dev/sda7 /media/data2 ntfs-3g defaults,locale=en_US.UTF-8 0 0

Revision history for this message
Elfy (elfy) said :
#12

Well they are all in fstab - did you add them yourself? If you did so, did you also add the necessary folders in /media for the to mount into.

IF you do this from aterminal

ls media (that is a L not a 1)

You should to my mind get these results

sda1 sda5 sda6 cdrom0 data3 data2

If you don't get them all you need to create a folder for the ones which are missing using this syntax

sudo mkdir /media/nameoffolder

eg sudo mkdir /media/data3

Can you also check the output of this straight after a reboot

mount

Revision history for this message
kjerryn (kjerryn) said :
#13

hi,
kwam@kwam-desktop:~$ ls media
ls: cannot access media: No such file or directory
kwam@kwam-desktop:~$ sudo mkdir /media/data
[sudo] password for kwam:
kwam@kwam-desktop:~$ sudo mkdir /media/data1
kwam@kwam-desktop:~$ sudo mkdir /media/data2
mkdir: cannot create directory `/media/data2': File exists
kwam@kwam-desktop:~$ sudo mkdir /media/data3
mkdir: cannot create directory `/media/data3': File exists
kwam@kwam-desktop:~$ ls media
ls: cannot access media: No such file or directory
kwam@kwam-desktop:~$

Revision history for this message
Elfy (elfy) said :
#14

sorry

ls /media

this is why it's such a lot easier to use the forums - you get answers quicker and more peoples minds on the job

Revision history for this message
kjerryn (kjerryn) said :
#15

kwam@kwam-desktop:~$ ls /media
cdrom cdrom0 data data1 data2 data3 sda1 sda5 sda6
kwam@kwam-desktop:~$ mount
/dev/sda3 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
lrm on /lib/modules/2.6.24-17-generic/volatile type tmpfs (rw)
securityfs on /sys/kernel/security type securityfs (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
kwam@kwam-desktop:~$

Revision history for this message
Elfy (elfy) said :
#16

I might have it - but not sure, if this doesn't work I'm not able to help anymore. You could wait for another answer here, or use the ubuntu forum

http://ubuntuforums.org/forumdisplay.php?f=326

Anyway open the file for editing

gksudo gedit /etc/fstab

For all of the lines which are ntfs partitions - sda 1,5,6,7 & 8

change the ntfs-3g to read ntfs

save and exit from the file

Reboot

Revision history for this message
kjerryn (kjerryn) said :
#17

Thanks forestpixie, that solved my question.

Revision history for this message
Elfy (elfy) said :
#18

Excellent - glad I could help -eventually