You are not logged in.

#1 2013-06-19 03:15:09

Max-P
Member
Registered: 2011-06-11
Posts: 164

mkfs.ntfs crashes the system

Hi all,

Here I am again with a weird kernel & swap bugs! But I'm pretty sure the kernel itself is okay, so newbie corner it is.

Here the problem: Doing this (/dev/sdb is a 16 GB USB key I want to format)

% sudo mkfs.ntfs /dev/sdb1
Cluster size has been automatically set to 4096 bytes.
Initializing device with zeroes:  2%^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C

Crashes my system in 30 seconds. As soon as I type the command, the computer gets extremely laggy, cursor barely reacts to mouse movement, can't ^C the command, few seconds later X is completely locked up and I switch to another terminal. Shortly after logging in, I lost acces to the terminal as well (too laggy), so I just unplugged the USB key, very bad idea from me:

[142571.154220] quiet_error: 29182 callbacks suppressed
[142571.154225] Buffer I/O error on device sdb1, logical block 2908602
[142571.154290] lost page write due to I/O error on sdb1
[142571.154297] Buffer I/O error on device sdb1, logical block 2908603
[142571.154358] lost page write due to I/O error on sdb1
[142571.154369] Buffer I/O error on device sdb1, logical block 2908604
[142571.154431] lost page write due to I/O error on sdb1
[142571.154435] Buffer I/O error on device sdb1, logical block 2908479
[142571.154497] lost page write due to I/O error on sdb1
[142571.154501] Buffer I/O error on device sdb1, logical block 2908753
[142571.154562] lost page write due to I/O error on sdb1
[142571.154567] Buffer I/O error on device sdb1, logical block 2801907
[142571.154629] lost page write due to I/O error on sdb1
[142571.154633] Buffer I/O error on device sdb1, logical block 2908635
[142571.154695] lost page write due to I/O error on sdb1
[142571.154700] Buffer I/O error on device sdb1, logical block 2908198
[142571.154761] lost page write due to I/O error on sdb1
[142571.154766] Buffer I/O error on device sdb1, logical block 2908199
[142571.154827] lost page write due to I/O error on sdb1
[142571.154831] Buffer I/O error on device sdb1, logical block 3199990
[142571.154893] lost page write due to I/O error on sdb1
[142576.287833] quiet_error: 47191 callbacks suppressed

I had to SysRq+RE to recover from this one. Then I tried it again, but I was able to recover the system this time, and I got this:

