LinuxQuestions.org
Help answer threads with 0 replies.
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 12-12-2011, 02:54 PM   #1
JamesMore
LQ Newbie
 
Registered: Jul 2010
Posts: 12

Rep: Reputation: 0
Smile Running out of space due to an incorrect mounting


I am following a embedded Linux tutorial and just having a few issues and I think its down to just my knowledge of Linux.

I have a feeling I am not correctly mounting and coping the files to the correct location

The tutorial basically gets you to connect a USB drive format it and then mount and copy files on to the drive, each time I try and copy the files to the drive for some reason I run out of disk space as I feel I am not copying the files to the correct drive.

Here is my USB drive that is setup for two partitions a normal partition and a swap drive. This is the drive that I am trying to add to my device to add extra space.


Code:
 cfdisk (util-linux-ng 2.13.0.1)

                                                     Disk Drive: /dev/scsi/host0/bus0/target0/lun0/disc
                                                               Size: 516059648 bytes, 516 MB
                                                    Heads: 16   Sectors per Track: 62   Cylinders: 1016

       Name                    Flags                 Part Type            FS Type                         [Label]                     Size (MB)
 ----------------------------------------------------------------------------------------------------------------------------------------------------------
       disc1                                          Primary             Linux ext3                                                     460.17             
       disc2                                          Primary             Linux swap / Solaris                                            55.87


Code:
dmesg | grep -i "SCSI device"
SCSI device sda: 1007929 512-byte hdwr sectors (516 MB)
SCSI device sda: 1007929 512-byte hdwr sectors (516 MB)

Code:
ls -la /dev/discs/
drwxr-xr-x    1 root     root            0 Dec 31  1969 .
drwxr-xr-x    1 root     root            0 Dec 31  1969 ..
lr-xr-xr-x    1 root     root           31 Dec 31  1969 disc0 -> ../scsi/host0/bus0/target0/lun0

