Help Understanding Output and question about /dev/


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help Understanding Output and question about /dev/
# 1  
Old 07-09-2009
Help Understanding Output and question about /dev/

Hi,

I am having some problems understanding the info from the following output:

Disk /dev/sda: 17849 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/sda1 * 0+ 499 500- 4016218+ 83 Linux
/dev/sda2 500 999 500 4016250 82 Linux swap / Solaris
/dev/sda3 1000 17848 16849 135339592+ 83 Linux
/dev/sda4 0 - 0 0 0 Empty


I wan to know how large each partition is. I selected the size for /dev/sda2 in fdisk to be 1000M but if I am understanding the info correctly I only have 0.5megs for /dev/sda2. Can someone tell me how to effectively create partition sizes in fdisk? it seems when I try and specify the size using the actual size it does not work well.

One other question:
/dev/shm 517172 0 517172 0% /dev/shm

Is /dev/shm the swap partition /dev/sda2?

Thanks!
# 2  
Old 07-09-2009
I make /dev/sda2 to be 3.8 Gb.

i.e. 4016250 blocks of 1024 bytes per block.

(4016250 * 1024) / 1024 / 1024 /1024 Gigabytes
# 3  
Old 07-09-2009
Quote:
Originally Posted by methyl
I make /dev/sda2 to be 3.8 Gb.

i.e. 4016250 blocks of 1024 bytes per block.

(4016250 * 1024) / 1024 / 1024 /1024 Gigabytes
I guess fdisk does not seem to handle creating partition sizes if you try and give it the exact size instead of blocks. Does anyone else have this problem?
# 4  
Old 07-09-2009
For future reference, please use [code][/code] tags for listings, source code, ...

Quote:
Originally Posted by mojoman
Code:
Disk /dev/sda: 17849 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1   *      0+    499     500-   4016218+  83  Linux
/dev/sda2        500     999     500    4016250   82  Linux swap / Solaris
/dev/sda3       1000   17848   16849  135339592+  83  Linux
/dev/sda4          0       -       0          0    0  Empty

This means that each of the 500 cylinders allocated for /dev/sda2 is 8225280 bytes (or about 8MB) large, which is about 4GB in total. Or, from the next column, it consists of 4016250 blocks á 1024 bytes = ~4GB.

You can specify the intended size by using '+1024M' (=1GB) when fdisk asks for the ending block number.

Quote:
Originally Posted by mojoman
One other question:
/dev/shm 517172 0 517172 0% /dev/shm

Is /dev/shm the swap partition /dev/sda2?
No, it's a pseudo filesystem (much like /dev, /proc, /sys) used for shared memory usage (IPC/Message passing). Swap partitions don't show up in the output of mount/df. Use swapon -s for that.
# 5  
Old 07-09-2009
I have tried swapon -s as you suggested and I see nothing which is strange since CENTOS at boot reports that it mounts the SWAP partition. My fstab is:

# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/sda3 / ext3 defaults 1 1
/dev/sda1 /boot ext3 defaults 1 2
/dev/sdb1 /home8 ext3 defaults 1 2
/dev/devpts /dev/pts devpts gid=5,mode=620 0 0
/dev/shm /dev/shm tmpfs defaults 0 0
/dev/proc /proc proc defaults 0 0
/dev/sys /sys sysfs defaults 0 0
LABEL=SWAP-sda2 swap swap defaults 0 0
/dev/fd0 /media/floppy auto pamconsole,exec,noauto,managed 0 0
/dev/hda /media/cdrom auto pamconsole,exec,noauto,managed 0 0
~

WHen I try executing swapon -L SWAP-sda2 I get:
swapon: cannot find the device for SWAP-sda2

What should I do?
# 6  
Old 07-09-2009
It sounds like the label wasn't put into the swap partition when it was formatted, hence centos can't find it on boot. That it says its mounting swap may only mean its at the point where it would, not that it's actually found it. You can reformat the swap partion with mkswap -L label /path/to/device
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Simply question about capturing output to /dev/tty

Suppose another person wrote the following one-line shell script: echo $RANDOM > /dev/tty QUESTION #1: How can the random number, which is output to the terminal by this script, be captured in a variable? QUESTION #2: How can this be done in a cron job? Specific code, whether in ksh or... (1 Reply)
Discussion started by: Paul R
1 Replies

2. Red Hat

Command understanding the output file destination in case of standard output!!!!!

I ran the following command. cat abc.c > abc.c I got message the following message from command cat: cat: abc.c : input file is same as the output file How the command came to know of the destination file name as the command is sending output to standard file. (3 Replies)
Discussion started by: ravisingh
3 Replies

3. Shell Programming and Scripting

Understanding the output of fwtmp

Hi all, First time post, so please be gentle. :) I'm writing a Solaris 10 ksh script to retrieve details of logins and logouts using specific user names. The details I want are quite basic - the username, the computer logged in from, and the date and time the user logged in and logged off.... (6 Replies)
Discussion started by: confusedAdmin
6 Replies

4. UNIX for Dummies Questions & Answers

Understanding nm command output

After running nm command on any object file from out put can we get to know that wheather a symbol is a call to a function or definition of function ? I am searching a class and function definitions inside many .so files. I have 3 files which contain the symbol but I don't know wheather they... (2 Replies)
Discussion started by: yatrik007
2 Replies

5. Shell Programming and Scripting

Understanding the output of TOP

ok, so I have a script im running on a linux box that uses "egrep" a lot. now, when i run this script, i check the TOP to see how much system resource it is using. the "top" command gives the following output: last pid: 25384; load avg: 1.06, 1.04, 0.76; up 351+06:30:24 ... (0 Replies)
Discussion started by: SkySmart
0 Replies

6. UNIX for Advanced & Expert Users

How to output 1s endlessly like /dev/zero?

/dev/zero can output 0's (null characters) endlessly. I am looking for a technique to output 1's (0xFF or 0b11111111) endlessly in a similar manner as /dev/zero. The following dd statement writes 4 terabytes of 0's to the drive /dev/sdb. This dd statement does not cause any memory shortage. ... (3 Replies)
Discussion started by: LessNux
3 Replies

7. UNIX for Dummies Questions & Answers

Understanding the output command

Could you please explain me whats happening in the below code, appreciate your help, Thank you. /product/apps/informatica/v7/pc/ExtProc/NewDAC/dacRecBuilder.sh /product/apps/informatica/v7/pc/TgtFiles/NEW_DAC/DAC_Pos_TradeInv_Records.out ... (5 Replies)
Discussion started by: Ariean
5 Replies

8. UNIX for Dummies Questions & Answers

/dev/fd question

what exactly is going on in this piece of code? what is the role of /dev/fd? i know that /dev/fd/0 is somehow linked to standard input, but that's the extent of my knowledge cat header.txt /dev/fd/0 footer.txt (2 Replies)
Discussion started by: momo.reina
2 Replies

9. Solaris

What is /dev/tty /dev/null and /dev/console

Hi, Anyone can help My solaris 8 system has the following /dev/null , /dev/tty and /dev/console All permission are lrwxrwxrwx Can this be change to a non-world write ?? any impact ?? (12 Replies)
Discussion started by: civic2005
12 Replies

10. UNIX for Dummies Questions & Answers

/dev question

RH 7.2 My machine has an LCD screen on the front of the panel. I've been given software to control some text on the LCD. The software checks /dev/tts/1 for the LCD. Since I don't have any /dev/tts directory, the developer told me just to make a link from the LCD to /dev/tts/1, but I don't... (4 Replies)
Discussion started by: jalburger
4 Replies
Login or Register to Ask a Question