Results 1 to 10 of 72
Hi Forum, I have a problem that the same files appear to be on two different devices. How can I see what device a file is on??
/dev/hdc1 has /data
...
- 04-23-2009 #1Linux Newbie
- Join Date
- Sep 2008
- Location
- Port Moresby
- Posts
- 156
how to find out where a file is stored
Hi Forum, I have a problem that the same files appear to be on two different devices. How can I see what device a file is on??
/dev/hdc1 has /data
/dev/hdb1 has /home
yet when I ls -la the same files are on both /data & /home
- 04-23-2009 #2
Post the output of df -h and fdisk -l commands.
Code:df -h su - fdisk -l
It is amazing what you can accomplish if you do not care who gets the credit.
New Users: Read This First
- 04-23-2009 #3Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
You might have a directory on one that is linked to the other. If you are using the desktop file manager to look at them, you might not be able to easily tell that one actually is on the other device. You can tell which physical device a file is stored on by going to a command-line window, cd to the directory in question on one device, then execute the command: df filename ---- that will show you where the file is physically located. Then, go to the directory on the other device and execute the same: df filename ---- If they are on the same device, then one is a link. If they aren't, then you have a copy of the file.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 04-23-2009 #4
Rubberman:
Are you sure about that 'df' command?
df - report file system disk space usage
Bill McKinstry:
When you do the ls -la you should see a link like in the folowing if the files are linked:
The above files are all linked to another place and this can be seen by the '->' on the line telling you where they are linked to with full paths. Take note you will only see this on the directory that holds the linked files. The directory with the files will not have links. If you are not seeing something like above then the files are located in both places.Code:lrwxrwxrwx 1 root root 22 Apr 1 10:37 grub.conf -> ../boot/grub/grub.conf lrwxrwxrwx 1 root root 7 Apr 1 10:26 rc -> rc.d/rc lrwxrwxrwx 1 root root 10 Apr 1 10:26 rc0.d -> rc.d/rc0.d lrwxrwxrwx 1 root root 10 Apr 1 10:26 rc1.d -> rc.d/rc1.d lrwxrwxrwx 1 root root 10 Apr 1 10:26 rc2.d -> rc.d/rc2.d lrwxrwxrwx 1 root root 10 Apr 1 10:26 rc3.d -> rc.d/rc3.d lrwxrwxrwx 1 root root 10 Apr 1 10:26 rc4.d -> rc.d/rc4.d lrwxrwxrwx 1 root root 10 Apr 1 10:26 rc5.d -> rc.d/rc5.d lrwxrwxrwx 1 root root 10 Apr 1 10:26 rc6.d -> rc.d/rc6.d
- 04-23-2009 #5Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
Yes. When applied to a file, it will show where the file is actually located. The ls -l command will show that the file is linked and where to, but in this case I suspect that the directory the file is in is what is linked, in which case, if you cd to that directory (via link or not), then ls -l will not show a link. That's why I suggested using df. In this case, even if the file is a link, df <filename> will display the device it REALLY lives on. Example (I have two log files in my /root directory. One is local and the other is a link to a file on another device):
As you can see, it displays the actual device where the file lives. In this case b.log is on /home and a.log is on /.Code:[root@cos1 ~]# df a.log b.log Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 276603584 24029052 238297168 10% / /dev/mapper/VolGroup00-LogVol00 1892322104 874101844 920545408 49% /homeSometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 04-23-2009 #6
Thnx for the reply. One learns something new every day.
- 04-23-2009 #7Linux Newbie
- Join Date
- Sep 2008
- Location
- Port Moresby
- Posts
- 156
Hi devils casper - outputs as requested. Thanks, Bill
[root@mailserver ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda3 72G 7.6G 60G 12% /
/dev/hda1 244M 12M 220M 5% /boot
/dev/hdb2 37G 12G 24G 33% /music
none 473M 0 473M 0% /dev/shm
/dev/hdb1 111G 14G 92G 13% /home
/dev/hdc1 111G 14G 92G 13% /data
[root@mailserver ~]#
[root@mailserver ~]# su -
[root@mailserver ~]# fdisk -1
fdisk: invalid option -- 1
Usage: fdisk [-b SSZ] [-u] DISK Change partition table
fdisk -l [-b SSZ] [-u] DISK List partition table(s)
fdisk -s PARTITION Give partition size(s) in blocks
fdisk -v Give fdisk version
Here DISK is something like /dev/hdb or /dev/sda
and PARTITION is something like /dev/hda7
-u: give Start and End in sector (instead of cylinder) units
-b 2048: (for certain MO disks) use 2048-byte sectors
[root@mailserver ~]#
fdisk does not work on our system????
- 04-23-2009 #8Linux Guru
- Join Date
- Oct 2007
- Location
- Tucson AZ
- Posts
- 1,943
Did you type fdisk -l (with a lower case letter L) or a number one, should be lower case letter L.
- 04-23-2009 #9Linux Newbie
- Join Date
- Sep 2008
- Location
- Port Moresby
- Posts
- 156
Hi Rubberman, Here is output of "ls" & "df bill" for both /home & /data.
[root@mailserver /]# cd home/
[root@mailserver home]# ls
bill henao hmileng jackie julanne lost+found margaret putty.exe PUTTY.RND wendy winscp.RND
[root@mailserver home]# df bill/
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hdb1 115377640 13981280 95535448 13% /home
[root@mailserver home]# cd /
[root@mailserver /]# cd data/
[root@mailserver data]# ls
bill henao hmileng jackie julanne lost+found margaret putty.exe PUTTY.RND wendy winscp.RND
[root@mailserver data]# df bill
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hdc1 115377640 13981280 95535448 13% /data
[root@mailserver data]#
They appear to be copies.. but when I delete one it is deleted on the other /dev?? I will create a file on one and see if it is also created on the other.
- 04-23-2009 #10Linux Newbie
- Join Date
- Sep 2008
- Location
- Port Moresby
- Posts
- 156
Here is the new file created in /home directory but also appearing in /data??
[root@mailserver data]# cd /home
[root@mailserver home]# touch filetest
[root@mailserver home]# ls
bill filetest henao hmileng jackie julanne lost+found margaret putty.exe PUTTY.RND wendy winscp.RND
[root@mailserver home]# cd /data
[root@mailserver data]# ls
bill filetest henao hmileng jackie julanne lost+found margaret putty.exe PUTTY.RND wendy winscp.RND
[root@mailserver data]#


Reply With Quote
