SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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?
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.
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?).
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.
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.
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...
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.
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!
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).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.