LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 10-10-2020, 04:29 AM   #1
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Rep: Reputation: Disabled
Smile 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
Code:
https://linuxhint.com/format_usb_drive_linux/
thx

Last edited by andrewysk; 10-10-2020 at 05:20 AM.
 
Old 10-10-2020, 04:48 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,573
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
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.

Last edited by hazel; 10-10-2020 at 04:51 AM.
 
Old 10-10-2020, 04:52 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
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.
 
Old 10-10-2020, 04:54 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
"The list" and "The Method" is exactly the same as for any hard drive.
I use gparted, others prefer CLI utilities.
 
Old 10-10-2020, 05:17 AM   #5
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Timeshift said my cruzer blade sandisk is not linux partition.
Click image for larger version

Name:	4OLACIJ.png
Views:	36
Size:	145.6 KB
ID:	34279


the device is in Vfat format
Click image for larger version

Name:	upYWVab.png
Views:	26
Size:	95.2 KB
ID:	34282

Last edited by andrewysk; 10-10-2020 at 05:28 AM. Reason: attached new screenshot
 
Old 10-10-2020, 05:26 AM   #6
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
faster way to go to the device folder in cli

Branch out of this topic a bit.

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 ?
Click image for larger version

Name:	IgoTuto.png
Views:	24
Size:	133.8 KB
ID:	34281
 
Old 10-10-2020, 05:32 AM   #7
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,573
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
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.

Last edited by hazel; 10-10-2020 at 05:35 AM.
 
1 members found this post helpful.
Old 10-10-2020, 05:32 AM   #8
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hazel View Post
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
 
Old 10-10-2020, 06:57 AM   #9
m.a.l.'s pa
Member
 
Registered: Oct 2007
Location: albuquerque
Distribution: Debian, Arch, Kubuntu
Posts: 366

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by andrewysk View Post
Branch out of this topic a bit.

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.
 
Old 10-10-2020, 07:17 AM   #10
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,573
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
Quote:
Originally Posted by andrewysk View Post
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 ?
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.

Last edited by hazel; 10-10-2020 at 07:20 AM.
 
1 members found this post helpful.
Old 10-10-2020, 08:38 AM   #11
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by hazel View Post
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.
 
Old 10-10-2020, 08:55 AM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
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.
 
Old 10-10-2020, 11:18 AM   #13
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: 9 Methods To Check File System Type In Linux (Ext2, Ext3 or Ext4) LXer Syndicated Linux News 0 07-04-2017 05:54 PM
How to change file system from ext4 journeying to ext4 writeback ? 5883 Linux - Newbie 6 03-10-2014 08:04 AM
Is it safe to format USB flash to ext4 or ext4? joham34 Linux - Newbie 2 01-08-2011 11:58 AM
Formating FAT32, but linux created FAT32 is not like win created FAT32?? Difference? boki15 Linux - Newbie 19 07-21-2010 04:41 AM
How to format to FAT32, and how to mount my FAT32 partition. bonniehandi Linux - Newbie 16 03-05-2006 07:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration