methods to change a usb stick format to ext4 from fat32
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
methods to change a usb stick format to ext4 from fat32
I can't find a collection of method to change an usb stick to linux acceptable format.
I have a 32Gb usbstick that i want to use as timeshift snapshot storage. but it says it is not linux format..
Instead of using Gparted, is there any other way ? I was thinking if it it possible to change the format without formating the whole storage and causing detroy of data on it.
also
Can you guys please contribute to a complete list of method ? i want to keep a record of it.. and try some method also, like simple and easy method.
Anything outside of that listed in
The normal way to format a partition is to use one of the mkfs commands, for example mkfs.ext4. These commands must be used with care as they will erase everything on that partition.
A lot of memory sticks are not partitioned at all when you buy them, so in that case you would simply format the whole device. I would start by plugging the drive in and using dmesg|tail to see what your kernel calls it (probably sdb but it could be something different) and whether there are any internal partitions like sdb1. A command like
Code:
mkfs.ext4 /dev/sdb
or
Code:
mkfs.ext4 /dev/sdb1
as appropriate should create a filesystem there with default properties.
If there are separate partitions on the drive, formatting one of them will not affect data in any of the others. But if it is unpartitioned, you can't format without destroying the present contents.
both ext4 and fat32 are accepted by linux. So I do not really understand what do you mean. What do you want to achieve?
What did you try? what "says" it is not in linux format?
ext4 and fat32 are different, so better to save everything from that usb stick before [re]formatting.
Is there way to use cli faster / easier to go to the usb stick from terminal without have to enter such a long name ?
see my terminal for example: I did not know what is the path to go to the usb stick, hence i have to enter such a long name.. is there anyother way to go to the device without the hassle of such long path ?
When you buy one of these sticks in a shop, it is always formatted as vfat. Usually it is not partitioned but forms a single filesystem, like an old-fashioned floppy.
As pan64 has said, vfat filesytems are accepted by most Linux software because the kernel includes a vfat driver. But it is clear from your image that the snapshot utility does not accept either vfat or ntfs, so you will need to use some form of mkfs to reformat your stick. And that destroys data; it can't be done nondestructively.
Copy onto your hard drive any data you wish to keep, reformat and then you can use the stick as a dump device.
The best way to solve the name problem is to use the bash alias facility. Set up an alias for a path that you use frequently.
The normal way to format a partition is to use one of the mkfs commands, for example mkfs.ext4. These commands must be used with care as they will erase everything on that partition.
A lot of memory sticks are not partitioned at all when you buy them, so in that case you would simply format the whole device. I would start by plugging the drive in and using dmesg|tail to see what your kernel calls it (probably sdb but it could be something different) and whether there are any internal partitions like sdb1. A command like
Code:
mkfs.ext4 /dev/sdb
or
Code:
mkfs.ext4 /dev/sdb1
as appropriate should create a filesystem there with default properties.
If there are separate partitions on the drive, formatting one of them will not affect data in any of the others. But if it is unpartitioned, you can't format without destroying the present contents.
I am trying out
Code:
dmsg|tail
, so weird. why it only lists out sde ? while i have 1 more usb stick plugged into, but it never shows ?
Code:
[enos-andrew@enos-andrew-pc ~]$ dmesg|tail
[50514.275996] scsi host7: usb-storage 2-1.1.3:1.0
[50515.291466] scsi 7:0:0:0: Direct-Access SanDisk Cruzer Slice 1.20 PQ: 0 ANSI: 5
[50515.292842] sd 7:0:0:0: [sde] 62530624 512-byte logical blocks: (32.0 GB/29.8 GiB)
[50515.293517] sd 7:0:0:0: [sde] Write Protect is off
[50515.293518] sd 7:0:0:0: [sde] Mode Sense: 43 00 00 00
[50515.293747] sd 7:0:0:0: [sde] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[50515.322593] sde: sde1
[50515.323678] sd 7:0:0:0: [sde] Attached SCSI removable disk
[50515.551238] FAT-fs (sde1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[51165.217989] usb 2-1.1.3: USB disconnect, device number 12
[enos-andrew@enos-andrew-pc ~]$ dmesg|tail
[51173.990733] usb-storage 2-1.1.3:1.0: USB Mass Storage device detected
[51173.990901] scsi host7: usb-storage 2-1.1.3:1.0
[51175.006482] scsi 7:0:0:0: Direct-Access SanDisk Cruzer Slice 1.20 PQ: 0 ANSI: 5
[51175.007882] sd 7:0:0:0: [sde] 62530624 512-byte logical blocks: (32.0 GB/29.8 GiB)
[51175.008553] sd 7:0:0:0: [sde] Write Protect is off
[51175.008555] sd 7:0:0:0: [sde] Mode Sense: 43 00 00 00
[51175.008805] sd 7:0:0:0: [sde] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[51175.040690] sde: sde1
[51175.041775] sd 7:0:0:0: [sde] Attached SCSI removable disk
[51175.271539] FAT-fs (sde1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[enos-andrew@enos-andrew-pc ~]$ dmesg|tail
[51173.990733] usb-storage 2-1.1.3:1.0: USB Mass Storage device detected
[51173.990901] scsi host7: usb-storage 2-1.1.3:1.0
[51175.006482] scsi 7:0:0:0: Direct-Access SanDisk Cruzer Slice 1.20 PQ: 0 ANSI: 5
[51175.007882] sd 7:0:0:0: [sde] 62530624 512-byte logical blocks: (32.0 GB/29.8 GiB)
[51175.008553] sd 7:0:0:0: [sde] Write Protect is off
[51175.008555] sd 7:0:0:0: [sde] Mode Sense: 43 00 00 00
[51175.008805] sd 7:0:0:0: [sde] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[51175.040690] sde: sde1
[51175.041775] sd 7:0:0:0: [sde] Attached SCSI removable disk
Is there way to use cli faster / easier to go to the usb stick from terminal without have to enter such a long name ?
see my terminal for example: I did not know what is the path to go to the usb stick, hence i have to enter such a long name.. is there anyother way to go to the device without the hassle of such long path ? Attachment 34281
My approach is to get the filename from the output of the lsblk command, highlight the filename with the cursor, and then middle-click to paste it into whatever command I'm running. Quick and easy.
, so weird. why it only lists out sde ? while i have 1 more usb stick plugged into, but it never shows ?
Because piping dmesg through the "tail" command causes only the last few lines of the kernel's message ring to be printed. You want to know what this usb device is called in order to format it, so you plug it in and look to see how the kernel names it.
If you use dmesg by itself, you'll get a huge output which will include the recognition and naming of all your disks and partitions.
btw, the output confirms that the current format is vfat, which is normal for a newly bought stick but no use for what you want to use it for.
The best way to solve the name problem is to use the bash alias facility. Set up an alias for a path that you use frequently.
I see, from what you said, i suppose it means there is not shorter way to type "/run/media/user/usbstick". Alias is not that good in this case, because i have many of such usbstick, it would takes so many alias if i gonna do for each of them.
Thanks. Your advices is very helpful. Appreciate it.
Typically flash drives <= 32GB are formatted as FAT32 and above is exFAT but not always. Since Timeshift uses hard links the destination filesystem must be a linux type i.e. ext4 etc.
If you assign a label to the filesystem it will be used as part of the mount path so it should make things simpler.
I'm not sure exactly what you are trying to do when you type in the mount point. If you want to format the device to ext4 or similar you need the device name, something like /dev/sdc1. You can get that from lsblk. You don't want to use the mount point to do low-level operations. Like ondoho, I prefer gparted, which works well and lets me see what I'm going to do, but command-line tools will do the job if that's your preference.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.