{"id":2261,"date":"2009-08-01T15:51:32","date_gmt":"2009-08-01T15:51:32","guid":{"rendered":"http:\/\/t.motd.kr\/articles\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel"},"modified":"2022-12-28T01:44:58","modified_gmt":"2022-12-27T16:44:58","slug":"changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel","status":"publish","type":"post","link":"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/","title":{"rendered":"Changing the default codepage of VFAT without rebuilding Linux kernel"},"content":{"rendered":"\n

Since freedesktop.org has moved its disk management facility from HAL<\/span> to DeviceKit-disks (devkit-disks), I could not override the default codepage of a VFAT<\/span> USB<\/span> storage device. DevKit does not allow to mount VFAT<\/span> with the codepage option, and it was a problem to me because I use UTF<\/span>-8 as the default codepage of the Linux partitions while most VFAT<\/span> partiitions and USB<\/span> disks were using CP949 (codepage 949).<\/p>\n\n\n\n

A known workaround for this issue is to specify the mount options in \/etc\/fstab explicitly, but it does not scale because USB<\/span> disks change its device path very often, especially when many USB<\/span> devices are plugged in.<\/p>\n\n\n\n

Consequently, I wrote a simple script that puts a watch on \/etc\/mtab file and remount VFAT<\/span> with an explicit codepage option if necessary. I start up this watcher script in my \/etc\/rc.local so that I don\u2019t need to care about codepage issues anymore.<\/p>\n\n\n\n

#!\/bin\/sh\n# \/usr\/local\/bin\/vfat-watch\n# Exit if running already.\nif [ \"x`pgrep -of 'vfat-watch'`\" != \"x$\" ]; then\n  exit 1\nfi\nwhile true; do\n  cat \/etc\/mtab | grep vfat | grep -v codepage | cut -d' ' -f1 | while read -r FS; do\n    # Choose your preferred codepage.  949 = Korean\n    mount -o remount,codepage=949 \"$FS\"\n  done\n  sleep 1\ndone &<\/code><\/pre>\n\n\n\n

Because this script scans for the mtab file every second, you might see some problem when you perform some operation on the mounted VFAT<\/span> too soon, but it shouldn\u2019t be a problem for most cases.<\/p>\n\n\n\n

\ub9ac\ub205\uc2a4 \ucee4\ub110\uc744 \ub9ac\ube4c\ub4dc\ud558\uc9c0 \uc54a\uace0 VFAT<\/span> \ub514\ud3f4\ud2b8 \ucf54\ub4dc\ud398\uc774\uc9c0 \ubc14\uafb8\uae30<\/p>\n\n\n\n

Freedesktop.org \uac00 \ub514\uc2a4\ud06c \uad00\ub9ac \uae30\ub2a5 \uc81c\uacf5\uc790\ub97c HAL<\/span> \uc5d0\uc11c DeviceKit-disks (devkit-disks) \ub85c \ubcc0\uacbd\ud558\uc5ec \ub354 \uc774\uc0c1 USB<\/span> \ub514\uc2a4\ud06c\uc758 \uae30\ubcf8 \ucf54\ub4dc\ud398\uc774\uc9c0\ub97c \uc9c0\uc815\ud560 \uc218 \uc5c6\uac8c \ub418\uc5c8\uc2b5\ub2c8\ub2e4. DevKit \uc740 VFAT<\/span> \uc744 \ub9c8\uc6b4\ud2b8\ud560 \ub54c codepage \uc635\uc158\uc744 \uc804\ud600 \uc8fc\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ub54c\ubb38\uc5d0 \ub9ac\ub205\uc2a4 \uae30\ubcf8 \ubb38\uc790\uc14b\uc740 UTF<\/span>-8 \uc73c\ub85c VFAT<\/span> \ubb38\uc790\uc14b\uc740 CP949 (\ucf54\ub4dc\ud398\uc774\uc9c0 949) \ub85c \uc0ac\uc6a9\ud558\ub294 \uacbd\uc6b0\uc5d0\ub294 \ubb38\uc81c\uac00 \ub429\ub2c8\ub2e4.<\/p>\n\n\n\n

\uc54c\ub824\uc9c4 \ud574\uacb0\ucc45\uc740 \/etc\/fstab \uc5d0 \ub9c8\uc6b4\ud2b8 \uc635\uc158\uc744 \uc9c1\uc811 \uc801\uc5b4 \uc8fc\ub294 \uac83\uc774 \uc788\uc73c\ub098, \ub9ce\uc740 USB<\/span> \uc7a5\uce58\uac00 \uc5f0\uacb0\ub418\uc5b4 \uc788\ub294 \uacbd\uc6b0 \uc7a5\uce58\uc758 \uacbd\ub85c\uac00 \uc790\uc8fc \ubc14\ub00c\uae30 \ub54c\ubb38\uc5d0 \uc720\uc5f0\ud558\uc9c0\uac00 \ubabb\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n

\uadf8\ub798\uc11c \/etc\/mtab \ub97c \ubaa8\ub2c8\ud130\ub9c1\ud558\uace0 \uc788\ub2e4\uac00 \ud544\uc694\ud55c \uacbd\uc6b0 codepage \uc635\uc158\uc744 \uba85\uc2dc\ud574 VFAT<\/span> \uc744 \ub2e4\uc2dc \ub9c8\uc6b4\ud2b8\ud574 \uc8fc\ub294 \uc2a4\ud06c\ub9bd\ud2b8\ub97c \uc791\uc131\ud588\uc2b5\ub2c8\ub2e4. \uc800\ub294 \uc774 \uac10\uc2dc \uc2a4\ud06c\ub9bd\ud2b8\ub97c \/etc\/rc.local \uc5d0\uc11c \uc2dc\uc791\ud574\uc11c \ucf54\ub4dc\ud398\uc774\uc9c0 \uc774\uc288\ub97c \ub354 \uc774\uc0c1 \uc2e0\uacbd\uc4f8 \uc77c\uc774 \uc5c6\ub3c4\ub85d \ud588\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n

#!\/bin\/sh\n# \/usr\/local\/bin\/vfat-watch\n# Exit if running already.\nif [ \"x`pgrep -of 'vfat-watch'`\" != \"x$\" ]; then\n  exit 1\nfi\nwhile true; do\n  cat \/etc\/mtab | grep vfat | grep -v codepage | cut -d' ' -f1 | while read -r FS; do\n    # Choose your preferred codepage.  949 = Korean\n    mount -o remount,codepage=949 \"$FS\"\n  done\n  sleep 1\ndone &<\/code><\/pre>\n\n\n\n

\uc774 \uc2a4\ud06c\ub9bd\ud2b8\ub294 mtab \ud30c\uc77c\uc744 1 \ucd08\uc5d0 \ud55c \ubc88\uc529 \uc2a4\uce94\ud558\ubbc0\ub85c \ub9c8\uc6b4\ud2b8\ub41c VFAT<\/span> \uc5d0 \ub108\ubb34 \uc77c\ucc0d \uc811\uadfc\ud558\ub824 \ud560 \ub54c \ubb38\uc81c\uac00 \uc0dd\uae38 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ud558\uc9c0\ub9cc \ub300\ubd80\ubd84\uc758 \uacbd\uc6b0\uc5d0\ub294 \ubcc4 \ubb38\uc81c\uac00 \uc548 \ub420 \ub4ef \ud558\ub124\uc694.<\/p>\n","protected":false},"excerpt":{"rendered":"

Since freedesktop.org has moved its disk management facility from HAL to DeviceKit-disks (devkit-disks), I could not override the default codepage of a VFAT USB storage device. DevKit does not allow to mount VFAT with the codepage option, and it was a problem to me because I use UTF-8 as the default codepage of the Linux… Continue reading →<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"yoast_head":"Changing the default codepage of VFAT without rebuilding Linux kernel — T's message of the day<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Changing the default codepage of VFAT without rebuilding Linux kernel — T's message of the day\" \/>\n<meta property=\"og:description\" content=\"Since freedesktop.org has moved its disk management facility from HAL to DeviceKit-disks (devkit-disks), I could not override the default codepage of a VFAT USB storage device. DevKit does not allow to mount VFAT with the codepage option, and it was a problem to me because I use UTF-8 as the default codepage of the Linux... Continue reading →\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/\" \/>\n<meta property=\"og:site_name\" content=\"T's message of the day\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/trustin\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/trustin\" \/>\n<meta property=\"article:published_time\" content=\"2009-08-01T15:51:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-27T16:44:58+00:00\" \/>\n<meta name=\"author\" content=\"Trustin Lee\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/www.twitter.com\/trustin\" \/>\n<meta name=\"twitter:site\" content=\"@trustin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Trustin Lee\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/\"},\"author\":{\"name\":\"Trustin Lee\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\"},\"headline\":\"Changing the default codepage of VFAT without rebuilding Linux kernel\",\"datePublished\":\"2009-08-01T15:51:32+00:00\",\"dateModified\":\"2022-12-27T16:44:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/\"},\"wordCount\":224,\"publisher\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\"},\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/\",\"url\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/\",\"name\":\"Changing the default codepage of VFAT without rebuilding Linux kernel — T's message of the day\",\"isPartOf\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#website\"},\"datePublished\":\"2009-08-01T15:51:32+00:00\",\"dateModified\":\"2022-12-27T16:44:58+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/vault.motd.kr\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Changing the default codepage of VFAT without rebuilding Linux kernel\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#website\",\"url\":\"https:\/\/vault.motd.kr\/wordpress\/\",\"name\":\"T's message of the day\",\"description\":\"the best is yet to come\",\"publisher\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/vault.motd.kr\/wordpress\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\",\"name\":\"Trustin Lee\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png\",\"contentUrl\":\"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png\",\"width\":966,\"height\":966,\"caption\":\"Trustin Lee\"},\"logo\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/t.motd.kr\/\",\"https:\/\/www.facebook.com\/trustin\",\"https:\/\/www.instagram.com\/trustinlee\/\",\"https:\/\/www.linkedin.com\/in\/trustin\",\"https:\/\/twitter.com\/https:\/\/www.twitter.com\/trustin\",\"https:\/\/www.youtube.com\/@trustinlee\"]}]}<\/script>","yoast_head_json":{"title":"Changing the default codepage of VFAT without rebuilding Linux kernel — T's message of the day","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/","og_locale":"en_US","og_type":"article","og_title":"Changing the default codepage of VFAT without rebuilding Linux kernel — T's message of the day","og_description":"Since freedesktop.org has moved its disk management facility from HAL to DeviceKit-disks (devkit-disks), I could not override the default codepage of a VFAT USB storage device. DevKit does not allow to mount VFAT with the codepage option, and it was a problem to me because I use UTF-8 as the default codepage of the Linux... Continue reading →","og_url":"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/","og_site_name":"T's message of the day","article_publisher":"https:\/\/www.facebook.com\/trustin","article_author":"https:\/\/www.facebook.com\/trustin","article_published_time":"2009-08-01T15:51:32+00:00","article_modified_time":"2022-12-27T16:44:58+00:00","author":"Trustin Lee","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/www.twitter.com\/trustin","twitter_site":"@trustin","twitter_misc":{"Written by":"Trustin Lee","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/#article","isPartOf":{"@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/"},"author":{"name":"Trustin Lee","@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d"},"headline":"Changing the default codepage of VFAT without rebuilding Linux kernel","datePublished":"2009-08-01T15:51:32+00:00","dateModified":"2022-12-27T16:44:58+00:00","mainEntityOfPage":{"@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/"},"wordCount":224,"publisher":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d"},"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/","url":"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/","name":"Changing the default codepage of VFAT without rebuilding Linux kernel — T's message of the day","isPartOf":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#website"},"datePublished":"2009-08-01T15:51:32+00:00","dateModified":"2022-12-27T16:44:58+00:00","breadcrumb":{"@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2261\/changing-the-default-codepage-of-vfat-without-rebuilding-linux-kernel\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vault.motd.kr\/wordpress\/"},{"@type":"ListItem","position":2,"name":"Changing the default codepage of VFAT without rebuilding Linux kernel"}]},{"@type":"WebSite","@id":"https:\/\/vault.motd.kr\/wordpress\/#website","url":"https:\/\/vault.motd.kr\/wordpress\/","name":"T's message of the day","description":"the best is yet to come","publisher":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vault.motd.kr\/wordpress\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d","name":"Trustin Lee","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png","contentUrl":"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png","width":966,"height":966,"caption":"Trustin Lee"},"logo":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/t.motd.kr\/","https:\/\/www.facebook.com\/trustin","https:\/\/www.instagram.com\/trustinlee\/","https:\/\/www.linkedin.com\/in\/trustin","https:\/\/twitter.com\/https:\/\/www.twitter.com\/trustin","https:\/\/www.youtube.com\/@trustinlee"]}]}},"_links":{"self":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts\/2261"}],"collection":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/comments?post=2261"}],"version-history":[{"count":2,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts\/2261\/revisions"}],"predecessor-version":[{"id":5932,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts\/2261\/revisions\/5932"}],"wp:attachment":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/media?parent=2261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/categories?post=2261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/tags?post=2261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}