LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Cfdisk misuse crashing the filesystem. (https://www.linuxquestions.org/questions/slackware-14/cfdisk-misuse-crashing-the-filesystem-4175511189/)

stf92 07-15-2014 02:57 PM

Cfdisk misuse crashing the filesystem.
 
Hi:

Bad use of cfdisk caused a big tree to be moved to a hidden directory. I had the partition table like this:
Code:

    sda1        Primary  ext2  [slack14-32]            20003.89 MB
    sda2        Primary  ntfs                          22940.31 MB
    sda3        Primary  swap                          4000 MB
    sda4        Extended
    sda5        Logical  vfat  [FREEDOS2012]          1000 MB
    sda6        Logical  ext2  [ALMACEN]            451773.51 MB

A DOS-like OS requires a primary partition. I made up my mind to use a swap file instead of sda3 and place FreeDOS in sda3. At the moment of writing the new partition table I had sda6 mounted, which is most probably the cause of the resulting mess. This a SATA hard disk seen as having 4KB sectors by fdisk. Always using cfdisk, I deleted the third partition (sda3) and made it vfat (type 0x0C, FAT32), suitable for FreeDOS. Then I deleted the 5th one (sda5) and updated the partition table. And then I saw ALMACEN was now sda5. But alas, ALMACEN was mounted during the update (not sure but most probably). Before the update (I keep calling it "update" for brevity; its the writing of the partition table) ALMACEN contained four directories:
Code:

CINE/
sma_/
soft/
Nonsoft/

But now, after the update, this is its contents:
Code:

root@server:~# ls -la /almacen/ 
total 24
drwxr-xr-x  6 bill semoi 4096 2014-07-15 15:45 ./
drwxr-xr-x 25 root root  4096 2014-07-14 15:34 ../
drwx------  4 bill semoi 4096 2014-06-22 22:44 .Trash-1000/
drwxrwxrwx  4 bill semoi 4096 2014-05-30 13:57 CINE/
drwxrwxrwx 93 bill semoi 4096 2014-06-22 12:45 sma_/
drwxrwxrwx 74 bill semoi 4096 2014-06-19 23:54 soft/
root@server:~# ls -la /almacen/.Trash-1000/
total 16
drwx------ 4 bill semoi 4096 2014-06-22 22:44 ./
drwxr-xr-x 6 bill semoi 4096 2014-07-15 15:45 ../
drwx------ 4 bill semoi 4096 2014-07-15 15:45 files/
drwx------ 2 bill semoi 4096 2014-07-15 15:45 info/
root@server:~# ls -la /almacen/.Trash-1000/files/
total 932
drwx------  4 bill semoi  4096 2014-07-15 15:45 ./
drwx------  4 bill semoi  4096 2014-06-22 22:44 ../
drwxrwxrwx 43 bill semoi  4096 2014-03-23 12:51 Nonsoft/
drwxrwxrwx  2 bill semoi  4096 2014-03-23 12:51 THAYER/
-rw-rw-rw-  1 bill semoi  1164 2012-07-08 16:21 TRANS.TBL
-rw-r--r--  1 bill semoi 926721 2014-06-22 22:43 jsbach00widogoog_djvu.txt
root@server:~#

The old /almacen/Nonsoft directory had been transferred to the mysterious /almacen/.Trash-1000 directory. Who created it and who created the no less mysterious files and info directories? Is it possible that such a sophisticated rearrangement of the filesystem has been caused by messing with the partition table while ALMACEN (old sda6, new sda5) was mounted? No OS other than Slackware 14.0 could have messed with ALMACEN, which is ext2.

Slackware 14.0, 32 bits.

smallpond 07-15-2014 03:32 PM

I doubt that cfdisk created jsbach00widogoog_djvu.txt. cfdisk is more into heavy metal than Bach.
Also, the dates indicate that these files have existed for a while, and were not created at the same time.
Somehow your files were moved to the trash Jun-22 and you have only noticed now because you are looking at other problems.

Here is a discussion of the Trash folder
http://www.linuxquestions.org/questi...1000-a-823077/

stf92 07-15-2014 09:09 PM

"cfdisk is more into heavy metal than Bach.": I didn't know. You're right. .Trash-1000 was created long ago according to the time stamp. I hadn't noticed. And 1000 is the uid of the user running the GUI, which is me. So I was lucky that some program run in the GUI made that "backup" for me, because my last backup of the partition in question is two months old. Still, how could the system have erased the Nonsoft directory from /almacen, the mount point of the old /dev/sda6 (now /dev/sda5)? I'm pretty sure Nonsoft was in /almacen a couple of days ago. However, according to your link, it is more probable that Nonsoft was deleted at the same time when .Trash-1000 was created, Jun 22. I don't know what to think.

In any case, the GUI application who deleted Nonsoft could have prompted for confirmation before proceeding to erase a directory with hundreds of files in it! And unfortunately, linux does not keep a log file registering every command executed by the user with its dates. Otherwise, I could now know more about what happened. Thanks for your reply.

Didier Spaier 07-16-2014 02:20 AM

Quote:

Originally Posted by stf92 (Post 5204477)
And unfortunately, linux does not keep a log file registering every command executed by the user with its dates.

No. But If you just want to remember what you did during a terminal session, script comes handy. Be careful, that could be used by the NSA or your boss as well. There's also history, of course.


All times are GMT -5. The time now is 03:41 AM.