# help!!! copied mp3 into /boot - SOLVED!

## lo-jay

accidently i copyed an mp3(!) into my /boot:

```
cp /home/jan/AUDIO/AAA_ring_tracks/tool-vicarious.mp3 /dev/sda1
```

i know that's very bad   :Mad:  - how do i remove it???

thanks a lot!

before

```
 # df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda3             3.8G 1017M  2.8G  27% /

udev                 1006M  204K 1006M   1% /dev

/dev/sda1              99M  2.5M   92M   3% /boot

/dev/sda5              14G  7.0G  6.2G  53% /usr

/dev/sda6             3.8G  2.1G  1.7G  56% /var

/dev/sda7             2.8G  637M  2.2G  23% /tmp

/dev/sdb1             190G   32G  159G  17% /home

none                 1006M     0 1006M   0% /dev/shm

```

now!

```
# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda3             3.8G 1017M  2.8G  27% /

udev                 1006M  204K 1006M   1% /dev

/dev/sda1             180G  180G     0 100% /boot

/dev/sda5              14G  7.0G  6.2G  53% /usr

/dev/sda6             3.8G  2.1G  1.7G  56% /var

/dev/sda7             2.8G  637M  2.2G  23% /tmp

/dev/sdb1             190G   32G  159G  17% /home

none                 1006M     0 1006M   0% /dev/shm

```

rm does not seem to work:

```
 # rm -i /boot/tool-vicarious.mp3

rm: cannot lstat `/boot/tool-vicarious.mp3': No such file or directory
```

----------

## desultory

 *lo-jay wrote:*   

> accidently i copyed an mp3(!) into my /boot:
> 
> ```
> cp /home/jan/AUDIO/AAA_ring_tracks/tool-vicarious.mp3 /dev/sda1
> ```
> ...

 

That command would not copy the file into /boot, it would copy the file over /dev/sda1, a somewhat critical difference.

 *lo-jay wrote:*   

> i know that's very bad   - how do i remove it???

 

Try backing up the partition (using, for example, dd), then running fsck on the partition (or a copy thereof), note that the filesystem type will need to be provided as the filesystem type will almost certainly not be properly detected. It is entirely possible that the contents of /dev/sda1 will need to be recreated.

 *lo-jay wrote:*   

> rm does not seem to work:
> 
> ```
>  # rm -i /boot/tool-vicarious.mp3
> 
> ...

 

Considering that, at least, the beginning of /dev/sda1 is now an audio recording instead of a filesystem, that would be expected.

----------

## Scullder

You don't have copied a mp3 to /boot. You have directly write on your /boot partition ! Really bad. :/ Try to make copy of files inside /boot if you can (kernel and grub config), then re-format it and rebuild your /boot. I hope only your /boot is destroyed ^^

----------

## desultory

Actually, if the integrity of the data salvaged from the partition is questionable using a kernel salvaged from the partition is foolhardy at best.

----------

## lo-jay

okay - i know this is bad - ls does not list anything anymore either.

what if i rm /boot & recreat it. to my understanding i need the kernel and / grub/grub.conf -

anything more?

thanks - feeling very incompetent!

ps: df is somehow wrong, since sda only got 74gb

----------

## Scullder

if you want recreate your /boot

umount /dev/sda1

mkfs.ext2 /dev/sda1

Build your kernel (genkernel move the needed files to /boot automatically).

emerge grub, configure it, and then reinstall grub with grub-install

I think it's the best solution.

----------

## lo-jay

o.k got a few questions there:

1. can i not just copy the kernel over:

```
cp arch/x86_64/boot/bzImage /boot/<kernel-version>
```

?

2. on my other box i see a link in /boot?

thanks a lot!

ps: will be back this evening - got to work now...

      insights very welcome in the meantime  :Confused: 

----------

## desultory

 *lo-jay wrote:*   

> 1. can i not just copy the kernel over:
> 
> ```
> cp arch/x86_64/boot/bzImage /boot/<kernel-version>
> ```
> ...

 

That will not work because the filesystem is damaged.

 *lo-jay wrote:*   

> 2. on my other box i see a link in /boot?

 

If that link is a symbolic link named boot linking to the boot directory, that is quite normal.

----------

## lo-jay

so i got to recompile the kernel - right?

and do i have to create that link?

thanks!

----------

## Scullder

 *lo-jay wrote:*   

> so i got to recompile the kernel - right?
> 
> 

 

I think you can use the kernel compiled before in /usr/src/linux/arch/x86_64/boot. But first, reformat correctly your /boot

 *lo-jay wrote:*   

> 
> 
> and do i have to create that link?
> 
> 

 

I don't know what is that link, but you can create it with "ln -s . boot"

----------

## dmartinsca

You can just copy the kernel over. No need to recompile it unless you have changed your config.

You only need that link in /boot if your bootloader config points to your kernel as /boot/kernel-<version>. If your boot loader points to just /kernel-<version> you don't need the link.

----------

## SZwarts

You need to format your boot partition again. Then you need to place a bootloader (grub/lilo) there and put your kernel there. It's probably a good idea just to do these steps from the gentoo handbook.

Step 4.d. Creating Filesystems (do it for boot only)

Then 7c or 7d depending on which kernel you have. You're settings are probably alreadyfine, so after a make you can probably just copy the bzImage

Step 10. Configuring the Bootloader

Also note: Never just work as root. Copying/Playing mp3's is typically a thing which is normal work. You can do this is a normal user and this will protect you from yourself damaging your system. Writing to /dev/sda1 is not (or at least really should not be) allowed for normal users.

----------

## lo-jay

o.k. the relevant line in /boot/grub/grub.conf is

```
kernel /boot/kernel-2.6.17-gentoo-r4 root=/dev/sda3
```

how would i creat the link?

thanks!

----------

## desultory

 *Scullder wrote:*   

> you can create it with "ln -s . boot"

 

Just make sure that the working directory at the time is the root of the /boot filesystem.

----------

## lo-jay

finally got time to attack the mess  :Wink: 

one more time about the soft link - shouldn't i do s.th. like

```
# ln -s /root /boot
```

thanks again!

----------

## desultory

No. The reason for that symbolic link is to allow the kernels in the boot partition to be referenced by the name which they would have in a running system when only the boot partition is mounted. If the symbolic link were created as ln -s /root /boot it would link to nothing when only the /boot partition was mounted as is the case when grub is searching for the kernel and when the /boot partition was mounted under a running system it would still be useless.

In short what is needed to fulfill the purpose of the symbolic link being discussed is to have a symbolic link at the root of the /boot partition which links to the root of the /boot and is named boot.

```
mount /boot

cd /boot

ln -s . boot
```

----------

## lo-jay

o.k. WORKS  :Very Happy:  !

THANKS A LOT for all your help!!!

ps: linux is a damned good os, if even i can't destroy it...

----------