Code:
ls -la /dev/discs/disc0/*
brw-------    1 root     root       8,   0 Dec 31  1969 /dev/discs/disc0/disc
brw-------    1 root     root       8,   1 Dec 31  1969 /dev/discs/disc0/part1
brw-------    1 root     root       8,   2 Dec 31  1969 /dev/discs/disc0/part2
Now that the drive is formatted and partitioned I try and mount it

~$ mkdir -p /mnt/root
~$ mount /dev/discs/disc0/part1 /mnt/root

based on the tutoral it says to setup some swap just in case the router runs out of memory

~$ mkswap /dev/discs/disc0/part2
~$ swapon /dev/discs/disc0/part2

Now this next step is where I run in to problems

Copy all fs into new mounted partition.

~$ tar cvO -C / bin/ etc/ root/ lib/ sbin/ usr/ www/ var/ | tar x -C /mnt/root

As it starts to copy files it then halts on

tar: write error: No space left on device


Code:
 df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 1728      1728         0 100% /rom
tmpfs                     7160        32      7128   0% /tmp
/dev/mtdblock/4           1664      1620        44  97% /overlay
mini_fo:/overlay          1728      1728         0 100% /
What I feel I am doing is rather than coping the files from the local system to the USB drive I am just coping the files back on to the original drive and this is the reason I run out of space each time.

Thanks for your help
 
Old 12-12-2011, 04:21 PM   #2
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,036

Rep: Reputation: 96
The output from df is not showing the /mnt/root mount point, does the mount command complete without errors?

what happens if you use:
Code:
mount /dev/sda1 /mnt/root
df -k /mnt/root
 
Old 12-12-2011, 04:34 PM   #3
JamesMore
LQ Newbie
 
Registered: Jul 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Thank you for the reply Disillusionist

The mount command does not come back with any error but yet looking at the free space it is showing as 100% yet from the commands above you can see the USB drive is much bigger than what is show below and I think it is still mounting to a local share rather than the USB mount

Code:
root@host:~# mount /dev/sda1 /mnt/root
root@host:~# df -k /mnt/root
Filesystem           1K-blocks      Used Available Use% Mounted on
mini_fo:/overlay          1728      1728         0 100% /
 
Old 12-12-2011, 05:08 PM   #4
kamaradski1
LQ Newbie
 
Registered: Oct 2011
Location: Currently in Bulgaria
Distribution: Xubuntu, Turnkey-LAMP, Turnkey-CORE
Posts: 22

Rep: Reputation: Disabled
alright few items to add here that might or not help you.

- you might want to do the partitioning on another linux machine (if you have one) as those opt-ware packages (including mke2fs) sometimes have a hickup and might give unpredictable results in some situations. For instance i never managed to prepare my 500GB disk on the router, and had to format my partition on the debian box to get the wanted results.

- not sure about OpenWRT, but my set-up in DD-WRT allowed me to only move JFFS to a partition on the hard-drive thus avoiding the hassle of moving your root. This would keep things a lot less complicated. And you router would still boot when the USB fails..

- you can use df -h to check better the values of your disk partitions (human readable values)
Code:
df
/dev/sdd1            1922860904 1593929744 328931160  83% /media/WD2TB-01

df -h
/dev/sdd1             1.8T  1.5T  314G  83% /media/WD2TB-01
You will easily be able to recognize what partition you are looking at, or identify any errors in the formatting process.

It's not much but this is how far i can help you with this.

KR
kamaradski
 
Old 12-12-2011, 10:26 PM   #5
JamesMore
LQ Newbie
 
Registered: Jul 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks for the tips kamaradski1 I will recreate the USB stick with the correct partitions outside of OpenWRT and try that and see if it helps but I wont hold my breath, on your other hints from reading OpenWRT is not JFFS based so I don't think it will help me.
 
Old 12-13-2011, 03:01 AM   #6
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,036

Rep: Reputation: 96
Quote:
Originally Posted by JamesMore View Post
Thank you for the reply Disillusionist

The mount command does not come back with any error but yet looking at the free space it is showing as 100% yet from the commands above you can see the USB drive is much bigger than what is show below and I think it is still mounting to a local share rather than the USB mount

Code:
root@host:~# mount /dev/sda1 /mnt/root
root@host:~# df -k /mnt/root
Filesystem           1K-blocks      Used Available Use% Mounted on
mini_fo:/overlay          1728      1728         0 100% /
As you can see df is not showing anything mounted on /mnt/root (Mounted on is showing / which is the root volume)

This explains why you have run out of space, and you will need to remove the contents from /mnt/root to free up space.

Be very careful when typing the following:
Code:
rm -rf /mnt/root/[a-zA-Z][a-zA-Z]*
This will remove all files and folders starting with a letter below /mnt/root so be sure that you have typed this correctly before hitting return.

You should now have some space in / and an empty /mnt/root folder:
Code:
df -h
ls -l /mnt/root
mount -t ext3 /dev/sda1 /mnt/root
echo $?
df -h
You may also want to try mount with -n option:
Code:
mount -n /dev/sda1 /mnt/root

Last edited by Disillusionist; 12-13-2011 at 03:03 AM.
 
Old 12-13-2011, 01:50 PM   #7
JamesMore
LQ Newbie
 
Registered: Jul 2010
Posts: 12

Original Poster
Rep: Reputation: 0
formatted the drive out side openwrt to please kamaradski1 :-)


Disillusionist thank you for the extra hints here are the results

Code:
root@host:/mnt/root# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 1.7M      1.7M         0 100% /rom
tmpfs                     7.0M     88.0K      6.9M   1% /tmp
/dev/mtdblock/4           1.6M    996.0K    668.0K  60% /overlay
mini_fo:/overlay          1.7M      1.7M         0 100% /


root@host:/mnt/root# dmesg | grep -i "SCSI device"
SCSI device sda: 1007929 512-byte hdwr sectors (516 MB)
SCSI device sda: 1007929 512-byte hdwr sectors (516 MB)

root@host:/mnt/root# mount -t ext3 /dev/sda1 /mnt/root
root@host:/mnt/root# echo $?
111

root@host:/mnt/root# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 1.7M      1.7M         0 100% /rom
tmpfs                     7.0M     88.0K      6.9M   1% /tmp
/dev/mtdblock/4           1.6M    996.0K    668.0K  60% /overlay
mini_fo:/overlay          1.7M      1.7M         0 100% /

root@host:/mnt/root# mount -n /dev/sda1 /mnt/root
root@host:/mnt/root# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 1.7M      1.7M         0 100% /rom
tmpfs                     7.0M     88.0K      6.9M   1% /tmp
/dev/mtdblock/4           1.6M    996.0K    668.0K  60% /overlay
mini_fo:/overlay          1.7M      1.7M         0 100% /

root@host:/mnt/root# df -k /mnt/root
Filesystem           1K-blocks      Used Available Use% Mounted on
mini_fo:/overlay          1728      1728         0 100% /
Still showing Mounted on / does the /dev/root use of 100% might be the issue

Code:
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 1.7M      1.7M         0 100% /rom
 
Old 12-13-2011, 04:41 PM   #8
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,036

Rep: Reputation: 96
Quote:
Originally Posted by JamesMore View Post
Code:
root@host:/mnt/root# mount -t ext3 /dev/sda1 /mnt/root
root@host:/mnt/root# echo $?
111
An exit code of 111 means that the mount command is failing with "cannot open character device"

What is the output of:
Code:
ls -l /dev/sda*
should be something like:
Code:
ls -l /dev/sda*
brw-rw---- 1 root disk 8,  0 2011-12-13 21:45 /dev/sda
brw-rw---- 1 root disk 8,  1 2011-12-13 21:45 /dev/sda1
brw-rw---- 1 root disk 8,  2 2011-12-13 21:45 /dev/sda2

Last edited by Disillusionist; 12-13-2011 at 04:48 PM.
 
Old 12-13-2011, 07:45 PM   #9
JamesMore
LQ Newbie
 
Registered: Jul 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Disillusionist, we might be getting some where thank you for sticking with this problem

Code:
root@host:~# dmesg | grep -i "SCSI device"
SCSI device sda: 1007929 512-byte hdwr sectors (516 MB)
root@host:~# ls -l /dev/sda*
ls: /dev/sda*: No such file or directory
 
Old 12-14-2011, 12:42 AM   #10
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,036

Rep: Reputation: 96
Try making the device files manually:
Code:
mknod /dev/sda b 8 0
mknod /dev/sda1 b 8 1
mknod /dev/sda2 b 8 2
 
Old 12-14-2011, 12:39 PM   #11
JamesMore
LQ Newbie
 
Registered: Jul 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Hi Disillusionist thanks for the next hint, please see the results still error code 111 but we do have the device files now

Code:
root@host:~# mknod /dev/sda b 8 0
root@host:~# mknod /dev/sda1 b 8 1
root@host:~# mknod /dev/sda2 b 8 2


root@host:~# ls -l /dev/sda*
brw-r--r--    1 root     root       8,   0 Dec 14 11:25 /dev/sda
brw-r--r--    1 root     root       8,   1 Dec 14 11:25 /dev/sda1
brw-r--r--    1 root     root       8,   2 Dec 14 11:26 /dev/sda2

root@host:~# mount -n /dev/sda1 /mnt/root
root@host:~# echo $?
111


root@host:~# df -k /mnt/root
Filesystem           1K-blocks      Used Available Use% Mounted on
mini_fo:/overlay          1728      1728         0 100% /

Code:
mount -t ext3 /dev/sda1 /mnt/root
Also gives the same results
 
Old 12-14-2011, 05:23 PM   #12
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,036

Rep: Reputation: 96
Stupid question, you did run the following to create the ext3 filesystem:
Code:
mke2fs -j /dev/sda1
 
Old 12-15-2011, 02:29 AM   #13
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,036

Rep: Reputation: 96
Another thought, please provide output of:
Code:
fdisk -l /dev/sda
 
Old 12-15-2011, 01:54 PM   #14
JamesMore
LQ Newbie
 
Registered: Jul 2010
Posts: 12

Original Poster
Rep: Reputation: 0
I rebooted the device this morning, and tried out the above here is todays results

Code:
root@host:~# dmesg | grep -i "SCSI device"
SCSI device sda: 1007929 512-byte hdwr sectors (516 MB)
root@host:~# mke2fs -j /dev/sda1
mke2fs 1.41.11 (14-Mar-2010)
Could not stat /dev/sda1 --- No such file or directory

The device apparently does not exist; did you specify it correctly?
root@host:~# mknod /dev/sda b 8 0
root@host:~# mknod /dev/sda1 b 8 1
root@host:~# mknod /dev/sda2 b 8 2
root@host:~# mke2fs -j /dev/sda1

mke2fs -j /dev/sda1
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
112640 inodes, 449344 blocks
22467 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67633152
55 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


root@host:~# fdisk -l /dev/sda
read failed: Invalid argument

Disk /dev/sda: 516 MB, 516059648 bytes
16 heads, 62 sectors/track, 1016 cylinders
Units = cylinders of 992 * 512 = 507904 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         906      449345   83  Linux
/dev/sda2             907        1016       54560   82  Linux swap / Solaris
When I do the df command I do see 100% used see below could this be the reason ? that some thing else that needs writing to is full up
I did do the rm -rf /mnt/root/[a-zA-Z][a-zA-Z]*) command as you stated a few days ago

Code:
root@host:~# mount -n /dev/sda2 /mnt/root
root@host:~# df -k /mnt/root
Filesystem           1K-blocks      Used Available Use% Mounted on
mini_fo:/overlay          1728      1728         0 100% /

root@host:~# free
              total         used         free       shared      buffers
  Mem:        14324         8196         6128            0          280
 Swap:            0            0            0
Total:        14324         8196         6128

Last edited by JamesMore; 12-15-2011 at 02:08 PM. Reason: sharing the space comment / ideas
 
Old 12-16-2011, 01:05 AM   #15
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,036

Rep: Reputation: 96
Firstly, the reboot.

The device files are being automatically created at boot time, so we should go back to using the auto generated files:
Code:
ls -la /dev/discs/disc0/*
brw-------    1 root     root       8,   0 Dec 31  1969 /dev/discs/disc0/disc
brw-------    1 root     root       8,   1 Dec 31  1969 /dev/discs/disc0/part1
brw-------    1 root     root       8,   2 Dec 31  1969 /dev/discs/disc0/part2
These have the same block file settings that we set for /dev/sda

Secondly, do you have a different USB memory stick to test with? in case there is a hardware issue with the stick.

Additionally, could you show the complete dmesg output?

Last edited by Disillusionist; 12-16-2011 at 01:06 AM.
 
  


Reply


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
cannot boot due to incorrect entry in fstab metcub Linux - General 3 11-27-2012 04:52 AM
Linux NULL pointer dereference due to incorrect proto_ops initializations win32sux Linux - Security 15 08-19-2009 05:55 AM
Recovery of data due to incorrect use of 'mv' AppleNinja Linux - Newbie 3 07-22-2007 07:41 AM
kernel panic due to incorrect root partition neelay1 Linux - General 7 05-02-2006 04:14 PM
disk space incorrect burnt_toast Linux - Software 2 09-16-2003 09:33 PM


All times are GMT -5. The time now is 11:49 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration