LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-29-2012, 10:31 PM   #1
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 421
Blog Entries: 28

Rep: Reputation: 2
swapon: /dev/sda2: read swap header failed: Invalid argument


Hi, I reformatted my system disk and now the swap partition on /dev/sda2 doesn't mount properly anymore:
Code:
server:/~
root:# swapon -a
swapon: /dev/sda2: read swap header failed: Invalid argument
server:/~
root:# cat /etc/fstab
# /etc/fstab: static file system information.
#
# The following is an example. Please see fstab(5) for further details.
# Please refer to mount(1) for a complete description of mount options.
#
# Format:
# <file system>   <mount point>   <type>   <options>   <dump>   <pass>
#
# dump(8) uses the <dump> field to determine which file systems need
# to be dumped. fsck(8) uses the <pass> column to determine which file
# systems need to be checked--the root file system should have a 1 in
# this field, other file systems a 2, and any file systems that should
# not be checked (such as MS-initrd/mnt or NFS file systems) a 0.

# The Linux partitions
/dev/sda1 / ext3  defaults  0  1

# Shared Windows/Linux partition
#/dev/hda1   /mnt/dos  msdos  umask=0   0  0
#/dev/hda1   /mnt/win  vfat   fmask=111,dmask=0,quiet,shortname=mixed,user  0  0
#/dev/hda1   /mnt/win  ntfs   umask=0   0  0

# Floppy disks
# The 'noauto' option indicates that the file system should not be mounted
# with 'mount -a' 'user' indicates that normal users are allowed to mount
# the file system.
/dev/fd0   /mnt/floppy  auto    defaults,noauto,user    0 0
#/dev/fd1  /mnt/floppy  auto    defaults,noauto,user    0 0

# If you have a ls-120 floppy drive, it could be on /dev/hda b c d etc.
#/dev/hdd       /mnt/ls120      auto    defaults,noauto,user    0 0

# CDROM, CDWRITER, DVD
/dev/cdrom    /mnt/cdrom        iso9660 defaults,noauto,ro,user 0 0
#/dev/cdwriter /mnt/cdwriter    iso9660 defaults,noauto,rw,user 0 0
#/dev/dvd      /mnt/dvd         auto    defaults,noauto,ro,user 0 0

# NFS file systems:
#linux01.gwdg.de:/suse/6.3/i386.de  /mnt/nfs  nfs  defaults  0 0

# proc file system:
proc    /proc   proc    defaults        0 0

# Unix98 devpts filesystem:
none  /dev/pts  devpts  gid=5,mode=666  0 0

# Shared memory filesystem:
tmpfs   /dev/shm    tmpfs defaults 0  0

# Basic USB filesystem
sysfs  /sys  sysfs  defaults  0 0
usbfs /proc/bus/usb usbfs rw,devmode=0666 0 0

# example of a VFAT USB pendrive
#/dev/sda1  /mnt/pendrive vfat   fmask=111,dmask=0,noauto,user,quiet,shortname=m
ixed 0 0

# Swap partitions
# The 'sw' option means auto activating with 'swapon -a'.
/dev/sda2 swap swap defaults 0 0

#Mount sda3 on main drive to /mnt/linux
/dev/sda3 /mnt/linux ext3 defaults,user,exec 0 0

#Mount sdb1 on /mnt/main
/dev/sdb1 /mnt/main ntfs-3g defaults,user,exec 0 0
server:/~
root:# fdisk -l /dev/sda

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk does
't support GPT. Use GNU Parted.


Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x5560f0fb

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    50000000    24998976+  83  Linux
/dev/sda2        50000001    50996030      498015   82  Linux swap
/dev/sda3        50996031   156301487    52652728+  83  Linux
Thanks,
Ted
 
Old 09-29-2012, 10:36 PM   #2
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 421
Blog Entries: 28

Original Poster
Rep: Reputation: 2
nvm, i did not format it as swap:
Code:
mkswap /dev/sda2
 
Old 09-29-2012, 10:36 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,839

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
Did you do a "mkswap" ?.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ata_id HDIO_GET_IDENTITY failed for '/dev/sda' : Invalid argument igor012 Linux - Software 4 10-12-2012 11:35 AM
read swap header failed invalid arguement Fedora 12 rmknox Linux - Newbie 5 08-27-2010 06:31 PM
mount: Mounting /dev/sda2 on /mnt failed: Invalid argument dohpaz Slackware 7 05-25-2007 03:03 AM
swapon hda6 - invalid argument ??? thepasty Mandriva 1 07-09-2004 10:37 AM
swapon : /dev/hdc6 : invalid argument trutnev Red Hat 3 06-08-2004 10:57 PM


All times are GMT -5. The time now is 09:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration