Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

command not working

Posted on 2013-06-08
8
Medium Priority
?
628 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 36

Accepted Solution

by:
Seth Simmons earned 2000 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
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
LVL 36

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

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month20 days, 21 hours left to enroll

810 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