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 |
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:
|
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:
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?). |
Quote:
|
Code:
SMART Attributes Data Structure revision number: 16 |
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... |
Quote:
|
Quote:
|
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! :hattip: |
Quote:
|
All times are GMT -5. The time now is 07:13 PM. |