LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 01-16-2012, 10:31 AM   #1
FeyFre
Member
 
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 307

Rep: Reputation: 22
Question Does mkswap -c secure?


Hi

Recently I got into possession the one moderately old hard disk. So decided to use it partially as swap device. Created 4GB size partition at the beginning of disk and run mkswawp -c /dev/sdb1.

Question:
mkswap did its work and notified me about a number of bad blocks. Is is safe to use such partition as swap? I.e. can I hope those bad blocks became marked as such and will never be used by kernel?

Regards, Yaroslav
 
Old 01-16-2012, 10:42 AM   #2
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 2,399

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
no, it's not safe: for what I know (the man page), mkswap doesn't mark bad blocks, it just reports them.

bad blocks under a certain number should be handled at SMART level and the operating system should not even see them: if you are seeing them it means that the drive is no more reliable.

read the old mkswap man page:
Quote:
Nobody wants to use a swap space with hundreds of bad blocks.
(I would not even use a swap space with 1 bad block.)

Last edited by ponce; 01-16-2012 at 10:58 AM.
 
Old 01-16-2012, 11:33 AM   #3
FeyFre
Member
 
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 307

Original Poster
Rep: Reputation: 22
I have read somewhere too about mkswap behaviour with bad-blocks(about not marking, but counting only), but cannot remember where(and definitely not in man mkswap), so decided to try...
Quote:
bad blocks under a certain number should be handled at SMART
SMART said device has 96(or something like) relocated blocks. I don't know how much it for 100GB HDD.
In any case I have created ext2 partition(via mkfs.ext2 -c /dev/sdb2, mkfs.ext2 -cc takes more then 8 hours to finish, and I never let it done) on the rest of disk, and it made copy of inode tables on bad block(fsck reports the same write problem on the same block each time I run it). Does it means mkfs.ext2 doesn't marks bad blocks either?

PS: now I'm sure, why my system freezed once Neither remote nor console access was available, but animation in flashplayer continued to play independently(onboard shader?).
 
Old 01-16-2012, 12:06 PM   #4
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Ruhr Area, Germany
Distribution: Slackware64 14.0
Posts: 1,517

Rep: Reputation: 90
Quote:
Originally Posted by FeyFre View Post
SMART said device has 96(or something like) relocated blocks. I don't know how much it for 100GB HDD.
Check to make sure the "raw value" (last column) of the SMART output in that line. I am no expert on smartctl and cannot read VALUE, WORST and THRESH values to make any meaning. From my experience, if you have one bad block you will get more and more bad blocks very fast. Show me one bad block and I am running to get a new harddisk. So to answer your question - yes, I think that 96 bad blocks (if that's the "RAW_VALUE" output) is way too much.
 
Old 01-16-2012, 02:18 PM   #5
FeyFre
Member
 
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 307

Original Poster
Rep: Reputation: 22
Code:
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   100   098   051    Pre-fail  Always       -       1
  3 Spin_Up_Time            0x0007   100   100   025    Pre-fail  Always       -       3456
  4 Start_Stop_Count        0x0032   094   094   000    Old_age   Always       -       6521
  5 Reallocated_Sector_Ct   0x0033   096   096   011    Pre-fail  Always       -       9
  7 Seek_Error_Rate         0x000f   100   100   051    Pre-fail  Always       -       0
  8 Seek_Time_Performance   0x0025   100   100   015    Pre-fail  Offline      -       9497
  9 Power_On_Half_Minutes   0x0032   099   099   000    Old_age   Always       -       7393h+28m
 10 Spin_Retry_Count        0x0033   100   100   051    Pre-fail  Always       -       1
 11 Calibration_Retry_Count 0x0012   100   100   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   097   097   000    Old_age   Always       -       3596
194 Temperature_Celsius     0x0022   145   094   000    Old_age   Always       -       31
195 Hardware_ECC_Recovered  0x001a   100   100   000    Old_age   Always       -       1531
196 Reallocated_Event_Count 0x0032   086   086   000    Old_age   Always       -       32
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
198 Total_Offl_Uncorrectabl 0x0030   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x000a   100   100   051    Old_age   Always       -       0
201 Soft_Read_Error_Rate    0x000a   100   100   051    Old_age   Always       -       0
And I beginning to do not trust SMART. I know this HDD is quite old, but my primary HDD is no more than half year aged and it(SMART) shows very bad statistics(worst than for this HDD), but I have not any problems with it.
 
Old 01-16-2012, 02:19 PM   #6
55020
Member
 
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 312
Blog Entries: 4

Rep: Reputation: 296Reputation: 296Reputation: 296
AFAIK bad blocks only get revectored when the block is *written*. Neither mkswap -c or mke2fs -c perform writes, so any bad blocks will stay bad. (But mke2fs -c -c does do writes, see man mke2fs).

Look at 'smartctl -a /dev/sdb' to see how long ago all those errors happened. If they all happened at the same time a long time ago, the errors may have been caused by an external event (low external temperature, or being dropped, or power brown-out) and the disk *may* be ok.

To clear the bad blocks, I would do 'dd if=/dev/zero of=/dev/sdb bs=16384', and then do 'dd if=/dev/sdb of=/dev/null bs=16384', and then look at dmesg. If there were no kernel errors logged in the second 'dd', the disk *may* be ok.

But I certainly wouldn't put the only copies of photos of my children on that disk...
 
Old 01-16-2012, 04:52 PM   #7
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Ruhr Area, Germany
Distribution: Slackware64 14.0
Posts: 1,517

Rep: Reputation: 90
Quote:
Originally Posted by FeyFre View Post
Code:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  5 Reallocated_Sector_Ct   0x0033   096   096   011    Pre-fail  Always       -       9
And I beginning to do not trust SMART. I know this HDD is quite old, but my primary HDD is no more than half year aged and it(SMART) shows very bad statistics(worst than for this HDD), but I have not any problems with it.
As I understand it you have 9 reallocated sectors. Do what 55020 suggested and make a backup of your important files. Did you already perform a long disk self test with smartctl? Might be a bit paranoid, but in my case when the first reallocated sectors occured on any disk others came along very quickly. I wouldn't be too worried about these other "pre-fail"s though.
 
Old 01-16-2012, 06:14 PM   #8
FeyFre
Member
 
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 307

Original Poster
Rep: Reputation: 22
Quote:
a backup of your important files.
Using that disk as a storage of downloadable, rarely used data(can be redownloaded in a few hours).
 
Old 01-17-2012, 10:29 AM   #9
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,040
Blog Entries: 1

Rep: Reputation: 1367Reputation: 1367Reputation: 1367Reputation: 1367Reputation: 1367Reputation: 1367Reputation: 1367Reputation: 1367Reputation: 1367Reputation: 1367
Member response

Hi,

I would get the manufactures disk diagnostics and perform to hopefully get a reliable result. You should not use the drive until certain that the bad blocks are indeed 'bad'. Especially within areas that are to be used for swap.

Most certainly do not use with a swap partition on it. Not reliable and you will just open Pandora's box to use a swap partition with bad blocks. You could use a 'swapfile' by 'dd if=/dev/zero of=swapfile bs=1024 count=65536' then use mkswap on that 'swapfile' to confirm and create the swapfile with no errors. Do a 'man mkswap' to fully understand.
HTH!
 
Old 01-17-2012, 10:46 AM   #10
FeyFre
Member
 
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 307

Original Poster
Rep: Reputation: 22
Quote:
You could use a 'swapfile' by 'dd if=/dev/zero of=swapfile bs=1024 count=65536'
Yse, I do know about 'swapfile'. Really, I don't need swap at all(it is not so easy to fill up 2GB RAM). Primary goal of using swap is to have ability to go into S4. Apparently swapfile is not usable solution here yet(at least I do not know any case).
 
  


Reply

Tags
swap


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
mkswap gives command not found error yoojamu Red Hat 6 12-12-2008 02:10 PM
mkswap on wrong partition (help!) PherricOxide Linux - Software 2 12-18-2007 07:18 AM
Performed mkswap on / partition! phaeton Linux - General 3 03-15-2006 09:18 AM
/sbin/mkswap: Permission Denied Ikebo Fedora 3 08-16-2005 11:11 PM
mkswap harakiri! lol Martin Strand Linux - Newbie 5 04-19-2005 01:59 PM


All times are GMT -5. The time now is 12:45 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration