LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 09-05-2009, 09:31 AM   #1
gymnart
Member
 
Registered: Oct 2005
Distribution: SUSE 11.4
Posts: 331

Rep: Reputation: 30
How much left on usb stick?


I can't remember where to find the command(s) to give me the following info:
The capacity of the usb thumb drive and how much space is left on it. Can the info be "human readable"? (in GB or MB rather than just bytes).
When I look at the properties in Konquerer, it just gives me the amount used, not its capacity and how much is left on it.
 
Old 09-05-2009, 09:32 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Linux Mint
Posts: 8,516

Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
in a terminal type
Code:
df -h
 
Old 09-05-2009, 09:32 AM   #3
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
From the command line, you can try
Code:
df -h
and you will see information about all the available mounted partitions, your thumb drive included.

A KDE application which shows the same info is KDiskFree. On my OpenSuse 11.1 it resides in the K menu under Applications --> System --> File System --> Disk Usage. From the command line, just type kdf and press enter.

Last edited by colucix; 09-05-2009 at 09:38 AM.
 
Old 09-05-2009, 09:47 AM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,473
Blog Entries: 4

Rep: Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525
Hi,

Just a few links to aid you in the future;

Linux Documentation Project
Rute Tutorial & Exposition
Linux Command Guide
Linux Newbie Admin Guide
LinuxSelfHelp
Getting Started with Linux

These links and others can be found at 'Slackware-Links' . More than just SlackwareŽ links!
 
Old 09-05-2009, 09:52 AM   #5
gymnart
Member
 
Registered: Oct 2005
Distribution: SUSE 11.4
Posts: 331

Original Poster
Rep: Reputation: 30
Thanks for your replies.
@colucix: Your suggestion about using KDiskFree helped a lot. While it didn't give me any info about the usb stick, I did find another tool that did the job: KDirStat. (I'm using an older SuSE).
@repo: I did the command and it just gave me the hard drive info, and it did not include the usb stick. So, I tried it this way: df -h /dev/sda and it gave me the info. I needed

Thanks guys!
 
Old 09-08-2009, 12:56 PM   #6
gymnart
Member
 
Registered: Oct 2005
Distribution: SUSE 11.4
Posts: 331

Original Poster
Rep: Reputation: 30
Back to the df command:
One thing I noticed, after getting the info and when my 2 gig usb is taken out and the 8 gig is put in its place and the command is repeated, the info is the same -- as if it hasn't read what is on the stick. It should give me different information. Also, if I do the command as: df -h /media/usbdisk it tells me that it has 0 items on it. I've also just noticed that the info I was being given this whole time was for tmpfs and not the usb stick.

When I use df -h it just gives me this:
Code:
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda2              74G   70G  3.8G  95% /
tmpfs                1013M     0 1013M   0% /dev/shm
As you can see, there is no mention of the usb disk.
 
Old 09-08-2009, 01:04 PM   #7
j_jerry
Member
 
Registered: Sep 2009
Distribution: fedora 11
Posts: 318

Rep: Reputation: 46
Try this command 'fdisk -l'

The result you posted is, I think is just about your hard drive. Post what you've got when the 2g flashdisk was inserted
 
Old 09-08-2009, 01:26 PM   #8
gymnart
Member
 
Registered: Oct 2005
Distribution: SUSE 11.4
Posts: 331

Original Poster
Rep: Reputation: 30
This was with both of the usbsticks plugged in:
Code:
fdisk -l

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1         128     1028128+  82  Linux swap / Solaris
/dev/hda2   *         129        9729    77120032+  83  Linux

Disk /dev/sdb: 2017 MB, 2017525248 bytes
64 heads, 63 sectors/track, 977 cylinders
Units = cylinders of 4032 * 512 = 2064384 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         969     1953439+   6  FAT16

Disk /dev/sda: 8036 MB, 8036285952 bytes
255 heads, 63 sectors/track, 977 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         976     7839698    b  W95 FAT32
I can't tell where it says how much is used up.

Last edited by gymnart; 09-08-2009 at 01:28 PM. Reason: added info
 
Old 09-08-2009, 01:45 PM   #9
j_jerry
Member
 
Registered: Sep 2009
Distribution: fedora 11
Posts: 318

Rep: Reputation: 46
Did you try df -k ?

fdisk won't give memory usage details, just to make sure everything is working properly.
 
Old 09-08-2009, 04:00 PM   #10
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
It looks like the two USB sticks are not mounted automatically. Maybe, being it an old Suse release it have not plug-and-play capability. To verify, please post the output of the command
Code:
mount
(without options) when the two sticks are inserted and the fdisk -l command gives the output shown above. What if you try to mount them manually?
 
Old 09-08-2009, 04:27 PM   #11
ravedog
Member
 
Registered: Jun 2009
Distribution: Ubuntu, Sabayon
Posts: 30

Rep: Reputation: 0
Quote:
Originally Posted by onebuck View Post
Hi,

Just a few links to aid you in the future;

Linux Documentation Project
Rute Tutorial & Exposition
Linux Command Guide
Linux Newbie Admin Guide
LinuxSelfHelp
Getting Started with Linux

These links and others can be found at 'Slackware-Links' . More than just SlackwareŽ links!

Good tips there bro, cheers!
 
Old 09-09-2009, 03:07 PM   #12
gymnart
Member
 
Registered: Oct 2005
Distribution: SUSE 11.4
Posts: 331

Original Poster
Rep: Reputation: 30
Here's the info on the "mount" command:
Code:
mount
/dev/hda2 on / type reiserfs (rw,acl,user_xattr)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,mode=0620,gid=5)
usbfs on /proc/bus/usb type usbfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/fd0 on /media/floppy type subfs (rw,nosuid,nodev,noatime,fs=floppyfss,procuid)
/dev/sdb1 on /media/usbdisk type subfs (rw,nosuid,nodev,sync,fs=floppyfss,procuid,utf8=true)
/dev/sda1 on /media/usbdisk_1 type subfs (rw,nosuid,nodev,sync,fs=floppyfss,procuid,utf8=true)
and df -k gives the same readout as df -h.

When the usb's are plugged in, they show up right away in Konqueror as /media/usbdisk and /media/usbdisk_1.
 
Old 09-09-2009, 04:12 PM   #13
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Here is the mistery unraveled!
Code:
/dev/fd0 on /media/floppy type subfs (rw,nosuid,nodev,noatime,fs=floppyfss,procuid)
/dev/sdb1 on /media/usbdisk type subfs (rw,nosuid,nodev,sync,fs=floppyfss,procuid,utf8=true)
/dev/sda1 on /media/usbdisk_1 type subfs (rw,nosuid,nodev,sync,fs=floppyfss,procuid,utf8=true)
These three filesystems are mounted by Submount, a kernel module whose "purpose is to automatically mount and unmount cd, floppy, and other removable media drives while remaining entirely invisible to the user" (quoted by Submount project at Sourceforge). I've never seen submount in action, hence I can't tell you anything more about how it works and how you can configure its behaviour. However, you can check your /etc/fstab and if there are entries for /dev/sda1 and /dev/sdb1 you can change the type from subfs to vfat. Hope this helps.

Edit: just out of curiosity I downloaded the source code from Sourceforge and the README file inside the installation directory explains how to setup the subfs filesystem type. Indeed, it uses fstab entries.

Last edited by colucix; 09-09-2009 at 04:23 PM.
 
Old 09-09-2009, 04:32 PM   #14
gymnart
Member
 
Registered: Oct 2005
Distribution: SUSE 11.4
Posts: 331

Original Poster
Rep: Reputation: 30
When I looked, I didn't see any entries for /dev/sda1 or sdb1. This is my fstab:
Code:
cat /etc/fstab
/dev/hda2            /                    reiserfs   acl,user_xattr        1 1
/dev/hda1            swap                 swap       defaults              0 0
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0
/dev/cdrecorder      /media/cdrecorder    subfs      noauto,fs=cdfss,ro,procuid,nosuid,nodev,exec,iocharset=utf8 0 0
/dev/cdrecorder2     /media/cdrecorder2   subfs      noauto,fs=cdfss,ro,procuid,nosuid,nodev,exec,iocharset=utf8 0 0
/dev/fd0             /media/floppy        subfs      noauto,fs=floppyfss,procuid,nodev,nosuid,sync 0 0
none                 /subdomain       subdomainfs noauto         0 0
When I looked at the project page on sourceforge, I found a forum entry that asked if it works with things like USB flash drives (from back in 2005) and the answer from the project admin said: "if you use an automated system to detect the drive when it's plugged in, it will have to be scripted to use subfs."

I also saw that back in 2007, Gentoo dropped submount "because they have to patch it at each Kernel release."

Last edited by gymnart; 09-09-2009 at 04:51 PM. Reason: more info
 
Old 09-09-2009, 04:59 PM   #15
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Quote:
Originally Posted by gymnart View Post
When I looked, I didn't see any entries for /dev/sda1 or sdb1.
Indeed. There are subfs entries for /dev/floppy and the CD drives, whereas the automount of USB sticks is usually managed by udev.
Quote:
When I looked at the project page on sourceforge, I found a forum entry that asked if it works with things like USB flash drives (from back in 2005) and the answer from the project admin said: "if you use an automated system to detect the drive when it's plugged in, it will have to be scripted to use subfs."

I also saw that back in 2007, Gentoo dropped submount "because they have to patch it at each Kernel release."
Yes. You have to find out which udev rule takes control of the USB mounts and which part is responsible of the Submount system. Here is a thread I followed some time ago, with some (hopefully) useful information about the udev system and its rules.
 
  


Reply

Tags
capacity, drive, thumb, usb


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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: Installing "Sugar on a stick" (Strawberry Release) On A USB Stick LXer Syndicated Linux News 0 08-04-2009 04:50 PM
may install from cdrom to USB FLASH DRIVE(to get it a USB stick bootable) the ubuntu lse123 Linux - Newbie 5 01-02-2009 05:56 PM
mount/umount usb stick - PQI Intelligent Stick 2.0 sandbag Linux - Software 5 05-06-2005 12:12 PM
USB problems: Memorex USB stick 256MB and PSX to USB adapter by Radio Shack Knuckles T15 Linux - Hardware 1 05-19-2004 07:58 PM
The you have a Mouse Pointer Problem(mouse stick top left)here is the solution. dr4ven Linux - Hardware 0 05-25-2003 06:53 PM


All times are GMT -5. The time now is 05:36 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration