A memory system comprising: a nonvolatile memory; and a controller electrically connected to the nonvolatile memory and configured to: manage a plurality of namespaces (NS #1 to NS #n) in the nonvolatile memory for storing a plurality of kinds of data having different update frequencies, the namespaces (NS #1 to NS #n) including a first namespace for storing a first type of data and a second namespace for storing a second type of data having a lower update frequency than the first type of data; encode first write data associated with an ID of the first namespace by using first coding for reducing wear of a memory cell to generate first encoded data having a first length; generate second encoded data by adding a first error correction code having a second length to the first encoded data, the second encoded data including the first encoded data having the first length and the first error correction code having the second length; write the second encoded data to the first namespace of the nonvolatile memory; encode second write data associated with an ID of the second namespace by using the first coding for reducing wear of a memory cell to generate third encoded data having a third length less than the first length; generate fourth encoded data by adding a second error correction code having a fourth length greater than the second length to the third encoded data, the fourth encoded data including the third encoded data having the third length and the second error correction code having the fourth length; and write the fourth encoded data to the second namespace of the nonvolatile memory. a nonvolatile memory; and a controller electrically connected to the nonvolatile memory and configured to: manage a plurality of namespaces (NS #1 to NS #n) in the nonvolatile memory for storing a plurality of kinds of data having different update frequencies, the namespaces (NS #1 to NS #n) including a first namespace for storing a first type of data and a second namespace for storing a second type of data having a lower update frequency than the first type of data; encode first write data associated with an ID of the first namespace by using first coding for reducing wear of a memory cell to generate first encoded data having a first length; generate second encoded data by adding a first error correction code having a second length to the first encoded data, the second encoded data including the first encoded data having the first length and the first error correction code having the second length; write the second encoded data to the first namespace of the nonvolatile memory; encode second write data associated with an ID of the second namespace by using the first coding for reducing wear of a memory cell to generate third encoded data having a third length less than the first length; generate fourth encoded data by adding a second error correction code having a fourth length greater than the second length to the third encoded data, the fourth encoded data including the third encoded data having the third length and the second error correction code having the fourth length; and write the fourth encoded data to the second namespace of the nonvolatile memory. manage a plurality of namespaces (NS #1 to NS #n) in the nonvolatile memory for storing a plurality of kinds of data having different update frequencies, the namespaces (NS #1 to NS #n) including a first namespace for storing a first type of data and a second namespace for storing a second type of data having a lower update frequency than the first type of data; encode first write data associated with an ID of the first namespace by using first coding for reducing wear of a memory cell to generate first encoded data having a first length; generate second encoded data by adding a first error correction code having a second length to the first encoded data, the second encoded data including the first encoded data having the first length and the first error correction code having the second length; write the second encoded data to the first namespace of the nonvolatile memory; encode second write data associated with an ID of the second namespace by using the first coding for reducing wear of a memory cell to generate third encoded data having a third length less than the first length; generate fourth encoded data by adding a second error correction code having a fourth length greater than the second length to the third encoded data, the fourth encoded data including the third encoded data having the third length and the second error correction code having the fourth length; and write the fourth encoded data to the second namespace of the nonvolatile memory.