Solved

command not working

Posted on 2013-06-08
8
594 Views
Last Modified: 2013-06-10
After this is done the command not working

[root@rc1 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@rc1 ~]# fdisk /dev/sdc

The number of cylinders for this disk is set to 1885.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
Partition 1 is already defined.  Delete it before re-adding it.

Command (m for help):
Command (m for help): 2
2: unknown command
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@rc1 ~]# fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@rc1 ~]# fdisk /dev/sde
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-522, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-522, default 522):
Using default value 522

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@rc1 ~]# fdisk /dev/sdf
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-522, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-522, default 522):
Using default value 522

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@rc1 ~]# fdisk /dev/sdg
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-522, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-522, default 522):
Using default value 522

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@rc1 ~]# ls -la sd*
ls: sd*: No such file or directory
[root@rc1 ~]# ls-la sd*
-bash: ls-la: command not found
[root@rc1 ~]# ls -la sd*
ls: sd*: No such file or directory
[root@rc1 ~]#
0
Comment
Question by:walkerdba
8 Comments
 
LVL 27

Expert Comment

by:skullnobrains
ID: 39232128
you probably need to reboot if you want your kernel to pick the changes

btw, you may want to use parted or even gparted if you have X setup
0
 
LVL 34

Accepted Solution

by:
Seth Simmons earned 500 total points
ID: 39232210
If you are trying to look at the disk devices, you are in the wrong folder.
You are trying to look at it within the /root folder; you need to look at /dev

ls -la /dev/sd*

as far as the partitions go, you do not need to reboot
if the partition table was in use, fdisk would say so - and even then you could run partprobe on the device to have the kernel reload the partition table without rebooting
0
 
LVL 27

Expert Comment

by:skullnobrains
ID: 39232282
you are right as far as the ls command goes, but mind the above : the author ran fdisk a number of times and the disk still appeared as not partitionned. it is actually fairly frequent that the linux kernel does not pick changes before a reboot
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 34

Expert Comment

by:Seth Simmons
ID: 39232343
the author ran fdisk a number of times on several devices

a partition was created on sdb
an attempt was made to create partition 1 on sdc but already exists
he then created partitions on sdd, sde, sdf, sdg
i see nothing that shows an attempt made on the same device more than once.

If the kernel can't get partition table changes it would have said...

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.


...which does not appear above
0
 
LVL 27

Expert Comment

by:skullnobrains
ID: 39232346
i completely missed the fact that the devices were different each time, sorry, and thanks
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 39233501
What is "the command" you are referring to? The fdisk commands or the ls command?

This should list all your sd* devices and partitions:

[root@rc1 ~]# ls -la /dev/sd*

Sample output:

brw-rw----. l root disk 8, 0 May 31  2013 /dev/sdb
brw-rw----. l root disk 8, 1 May 31  2013 /dev/sdb1
brw-rw----. l root disk 8, 2 May 31  2013 /dev/sdb2
0
 
LVL 13

Expert Comment

by:Sandy
ID: 39234699
just after partitioning

run a command instead of reboot

#partprobe
#kpartx

these worked in RHEL5 and then you can see the partitioning which is done on disk

Cheers
SA
0
 

Author Closing Comment

by:walkerdba
ID: 39236063
good
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Writing a UNIX script menu allowing for multiple options. 5 87
AWS ELB 5 95
SMB share across internet 15 64
RHEL installation problems on HP Proliant DL 360 G6 server 20 58
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question