[145804.543734] sd 8:0:0:0: [sdb] Attached SCSI removable disk
[146114.823092] INFO: task kswapd0:58 blocked for more than 120 seconds.
[146114.823169] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[146114.823246] kswapd0         D 0000000000000022     0    58      2 0x00000008
[146114.823395]  ffff8801192ef838 0000000000000046 ffffffffa0148039 ffff8801192effd8
[146114.823637]  ffff8801192effd8 ffff8801192effd8 ffff8801192effd8 ffff880119495040
[146114.823878]  ffff880119063580 ffff88011763f710 ffff88011763f710 0000000000000004
[146114.824198] Call Trace:
[146114.824277]  [<ffffffffa0148039>] ? scsi_request_fn+0xa9/0x4a0 [scsi_mod]
[146114.824343]  [<ffffffff812285a3>] ? __blk_run_queue+0x33/0x40
[146114.824406]  [<ffffffff8122c47b>] ? queue_unplugged+0x3b/0xe0
[146114.824473]  [<ffffffff814b16af>] io_schedule+0x8f/0xe0
[146114.824535]  [<ffffffff8122d96a>] get_request+0x1aa/0x770
[146114.824598]  [<ffffffff81232b1e>] ? ioc_lookup_icq+0x4e/0x80
[146114.824663]  [<ffffffff8107ab80>] ? wake_up_bit+0x30/0x30
[146114.824726]  [<ffffffff8122fcc9>] blk_queue_bio+0x79/0x3e0
[146114.824788]  [<ffffffff8122ebf2>] generic_make_request+0xc2/0x110
[146114.824851]  [<ffffffff8122ecb3>] submit_bio+0x73/0x160
[146114.824916]  [<ffffffff811a346c>] ? bio_alloc_bioset+0x3c/0x130
[146114.824979]  [<ffffffff8119fea4>] submit_bh+0x114/0x200
[146114.825041]  [<ffffffff811a19d0>] __block_write_full_page+0x160/0x380
[146114.825108]  [<ffffffff811a45d0>] ? I_BDEV+0x10/0x10
[146114.825172]  [<ffffffff8119e6d0>] ? end_buffer_write_sync+0xb0/0xb0
[146114.825235]  [<ffffffff811a45d0>] ? I_BDEV+0x10/0x10
[146114.825297]  [<ffffffff8119e6d0>] ? end_buffer_write_sync+0xb0/0xb0
[146114.825360]  [<ffffffff811a1de8>] block_write_full_page_endio+0xd8/0x110
[146114.825424]  [<ffffffff811a1e35>] block_write_full_page+0x15/0x20
[146114.825487]  [<ffffffff811a4de8>] blkdev_writepage+0x18/0x20
[146114.825550]  [<ffffffff8111f1d0>] shrink_page_list+0x710/0x930
[146114.825614]  [<ffffffff8111f950>] shrink_inactive_list+0x150/0x450
[146114.825677]  [<ffffffff811201f1>] shrink_lruvec+0x201/0x4b0
[146114.825743]  [<ffffffff8116f586>] ? put_super+0x36/0x40
[146114.825806]  [<ffffffff8112050e>] shrink_zone+0x6e/0x190
[146114.825868]  [<ffffffff8112154c>] balance_pgdat+0x43c/0x5a0
[146114.825933]  [<ffffffff81121801>] kswapd+0x151/0x460
[146114.825994]  [<ffffffff8107ab80>] ? wake_up_bit+0x30/0x30
[146114.826056]  [<ffffffff811216b0>] ? balance_pgdat+0x5a0/0x5a0
[146114.826121]  [<ffffffff81079db0>] kthread+0xc0/0xd0
[146114.826191]  [<ffffffff81305270>] ? tty_ioctl+0x960/0xba0
[146114.826253]  [<ffffffff81079cf0>] ? kthread_create_on_node+0x120/0x120
[146114.826317]  [<ffffffff814b9fec>] ret_from_fork+0x7c/0xb0
[146114.826378]  [<ffffffff81079cf0>] ? kthread_create_on_node+0x120/0x120

I disabled swap and now I'm able to mkfs,ntfs, but it takes the whole available RAM (-/+ buffers is 1963MB). I'm typing this and this is the only tab I can open, if I dare try to open anything else system goes unstable (random app freezes like xfce4-panel, comes back if I close something else).

TL;DR: Question: Why does mkfs.ntfs crashes the system? How can I prevent it from doing that?

Offline

#2 2013-06-19 03:54:20

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: mkfs.ntfs crashes the system

It is probably not crashing your system, but is using all the resources.  Do "mkfs.ntfs --help" and look for the switch for quick or fast or something like that.  If you use that it will not zero out the partition and instead just make a filesystem like linux normally does.

Offline

#3 2013-06-19 04:24:55

Max-P
Member
Registered: 2011-06-11
Posts: 164

Re: mkfs.ntfs crashes the system

Hi, thanks for your answer.

Yes, I know that I can tell it to skip that part, but I actually wanted to zero the device properly. Zeroing a device shouldn't take that much RAM. I switched that to my desktop computer that was currently idle (because I have so work to do on my laptop), it's at 80% (formatting a 16 GB drive), and mkfs.ntfs current RAM usage is 15 GB in IO buffers. It still seems a bit odd to me that the default behavior takes that much RAM, what would happen if I formatted a 500 GB drive?? :S

