Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] FS for USB-flash?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Perfect Gentleman
Veteran
Veteran


Joined: 18 May 2014
Posts: 1256

PostPosted: Mon May 01, 2017 5:56 am    Post subject: [Solved] FS for USB-flash? Reply with quote

I got Gentoo installed on USB-flash. USB is formatted in XFS. But lately FS becomes corrupted after doing nothing. Really, I did nothing for a couple of days, and today's morning system became un-pingable.

What's the best FS for headless installation on USB-flash?
or it's bad USB-flash?


Last edited by Perfect Gentleman on Thu May 04, 2017 10:40 am; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54849
Location: 56N 3W

PostPosted: Mon May 01, 2017 8:13 am    Post subject: Reply with quote

Perfect Gentleman,

USB Flash is slow since it rarely supports discard or wear levelling.
Journaled filesystems are bad for Flash too.

I use ext4 with the journal turned off on microSD cards, they are Flash.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Perfect Gentleman
Veteran
Veteran


Joined: 18 May 2014
Posts: 1256

PostPosted: Mon May 01, 2017 9:27 am    Post subject: Reply with quote

I use journaled FS because of power cut which happens rather often.
I used EXT4 without journal couple of years ago, and it was completely destroyed after two power cuts.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54849
Location: 56N 3W

PostPosted: Mon May 01, 2017 10:05 am    Post subject: Reply with quote

Perfect Gentleman,

By default, ext4 only journals metadata. A journal replay makes the filesystem metadata self consistent but says nothing about any user data that may be stored on the filesystem.
You can journal everything but that means updates take two writes, once to the journal then to the filesystem.

Journaling is not a magic bullet. You can still corrupt a filesystem with a power cut.
Its usually faster to do a journal replay that a full fsck.

For power cuts you need a UPS, so you can get a clean shut down.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3503

PostPosted: Mon May 01, 2017 12:57 pm    Post subject: Reply with quote

It's a case where I'd consider f2fs or perhaps some other so called "logging" filesystem. Something that doesn't really have any area for data, and instead stores everything in journal.
They have that nice property that it creates a new point in time view of the filesystem first and tags older views as dirty later, so your previous good version can never be partially overwritten, which in turn makes room for rolling back to the previous known good version in case of failure. Assuming this feature actually works :)
Back to top
View user's profile Send private message
Perfect Gentleman
Veteran
Veteran


Joined: 18 May 2014
Posts: 1256

PostPosted: Wed May 03, 2017 5:14 am    Post subject: Reply with quote

there was another blackout. USB FS had lots of errors corrected, but system is bootable and functioning.
Back to top
View user's profile Send private message
Perfect Gentleman
Veteran
Veteran


Joined: 18 May 2014
Posts: 1256

PostPosted: Thu May 04, 2017 10:41 am    Post subject: Reply with quote

USB-flash died today.
Back to top
View user's profile Send private message
NTU
Apprentice
Apprentice


Joined: 17 Jul 2015
Posts: 187

PostPosted: Thu May 04, 2017 12:10 pm    Post subject: Reply with quote

Microsoft says exFAT works great for SSDs and other flash media. Seems legit.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54849
Location: 56N 3W

PostPosted: Thu May 04, 2017 12:16 pm    Post subject: Reply with quote

NTU,

exFAT on Linux is depends on FUSE. That makes it slow because of all the context switches.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2158
Location: Berlin, Germany

PostPosted: Thu May 04, 2017 3:35 pm    Post subject: Reply with quote

USB flash drives sometimes have a "pretend to write successfully, but read only garbage" failure mode.

I have one USB flash drive that does precisely this. Copying small files is usually no problem, but copying a large file like an ISO image will cause parts of it to be corrupted (rsync told me it was about 300 KiB corrupted of a 4 GiB file).

See if your USB flash drive corrupts data by filling it with large files, then "echo 3 > /proc/sys/vm/drop_caches", then comparing sha1sum.
NeddySeagoon wrote:
Journaling is not a magic bullet. You can still corrupt a filesystem with a power cut.
Not if all parts of your storage observe write barriers correctly.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum