3

I have two ext partition on my linux

  • One for /
  • And one for /home

I wanted to reduce (with this method) the home partition (which was only something like 10% filled) to create a new partition for Windows.

Unfortunately it failed and when I wanted to reboot, linux went in rescue mode, which could have been helpfull unless this rescue mode was not working (It showed two password prompt, and then was working like there was two command prompt at the same time [I had to double every letter to make a command like : ccwwdd //eettcc], so not really doable).

My question is : Can I boot to this linux anyway without going in rescue mode? Like for example disabling this partition (/etc/fstab?).

Also is it possible to repair this partition ? (When I try to mount it with Ext2Fs it says RAW in partition type)

Here is the parted info :

Model: ATA ST9640320AS (scsi)
Disk /dev/sda: 640GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size    Type      File system     Flags
 1      1049kB  100GB  100GB   primary   ext4
 2      100GB   420GB  320GB   extended
 5      100GB   110GB  9999MB  logical   linux-swap(v1)
 6      110GB   420GB  310GB   logical
 3      420GB   420GB  367MB   primary   ntfs            boot
 4      420GB   640GB  220GB   primary   ntfs

I think the /home partition is /dev/sda6

Fsck output :

ubuntu@ubuntu:~$ sudo fsck.ext4 /dev/sda6
e2fsck 1.42.9 (4-Feb-2014)
ext2fs_open2: Bad magic number in super-block
fsck.ext4: Superblock invalid, trying backup blocks...
fsck.ext4: Bad magic number in super-block while trying to open /dev/sda6

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>

Command output :

ubuntu@ubuntu:~$ findmnt;lsblk -f;sudo partx -svb /dev/sda -oNR,START,END,SECTORS,NAME,FLAGS,SCHEMETARGET                           SOURCE     FSTYPE          OPTIONS
/                                /cow       overlayfs       rw,relatime,lowerdir=//filesystem.squashfs,upperdir=/cow
├─/sys                           sysfs      sysfs           rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup                          tmpfs           rw,relatime,size=4k,mode=755
│ │ └─/sys/fs/cgroup/systemd     systemd    cgroup          rw,nosuid,nodev,noexec,relatime,name=systemd
│ ├─/sys/fs/fuse/connections                fusectl         rw,relatime
│ ├─/sys/kernel/debug                       debugfs         rw,relatime
│ ├─/sys/kernel/security                    securityfs      rw,relatime
│ └─/sys/fs/pstore                          pstore          rw,relatime
├─/proc                          proc       proc            rw,nosuid,nodev,noexec,relatime
├─/dev                           udev       devtmpfs        rw,relatime,size=1977152k,nr_inodes=207544,mode=755
│ └─/dev/pts                     devpts     devpts          rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000
├─/run                           tmpfs      tmpfs           rw,nosuid,noexec,relatime,size=397492k,mode=755
│ ├─/run/lock                               tmpfs           rw,nosuid,nodev,noexec,relatime,size=5120k
│ ├─/run/shm                                tmpfs           rw,nosuid,nodev,relatime
│ └─/run/user                               tmpfs           rw,nosuid,nodev,noexec,relatime,size=102400k,mode=755
│   └─/run/user/999/gvfs         gvfsd-fuse fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=999,group_id=999
├─/cdrom                         /dev/sdb1  vfat            ro,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
├─/rofs                          /dev/loop0 squashfs        ro,noatime
├─/tmp                           tmpfs      tmpfs           rw,nosuid,nodev,relatime
└─/media/ubuntu/04A874F6A874E796 /dev/sda4  fuseblk         rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096
NAME   FSTYPE LABEL MOUNTPOINT
sda                 
├─sda1              
├─sda2              
├─sda3              
├─sda4              /media/ubuntu/04A874F6A874E796
├─sda5              [SWAP]
└─sda6              
sdb                 
└─sdb1              /cdrom
sr0                 
loop0               /rofs
partition: none, disk: /dev/sda, lower: 0, upper: 0
/dev/sda: partition table type 'dos' detected
NR     START        END   SECTORS NAME FLAGS SCHEME
 1      2048  195311615 195309568      0x0   dos
 2 195313662  820317176 625003515      0x0   dos
 3 820318208  821035007    716800      0x80  dos
 4 821035008 1250260991 429225984      0x0   dos
 5 195313664  214843391  19529728      0x0   dos
 6 214843455  820317176 605473722      0x0   dos
PeterFour
  • 403
  • Did you do this from a live cd? If not I think your partitions/filesystem could be corrupted so stop messing around with it until you have a clear view of what's going on. Also add the output of sudo parted --list. – Braiam Aug 17 '14 at 21:02
  • Not with a live CD I unmounted /home and then I tried to shrink it . The problem is for now I can't boot with linux, right now I'm making a live USB to reinstall grub on the MBR and to have access to a command prompt – PeterFour Aug 17 '14 at 21:15
  • 2
    I repeat, don't touch your partitions! Use the Live CD and add the information I asked. The Hard Drive is off limits meanwhile. – Braiam Aug 17 '14 at 21:39
  • @PeterFour... you tried to shrink it by deleting it? What of the other partitions? You have likely done no serious harm yet - the kernel just doesn't know where to start looking for superblocks. See here. – mikeserv Aug 17 '14 at 22:27
  • Oh, and if the partition still exists look at wipefs. Almost definitely there will be backup superblocks distributed elsewhere on the disk and you can detect them and possibly restore them with wipefs - it's probably already installed. – mikeserv Aug 17 '14 at 22:33
  • @mikeserv Yes I'm pretty sure I miss a command or something but I'm also sure it's only a matter of doing the good command. Right now I'm making the liveUSB, and I will try the parted command – PeterFour Aug 18 '14 at 12:11
  • @mikeserv see the link in my question about how I tried to shrink the partition – PeterFour Aug 18 '14 at 12:42
  • @Braiam I tried typing the command with a Debian live USB but the problem is that it's only showing the USB drive, not the internal hard drive, how can I change this? – PeterFour Aug 18 '14 at 16:34
  • @mikeserv I finally manage to access the hard drive with a Linux Live USB, and I added some informations to my question – PeterFour Aug 19 '14 at 13:30
  • @PeterFour - right. Did you look at the other answer? I recommended it because it describes what a superblock is and what a partition table is. What you show is not enough to know what's going on - but if there are backup superblocks available on the partition wipefs will find them - that's its primary purpose. Please look at the man page I linked and read the other answer I linked. I will try to help if I might, but, from afar, it's important that you understand what's going on. The question doesn't provide enough info to be sure - only to guess - and I don't wanna screw up your disk. – mikeserv Aug 19 '14 at 13:48
  • @mikeserv Okay I'm already trying to install testdisk too, I will come back if I have more informations – PeterFour Aug 19 '14 at 13:59
  • I really hate parted, by the way. Can you do these three commands: findmnt;lsblk -f;sudo partx -svb /dev/sda -oNR,START,END,SECTORS,NAME,FLAGS,SCHEME. The partx one is the most important. Please do not do testdisk and PLEASE do not do fsck again. I'm fairly certain the problem is only located in the first few megabytes of the disk, but it may be that in order to restore that you have to look kind of blindly elsewhere. If those programs do not understand the filesystem they're looking at - they might overwrite stuff. A very small change could be dramatic. – mikeserv Aug 19 '14 at 14:01
  • @mikeserv I updated my question with the command output. Also I saw you comment to late but I managed to use testdisk only to save some file (which mean that testdisk know how to read this partition) – PeterFour Aug 19 '14 at 15:07
  • Tried gparted? It's a quite nice GUI, i use it all the time from Knoppix live CD. – LatinSuD Aug 19 '14 at 16:02
  • @LatinSuD Yes but use it for what purpose? Recreate the partition? Restore the superblock? – PeterFour Aug 19 '14 at 16:04
  • I got lost, he unmounted /home and shrunk it. Afakin it should be harmless to booting. – LatinSuD Aug 19 '14 at 16:10
  • @LatinSuD Yes I did, but like that I can access the whole disk without any read/write problem and to avoid further damage to the remaining partitions – PeterFour Aug 19 '14 at 16:15
  • You were right you should use testdisk. It just worked for me several times over with screwed up disk images. You should try to backup first if you can. If you have another disk at all the best thing to do is to write and image of your disk to another and use it for your recovery testing. – mikeserv Aug 19 '14 at 20:07
  • @mikeserv I think that now I got pretty much everything of my data partition I can now reinstall a brand new one, it may be simpler I think – PeterFour Aug 20 '14 at 17:24

0 Answers0