Is it possible that the driver used by the kernel for my USB flash drive does things weirdly and try to map the whole thing in RAM or something? I remember also having trouble writing to that drive (and this is why I'm zeroing it completely), maybe that's more the problem than the fs and tools hmm

Offline

#4 2013-06-19 04:28:37

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: mkfs.ntfs crashes the system

A usb flash drive just uses the generic usb_storage module I think (unless you've got something really weird).  Let me try this and see what happens on my system.  Hold on a sec.

Mine isn't going crazy like that.  I have a SanDisk Cruzer 4GB USB2 flash drive in my computer using an Intel Series 7/C210 Chipset USB Subsystem, which is a USB 3.0 port using xhci_hcd.

Edit: But I can't seem to kill the damn thing.

Last edited by WonderWoofy (2013-06-19 04:36:52)

Offline

#5 2013-06-19 04:45:08

Max-P
Member
Registered: 2011-06-11
Posts: 164

Re: mkfs.ntfs crashes the system

I don't know if this helps, here's more dmesg:

[ 1762.195956] usb 2-1: new high-speed USB device number 2 using ehci-pci
[ 1762.322495] Initializing USB Mass Storage driver...
[ 1762.322576] scsi8 : usb-storage 2-1:1.0
[ 1762.322639] usbcore: registered new interface driver usb-storage
[ 1762.322641] USB Mass Storage support registered.
[ 1767.706240] scsi 8:0:0:0: Direct-Access     Lexar    JD FireFly       1100 PQ: 0 ANSI: 0 CCS
[ 1767.707894] sd 8:0:0:0: [sdc] 31326208 512-byte logical blocks: (16.0 GB/14.9 GiB)
[ 1767.708770] sd 8:0:0:0: [sdc] Write Protect is off
[ 1767.708774] sd 8:0:0:0: [sdc] Mode Sense: 43 00 00 00
[ 1767.709662] sd 8:0:0:0: [sdc] No Caching mode page present
[ 1767.709667] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[ 1767.713411] sd 8:0:0:0: [sdc] No Caching mode page present
[ 1767.713414] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[ 1767.714417]  sdc: sdc1
[ 1767.718813] sd 8:0:0:0: [sdc] No Caching mode page present
[ 1767.718817] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[ 1767.718819] sd 8:0:0:0: [sdc] Attached SCSI removable disk

It does seem to use usb-storage as expected. I will try to find my other drive I lost somewhere on my desk and see if it does the same, I don't remember having my other drive going crazy like that.

It also seems like dd works fine on it (probably flushes the buffer on every write), I'll keep testing on my side...

Offline

#6 2013-06-19 04:49:11

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: mkfs.ntfs crashes the system

Yeah, mine is exactly the same with the exception of the size (and it is sdd).  Oh but my "Mode Sense" is "43 00 00 08", but I haven't the slightest idea what that means.

Edit: Is this something that is critical for you current needs?  If so, since you have reported that dd works, you probably know you could just do something along the lines of

# dd if=/dev/zero of=/dev/sdc1 bs=4M && mkfs.ntfs -f /dev/sdc1 

At least until you figure out why your system is acting this way.

Last edited by WonderWoofy (2013-06-19 04:52:43)

Offline

#7 2013-06-19 05:13:18

Max-P
Member
Registered: 2011-06-11
Posts: 164

Re: mkfs.ntfs crashes the system

No, not critical at all. I actually let it run on my desktop and it went through the whole drive fine, once it has allocated all the RAM mkfs actually runs ok. So I just popped the key in my desktop, ran mkfs and went away working on my laptop. It's just very annoying because I can't do any work while it runs, because as soon as any other program allocates memory (like opening a browser tab or a text file), the allocation causes another process to randomly freeze and I have to free memory somewhere else, because mkfs takes everything.

I was just curious, there are workarounds for it (like dd), it's just annoying and I haven't noticed anything weird on any other drive. As I said I will continue playing with the key later and will come back en see what the hell is happening in it.

Offline

Board footer

Powered by FluxBB