Unix/Linux Go Back    


UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

Help Understanding Output and question about /dev/

UNIX for Dummies Questions & Answers


 
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 07-09-2009   -   Original Discussion by mojoman
mojoman mojoman is offline
Registered User
 
Join Date: Nov 2007
Last Activity: 12 October 2017, 2:21 PM EDT
Posts: 255
Thanks: 0
Thanked 1 Time in 1 Post
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!
Sponsored Links
    #2  
Old Unix and Linux 07-09-2009   -   Original Discussion by mojoman
methyl methyl is offline
Registered User
 
Join Date: Mar 2008
Last Activity: 8 June 2016, 9:58 PM EDT
Posts: 6,402
Thanks: 288
Thanked 676 Times in 645 Posts
I make /dev/sda2 to be 3.8 Gb.

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

(4016250 * 1024) / 1024 / 1024 /1024 Gigabytes
Sponsored Links
    #3  
Old Unix and Linux 07-09-2009   -   Original Discussion by mojoman
mojoman mojoman is offline
Registered User
 
Join Date: Nov 2007
Last Activity: 12 October 2017, 2:21 PM EDT
Posts: 255
Thanks: 0
Thanked 1 Time in 1 Post
Quote:
Originally Posted by methyl View Post
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 Unix and Linux 07-09-2009   -   Original Discussion by mojoman
pludi's Unix or Linux Image
pludi pludi is offline Forum Advisor  
Cat herder
 
Join Date: Dec 2008
Last Activity: 28 March 2014, 8:35 AM EDT
Location: Vienna, Austria, Earth
Posts: 5,521
Thanks: 38
Thanked 335 Times in 308 Posts
For future reference, please use [code][/code] tags for listings, source code, ...

Quote:
Originally Posted by mojoman View Post
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 View Post
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.
Sponsored Links
    #5  
Old Unix and Linux 07-09-2009   -   Original Discussion by mojoman
mojoman mojoman is offline
Registered User
 
Join Date: Nov 2007
Last Activity: 12 October 2017, 2:21 PM EDT
Posts: 255
Thanks: 0
Thanked 1 Time in 1 Post
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?
Sponsored Links
    #6  
Old Unix and Linux 07-09-2009   -   Original Discussion by mojoman
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 17 November 2017, 9:25 PM EST
Location: Saskatchewan
Posts: 22,512
Thanks: 1,151
Thanked 4,273 Times in 3,946 Posts
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
Sponsored Links
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Output file question Mihirjani Shell Programming and Scripting 3 07-01-2009 07:54 PM
Ifconfig output - help understanding flags 'Smart, Simplex', etc littlefrog OS X (Apple) 1 01-14-2009 02:33 PM
Question about formatting output using AWK Fatbob Shell Programming and Scripting 9 07-10-2008 07:58 PM
A question about output. HOUSCOUS Programming 2 04-18-2003 01:48 PM
Further question on 'ifconfig' output mint1981 UNIX for Dummies Questions & Answers 1 09-10-2002 12:49 PM



All times are GMT -4. The time now is 07:21 PM.